Config.h 56 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323
  1. /*
  2. * Config.h
  3. *
  4. * Created on: 2019年4月23日
  5. * Author: foluswen
  6. */
  7. #ifndef CONFIG_H_
  8. #define CONFIG_H_
  9. #include <stdbool.h>
  10. typedef unsigned char byte;
  11. #define MODE_BOOT 0
  12. #define MODE_IDLE 1
  13. #define MODE_AUTHORIZING 2
  14. #define MODE_REASSIGN_CHECK 3
  15. #define MODE_REASSIGN 4
  16. #define MODE_PRECHARGE 5
  17. #define MODE_PREPARE_FOR_EV 6
  18. #define MODE_PREPARE_FOR_EVSE 7
  19. #define MODE_CHARGING 8
  20. #define MODE_TERMINATING 9
  21. #define MODE_COMPLETE 10
  22. #define MODE_ALARM 11
  23. #define MODE_FAULT 12
  24. #define MODE_RESERVATION 13
  25. #define MODE_BOOKING 14
  26. #define MODE_MAINTAIN 15
  27. #define MODE_DEBUG 16
  28. #define MODE_CCS_PRECHARGE_STEP0 17 // ready for ccs precharge processing, For D+ relay to precharge relay
  29. #define MODE_CCS_PRECHARGE_STEP1 18 // waitting for ev board inform to enter to charging, For precharge relay to D+ relay
  30. #define MODE_UPDATE 19
  31. #define GFD_WAIT 0
  32. #define GFD_PASS 1
  33. #define GFD_FAIL 2
  34. #define GFD_WARNING 3
  35. #define PRECHARGE_WAIT 0
  36. #define PRECHARGE_READY 1
  37. #define PRECHARGE_PRERELAY_PASS 2
  38. #define PRECHARGE_CHARELAY_PASS 3
  39. #define BOOTTING 0
  40. #define BOOT_COMPLETE 1
  41. #define uSEC_VAL 1000000
  42. #define mSEC_VAL 1000
  43. #define MAX_DISPENSER_QUANTITY 4
  44. #define MAX_GUN_QUANTITY 4
  45. #define MAX_GROUP_QUANTITY 4
  46. #define MAX_PSU_MODULE_QUANTITY 62
  47. #define MAX_MODULE_PER_GROUP 12
  48. #define SM_ChargerInfoKey 3000
  49. #define SAFETY_TEST_ENABLE 0
  50. #define MAX_SLAVE_CABINET_QUANTITY 4
  51. #define MASTER_ETH1_IP "192.168.100.1"
  52. #define MASTER_ETH1_SUBMASK "255.255.255.0"
  53. #define SLAVE_ETH1_IP "192.168.0.10"
  54. #define SLAVE_ETH1_SUBMASK "255.255.255.0"
  55. #define AUTHORIZE_COMPLETED_TIME 3
  56. #define STARTTRANSATION_IMMEDIATELY
  57. #define ENABLE_PCBA_TEST 0
  58. #define PARALLEL_RELAY_COUNT 6
  59. #define _PHIHONG_PRICE_SPLIT_KEY ","
  60. #define _AUDI_PRICE_SPLIT_KEY ";"
  61. #define _OIL_PRICE_SPLIT_KEY "\n"
  62. // ********** Audi ********** //
  63. // Model Name: DOYC182000D2AD
  64. // Model Name: DDYC182V0UE2AD
  65. // ********** e4you ********** //
  66. // Model Name: DKYE182000D1E4
  67. // Model Name: DXYE182E00E1E4
  68. // ********** xpeng ********** //
  69. // Model Name: DOYE362000D2XP
  70. // Model Name: DDYE362F0KE2XP
  71. // *********** BYD *********** //
  72. // Model Name: DOYE242000D2BD
  73. // Model Name: DDYE242V0UE2BD
  74. // *********** TCC *********** //
  75. // Model Name: DBYE182000D1PH
  76. // Model Name: DBYC182000D1TC
  77. // Model Name: DDYC182V0EE1TC
  78. #define STR_LITTLE_ENDIAN "Little Endian"
  79. #define STR_BIG_ENDIAN "Big Endian"
  80. #define STR_MODE_BOOT "Booting"
  81. #define STR_MODE_IDLE "Idle"
  82. #define STR_MODE_AUTHORIZING "Authorizing"
  83. #define STR_MODE_REASSIGN_CHECK "ReassignCheck"
  84. #define STR_MODE_REASSIGN "Reassign"
  85. #define STR_MODE_PREPARNING "Preparing"
  86. #define STR_MODE_PREPARING_EV "PreparnForEV"
  87. #define STR_MODE_PREPARING_EVSE "PrepareForEVSE"
  88. #define STR_MODE_CHARGING "Charging"
  89. #define STR_MODE_TERMINATING "Terminating"
  90. #define STR_MODE_COMPLETE "Completed"
  91. #define STR_MODE_ALARM "Alarm"
  92. #define STR_MODE_FAULT "Fault"
  93. #define STR_MODE_RESERVATION "Reservation"
  94. #define STR_MODE_BOOKING "Booking"
  95. #define STR_MODE_MAINTAIN "Maintain"
  96. #define STR_MODE_DEBUG "Debug"
  97. #define STR_MODE_CCS_ST0 "CCS_ST0"
  98. #define STR_MODE_CCS_ST1 "CCS_ST1"
  99. #define STR_MODE_UPDATE "Update"
  100. #define STR_MODE_NONE "None"
  101. enum _SYSTEM_STATUS
  102. {
  103. S_BOOTING = 0,
  104. S_IDLE,
  105. S_AUTHORIZING,
  106. S_REASSIGN_CHECK,
  107. S_REASSIGN,
  108. S_PREPARNING,
  109. S_PREPARING_FOR_EV,
  110. S_PREPARING_FOR_EVSE,
  111. S_CHARGING,
  112. S_TERMINATING,
  113. S_COMPLETE,
  114. S_ALARM,
  115. S_FAULT,
  116. S_RESERVATION,
  117. S_BOOKING,
  118. S_MAINTAIN,
  119. S_DEBUG,
  120. S_CCS_PRECHARGE_ST0,
  121. S_CCS_PRECHARGE_ST1,
  122. S_UPDATE,
  123. S_NONE,
  124. };
  125. enum _AC_SYSTEM_STATUS
  126. {
  127. AC_SYS_NONE = 0,
  128. AC_SYS_A,
  129. AC_SYS_B,
  130. AC_SYS_C,
  131. AC_SYS_D,
  132. AC_SYS_E
  133. };
  134. #define STR_GUN_TYPE_CHADEMO "CHAdeMO"
  135. #define STR_GUN_TYPE_CCS "CCS"
  136. #define STR_GUN_TYPE_GBT "GBT"
  137. #define STR_GUN_TYPE_AC "AC"
  138. #define STR_GUN_TYPE_UNKNOWN "Unknown Type"
  139. enum _GUN_TYPE
  140. {
  141. _Type_Chademo = 0,
  142. _Type_CCS_2,
  143. _Type_GB,
  144. _Type_AC,
  145. _Type_Unknown = 0xFF
  146. };
  147. enum _LCM_INDEX
  148. {
  149. _LCM_INIT = 0x00,
  150. _LCM_IDLE = 0x01,
  151. _LCM_AUTHORIZING = 0x02,
  152. _LCM_AUTHORIZ_COMP = 0x03,
  153. _LCM_AUTHORIZ_FAIL = 0x04,
  154. _LCM_WAIT_FOR_PLUG = 0x05,
  155. _LCM_PRE_CHARGE = 0x06,
  156. _LCM_CHARGING = 0x07,
  157. _LCM_COMPLETE = 0x08,
  158. _LCM_FIX = 0x09,
  159. _LCM_NONE = 0xFF,
  160. };
  161. enum _DispenserAuthorizeStatus
  162. {
  163. _AuthorizeStatus_Idle = 0x00,
  164. _AuthorizeStatus_Wait = 0x01,
  165. _AuthorizeStatus_Busy = 0x02,
  166. _AuthorizeStatus_Done = 0x03,
  167. _AuthorizeStatus_End = 0x04,
  168. };
  169. enum _ConnectorAuthorizeResult
  170. {
  171. _AuthResult_None = 0x00,
  172. _AuthResult_Valid = 0x01,
  173. _AuthResult_Invalid = 0x02,
  174. };
  175. enum _AuthorizedType
  176. {
  177. _AuthType_None = 0x00,
  178. _AuthType_RFID = 0x01,
  179. _AuthType_RemoteStart = 0x02,
  180. };
  181. enum _SELF_TEST_SEQ
  182. {
  183. _STEST_VERSION = 0x00,
  184. _STEST_CabinetSwitch = 0x01,
  185. _STEST_AC_CONTACTOR = 0x02,
  186. _STEST_PSU_DETECT = 0x03,
  187. _STEST_PSU_CAP = 0x04,
  188. _STEST_PSU_RETRY = 0x05,
  189. _STEST_EMG_BTN = 0x06,
  190. _STEST_FAIL = 0x07,
  191. _STEST_COMPLETE = 0xEE,
  192. };
  193. enum _MODULE_PSU_WORK_STEP
  194. {
  195. INITIAL_START = 0,
  196. GET_PSU_COUNT = 1,
  197. Get_PSU_LOCATION = 2,
  198. Get_PSU_VERSION = 3,
  199. PSU_COUNT_CONFIRM = 4,
  200. GET_SYS_CAP = 5,
  201. BOOTING_COMPLETE = 6,
  202. _WORK_CHARGING = 10,
  203. _TEST_MODE = 20,
  204. _NO_WORKING = 254,
  205. _INIT_PSU_STATUS = 255
  206. };
  207. enum _OFFLINE_POLICY
  208. {
  209. _OFFLINE_POLICY_LOCAL_LIST = 0x00,
  210. _OFFLINE_POLICY_PHIHONG_RFID_TAG = 0x01,
  211. _OFFLINE_POLICY_FREE_CHARGING = 0x02,
  212. _OFFLINE_POLICY_NO_CHARGING = 0x03,
  213. };
  214. enum _REASSIGNED_RESOURCE_STEP
  215. {
  216. _REASSIGNED_NONE = 0, //
  217. _REASSIGNED_PREPARE_M_TO_A = 1, // 系統收到需要降載需求 (輸出總電流降低),PSU Task 收到將狀態切換至下個狀態
  218. _REASSIGNED_GET_NEW_CAP = 2, // 充電中的重新取得屬於自己火線上的總能量並透過小板通知車端 - 超過10秒直接跳下一步
  219. _REASSIGNED_ADJUST_M_TO_A = 3, // 模塊重新分配完成
  220. _REASSIGNED_RELAY_M_TO_A = 4, // 切斷橋接的 Relay
  221. _REASSIGNED_PREPARE_A_TO_M = 11,
  222. _REASSIGNED_ADJUST_A_TO_M = 12, // 模塊升壓
  223. _REASSIGNED_RELAY_A_TO_M = 13, // 搭接橋接的 Relay
  224. _REASSIGNED_WAITING = 14,
  225. _REASSIGNED_COMP = 15
  226. };
  227. enum _MAIN_CHARGING_MODE
  228. {
  229. _MAIN_CHARGING_MODE_MAX = 0,
  230. _MAIN_CHARGING_MODE_AVER = 1,
  231. };
  232. enum _EXTRA_ERR_PROCESS
  233. {
  234. _EXTRA_ERR_PROCESS_NONE = 0,
  235. _EXTRA_ERR_PROCESS_INUVP = 1,
  236. _EXTRA_ERR_PROCESS_INOVP = 2,
  237. _EXTRA_ERR_PROCESS_PRIMARY = 3,
  238. };
  239. enum _CHARGER_TYPE
  240. {
  241. _CHARGER_TYPE_IEC = 0,
  242. _CHARGER_TYPE_UL = 1,
  243. };
  244. enum _SYS_WIFI_MODE
  245. {
  246. _SYS_WIFI_MODE_DISABLE = 0,
  247. _SYS_WIFI_MODE_STATION = 1,
  248. _SYS_WIFI_MODE_AP = 2
  249. };
  250. enum _LED_INTENSITY_LV
  251. {
  252. _LED_INTENSITY_DARKEST = 0,
  253. _LED_INTENSITY_MEDIUM = 1,
  254. _LED_INTENSITY_BRIGHTEST = 2
  255. };
  256. enum _CCS_COMM_PROTOCOL
  257. {
  258. _CCS_COMM_V2GMessage_DIN70121 = 0x01,
  259. _CCS_COMM_V2GMessage_ISO15118_2014 = 0x02,
  260. _CCS_COMM_V2GMessage_ISO15118_2018 = 0x03
  261. };
  262. enum _ETHERNET_USAGE
  263. {
  264. _ETHERNET_USAGE_NONE = 0,
  265. _ETHERNET_USAGE_LAN,
  266. _ETHERNET_USAGE_WIFI,
  267. _ETHERNET_USAGE_3G_4g
  268. };
  269. #define STR_CONN_DISABLE "Disable"
  270. #define STR_CONN_CONNECTED "Connected"
  271. #define STR_CONN_DISCONNECTED "Disconnected"
  272. #define STR_DARKEST "Darkest"
  273. #define STR_MEDIUM "Medium"
  274. #define STR_BRIGHTEST "Brightest"
  275. #define STR_PAGE_NONE "PageNone"
  276. #define STR_REMOTE_NO_ID "PlugInPage"
  277. enum _CONN_STATUS
  278. {
  279. _Connnection_Disable = 0,
  280. _Connnection_Connected = 1,
  281. _Connnection_Disconnected = 2,
  282. };
  283. enum _LED_INDICATION_STATUS
  284. {
  285. _LED_INDICATION_OFF = 0, // all led off
  286. _LED_INDICATION_RUN = 1, // green led on, red led off
  287. _LED_INDICATION_FAULT = 2, // green led off, red led on
  288. _LED_INDICATION_ON = 3, // all led on
  289. _LED_INDICATION_GREEN_TOGGLE = 4, // green led toggle
  290. _LED_INDICATION_RED_TOGGLE = 5, // red led toggle
  291. };
  292. enum _STANDARD_INDICATION_STATUS
  293. {
  294. _STANDARD_LED_None = 0,
  295. _STANDARD_LED_Disconnection = 1,
  296. _STANDARD_LED_Running = 2,
  297. _STANDARD_LED_Alarm = 3,
  298. };
  299. enum _E4YOU_INDICATION_STATUS
  300. {
  301. _E4YOU_LED_None = 0,
  302. _E4YOU_LED_Disconnection = 1,
  303. _E4YOU_LED_Idle = 2,
  304. _E4YOU_LED_Charging = 3,
  305. _E4YOU_LED_Alarm = 4,
  306. };
  307. #define STR_QR_DEFAULT "Default"
  308. #define STR_QR_CUSTOMIZED "Customized"
  309. #define STR_QR_CHARGEBOXID "ChargeBoxId"
  310. enum _QR_MODE
  311. {
  312. _QR_MODE_Default = 0,
  313. _QR_MODE_Customized = 1,
  314. _QR_MODE_ChargeBoxId = 2, // for audi
  315. };
  316. enum _CUSTOMER_CODE
  317. {
  318. _CUSTOMER_CODE_Phihong = 0,
  319. _CUSTOMER_CODE_Audi = 1,
  320. _CUSTOMER_CODE_E4U = 2,
  321. _CUSTOMER_CODE_UCar = 3,
  322. _CUSTOMER_CODE_TCC = 4,
  323. _CUSTOMER_CODE_Shell = 5,
  324. };
  325. #define STR_CABINET_ROLE_NONE "Single"
  326. #define STR_CABINET_ROLE_MASTER "Master"
  327. #define STR_CABINET_ROLE_SLAVE "Slave"
  328. enum _CABINET_ROLE
  329. {
  330. _CROLE_SINGLE = 0, // single power cabinet mode
  331. _CROLE_MASTER = 1, // power cabinet master mode
  332. _CROLE_SLAVE = 2, // power cabinet slave mode
  333. };
  334. typedef union
  335. {
  336. unsigned int CtrlValue;
  337. struct
  338. {
  339. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  340. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  341. unsigned int NeedSoftReset:1; // 0: no effect, 1: system need soft reset
  342. unsigned int NeedHardReset:1; // 0: no effect, 1: system need hard reset
  343. unsigned int PrimaryDisable:1; // 0: primary enable, 1: primary disable
  344. unsigned int RelayBoardDisable:1; // 0: relay board enable, 1: relay board disable
  345. unsigned int FanBoardDisable:1; // 0: fan board enable, 1: fan board disable
  346. unsigned int LedBoardDisable:1; // 0: led board enable, 1: led board disable
  347. unsigned int SecondRelayBoardEnable:1; // 0: second relay disable, 1: second relay enable
  348. unsigned int DOLedIndication:1; // 0: no led indication, 1: enable DO Model led indication
  349. unsigned int DKLedIndication:1; // 0: no led indication, 1: enable DK Model led indication
  350. unsigned int BackendEnable:1; // 0: backend disable, 1: backend enable
  351. unsigned int Wifi4gResetEnable:1; // 0: wifi/4g reset io disable, 1: wifi/4g reset io enable
  352. unsigned int PsuInit:1; // 0: no effect, 1: psu is initialized
  353. unsigned int Enable6ParallelRelay:1; // 0: no effect, 1: enable 6 parallel relay
  354. unsigned int WriteFlashEnable:1; // 0: no effect, 1: flash content has changed
  355. unsigned int WriteFlashBusy:1; // 0: no effect, 1: flash is writing
  356. unsigned int WriteFlashImmediately:1; // 0: no effect, 1: write flash immediately
  357. unsigned int WriteFlashAndReset:1; // 0: no effect, 1: write flash and soft reset
  358. unsigned int res:13;
  359. }bits;
  360. }SystemControl;
  361. typedef union
  362. {
  363. unsigned int CtrlValue;
  364. struct
  365. {
  366. unsigned int DisableBalance:1; // 0: no effect, 1: disable announce balance
  367. unsigned int FastStandbyTime:1; // 0: no effect, 1: enable fast standby time
  368. unsigned int ChargingSimulation:1; // 0: no effect, 1: enable charging simulation
  369. unsigned int FChargingReleaseExtend:1; // 0: no effect, 1: enable Release and Extend when Force Charging
  370. unsigned int res:28;
  371. }bits;
  372. }TestControl;
  373. typedef union
  374. {
  375. unsigned int CtrlValue;
  376. struct
  377. {
  378. unsigned int MsgMain:1; // 0: no effect, 1: enable debug message in main
  379. unsigned int MsgPrimaryComm:1; // 0: no effect, 1: enable debug message in primary comm
  380. unsigned int MsgPsu:1; // 0: no effect, 1: enable debug message in psu
  381. unsigned int MsgEvComm:1; // 0: no effect, 1: enable debug message in ev comm
  382. unsigned int MsgInternalComm:1; // 0: no effect, 1: enable debug message in internal comm
  383. unsigned int res:27;
  384. }bits;
  385. }DebugControl;
  386. #define MAX_EVCOMM_DEBUG_LEN 4
  387. typedef union
  388. {
  389. unsigned int DebugVal[MAX_EVCOMM_DEBUG_LEN];
  390. struct
  391. {
  392. // DebugVal[0]
  393. unsigned int RegDbg_All:1;
  394. unsigned int RegDbg_ModelName:1;
  395. unsigned int RegDbg_ConnectorID:1;
  396. unsigned int RegDbg_PowerCabinetStatus:1;
  397. unsigned int RegDbg_DispenserStatus:1;
  398. unsigned int RegDbg_ChargingCapability:1;
  399. unsigned int RegDbg_ChargingTarget:1;
  400. unsigned int RegDbg_SoftwareUpdate:1;
  401. unsigned int RegDbg_PlugInStatus:1;
  402. unsigned int RegDbg_ConnectorState:1;
  403. unsigned int RegDbg_UserID:1;
  404. unsigned int RegDbg_Charging_Permission:1;
  405. unsigned int RegDbg_MiscControl:1;
  406. unsigned int RegDbg_DispenserCsuVersion:1;
  407. unsigned int RegDbg_DispenserOtherVersion:1;
  408. unsigned int RegDbg_ChargingInfo:1;
  409. unsigned int RegDbg_QRCodeDate:1;
  410. unsigned int RegDbg_WaitPlugIn:1;
  411. unsigned int RegDbg_GroundFaultDetection:1;
  412. unsigned int RegDbg_Cabinet_CSU_Version:1;
  413. unsigned int RegDbg_Cabinet_Other_Version:1;
  414. unsigned int RegDbg_PsuQuantity:1;
  415. unsigned int RegDbg_PsuVersion:1;
  416. unsigned int RegDbg_Reservation:1;
  417. unsigned int RegDbg_Dispenser_Request:1;
  418. unsigned int RegDbg_RemoteStartNoIDState:1;
  419. unsigned int RegDbg_RefundAmount:1;
  420. unsigned int RegDbg_PrepaymentInfo:1;
  421. unsigned int RegDbg_PaymentFailReason:1;
  422. unsigned int RegDbg_ConnectorQRCode:1;
  423. unsigned int RegDbg_StationInfo:1;
  424. unsigned int RegDbg_DeductResult:1;
  425. // DebugVal[1]
  426. unsigned int RegDbg_CabinetSystemID:1;
  427. unsigned int RegDbg_DefaultPriceString:1;
  428. unsigned int RegDbg_UserPriceString:1;
  429. unsigned int RegDbg_Receipt:1;
  430. unsigned int RegDbg_PowerConsumption:1;
  431. unsigned int RegDbg_ChargingTimestamp:1;
  432. unsigned int res:26;
  433. // DebugVal[2]
  434. unsigned int DebugVal2:32;
  435. // DebugVal[3]
  436. unsigned int DebugVal3:32;
  437. }bits;
  438. }DebugEvCommMsgFlag;
  439. typedef union
  440. {
  441. unsigned int DebugVal;
  442. struct
  443. {
  444. // DebugVal[0]
  445. unsigned int MsgId_None:1;
  446. unsigned int MsgId_Gun_1:1;
  447. unsigned int MsgId_Gun_2:1;
  448. unsigned int MsgId_Gun_3:1;
  449. unsigned int MsgId_Gun_4:1;
  450. unsigned int MsgId_Gun_5:1;
  451. unsigned int MsgId_Gun_6:1;
  452. unsigned int MsgId_Gun_7:1;
  453. unsigned int MsgId_Gun_8:1;
  454. unsigned int res:23;
  455. }bits;
  456. }DebugEvCommIdFlag;
  457. typedef struct
  458. {
  459. DebugEvCommMsgFlag MsgFlag;
  460. DebugEvCommIdFlag IdFlag;
  461. }EvCommCtrlInfo;
  462. typedef union
  463. {
  464. unsigned int CtrlValue;
  465. struct
  466. {
  467. unsigned int EnableForceCharging:1; // 0: disable, 1: enable force charging
  468. unsigned int StartForceCharging:1; // 0: disable, 1: start force charging
  469. unsigned int EnableReleaseAndExtend:1; // 0: disable, 1: enable Release And Extend when force charging
  470. unsigned int WebApiTrigger:1; // 0: no effect, 1: force charging is triggered by web api
  471. unsigned int res:28;
  472. }bits;
  473. }ForceChargingControl;
  474. typedef struct
  475. {
  476. ForceChargingControl FCtrl;
  477. unsigned short FTargetVoltage; // target voltage, unit: 0.1V
  478. unsigned short FTargetCurrent; // target current, unit: 0.1A
  479. }ForceCharging;
  480. typedef union
  481. {
  482. unsigned int AuthFlag;
  483. struct
  484. {
  485. unsigned int APPEnable:1; // 0: disable, 1: app auth enable
  486. unsigned int QRCodeEnable:1; // 0: disable, 1: qr code auth enable
  487. unsigned int RFIDEnable:1; // 0: disable, 1: rfid auth enable
  488. unsigned int res:29;
  489. }bits;
  490. }AuthModeInfo;
  491. typedef struct
  492. {
  493. AuthModeInfo AuthMode;
  494. unsigned char QRCodeMode; // 0: default, 1: customized, 2: audi type
  495. unsigned char res[3];
  496. }SystemAuthInfoData;
  497. typedef union
  498. {
  499. unsigned int CtrlValue;
  500. struct
  501. {
  502. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  503. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  504. unsigned int Paused:1; // 0: no effect, 1: primary paused
  505. unsigned int DisableDoorSensor:1; // 0: door sensor enable, 1: door sensor disable
  506. unsigned int DisableEmergencyButton:1; // 0: emergency button enable, 1: emergency button disable
  507. unsigned int DoorSensorReverse:1; // 0: the same as ds's, 1: status is different from ds's
  508. unsigned int AcContactorReverse:1; // 0: the same as ds's, 1: status is different from ds's
  509. unsigned int CabinetSwitchDetect:1; // 0: no effect, 1: need detect cabinet switch
  510. unsigned int res:24;
  511. }bits;
  512. }PrimaryControl;
  513. typedef union
  514. {
  515. unsigned int CtrlValue;
  516. struct
  517. {
  518. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  519. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  520. unsigned int Paused:1; // 0: no effect, 1: relay paused
  521. unsigned int AbnormalRelay:1; // 0: no effect, 1: relay abnormal control enable
  522. unsigned int AcContactor:1; // 0: ac contactor off, 1: ac contactor on
  523. unsigned int AcContactorOffByPsu:1; // 0: no effect, 1: ac contactor off
  524. unsigned int AcContactorOffByEmergency:1; // 0: no effect, 1: ac contactor off
  525. unsigned int StandbyCountdown:1; // 0: charger is using, 1: start countdown
  526. unsigned int AcInputDisable:1; // 0: ac input enable, 1: ac input disable
  527. unsigned int DcInputEnable:1; // 0: dc input disable, 1: dc input enable
  528. unsigned int AutoTest:1; // 0: no effect, 1: relay auto test enable
  529. unsigned int res:21;
  530. }bits;
  531. }RelayControl;
  532. typedef union
  533. {
  534. unsigned int CtrlValue;
  535. struct
  536. {
  537. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  538. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  539. unsigned int Paused:1; // 0: no effect, 1: fan paused
  540. unsigned int AbnormalFan:1; // 0: no effect, 1: fan abnormal control enable
  541. unsigned int res:28;
  542. }bits;
  543. }FanControl;
  544. typedef union
  545. {
  546. unsigned int CtrlValue;
  547. struct
  548. {
  549. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  550. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  551. unsigned int Paused:1; // 0: no effect, 1: led paused
  552. unsigned int res:29;
  553. }bits;
  554. }LedFanControl;
  555. typedef union
  556. {
  557. unsigned int CtrlValue;
  558. struct
  559. {
  560. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  561. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  562. unsigned int Paused:1; // 0: no effect, 1: psu paused
  563. unsigned int FailureResume:1; // 0: no error, 1: psu failure, need resume
  564. unsigned int CommunicationLost:1; // 0: no error, 1: psu communication lost
  565. unsigned int res:27;
  566. }bits;
  567. }PsuControl;
  568. enum _OCPP_PAGE_INDEX
  569. {
  570. _OCPP_Page_None = 0, // page none
  571. _OCPP_Page_LineStatus_1 = 1, // line status 1 page
  572. _OCPP_Page_LineStatus_2 = 2, // line status 2 page
  573. _OCPP_Page_LineStatus_3 = 3, // line status 3 page
  574. _OCPP_Page_LineStatus_4 = 4, // line status 4 page
  575. };
  576. typedef union
  577. {
  578. unsigned int CtrlValue;
  579. struct
  580. {
  581. unsigned int RemoteStartNoId:1; // 0: no effect, 1: trigger remote start without connector id
  582. unsigned int res:31;
  583. }bits;
  584. }OcppControl;
  585. typedef struct
  586. {
  587. int TxCnt;
  588. int RxCnt;
  589. int LostCnt;
  590. int CommCnt;
  591. }DevideCommInfo;
  592. typedef struct
  593. {
  594. DevideCommInfo PrimaryComm;
  595. DevideCommInfo Relay1Comm;
  596. DevideCommInfo Relay2Comm;
  597. DevideCommInfo FanComm;
  598. DevideCommInfo LedComm;
  599. DevideCommInfo PsuComm;
  600. }CommInfoData;
  601. typedef union
  602. {
  603. unsigned int CtrlValue;
  604. struct
  605. {
  606. unsigned int UpdateReq:1; // 0: no effect, 1: update request
  607. unsigned int UpdateConfirm:1; // 0: no effect, 1: update confirm
  608. unsigned int UpdateDone:1; // 0: no effect, 1: update done
  609. unsigned int res:29;
  610. }bits;
  611. }UpdateControl;
  612. typedef struct
  613. {
  614. int Pri232Fd;
  615. int Rs422Fd;
  616. int PsuCanFd;
  617. int EvCanFd;
  618. }FdControl;
  619. typedef struct
  620. {
  621. unsigned char MaxDispenser;
  622. unsigned char MaxConnector;
  623. unsigned char CabinetSwitch;
  624. unsigned char CabinetRole;
  625. unsigned char SelfTestStep;
  626. unsigned char CustomerCode;
  627. unsigned short ChargerRatingPower; // unit: 0.1kw, charger rating power, parsing from model name
  628. CommInfoData CommInfo;
  629. SystemControl SysCtrl;
  630. UpdateControl UpdateCtrl;
  631. TestControl TestCtrl;
  632. DebugControl DebugCtrl;
  633. EvCommCtrlInfo EvCommCtrl;
  634. PrimaryControl PrimaryCtrl;
  635. RelayControl RelayCtrl;
  636. FanControl FanCtrl;
  637. LedFanControl LedCtrl;
  638. PsuControl PsuCtrl;
  639. OcppControl OcppCtrl;
  640. FdControl FdCtrl;
  641. ForceCharging FCharging[MAX_GROUP_QUANTITY];
  642. unsigned char GunAvailable[MAX_GROUP_QUANTITY];
  643. unsigned char PsuInitQuantity[MAX_GROUP_QUANTITY];
  644. char ResevedIdTag[MAX_GROUP_QUANTITY][32];
  645. }SysControl;
  646. // ************************************************************************************************* //
  647. typedef struct
  648. {
  649. bool CheckIn;
  650. unsigned char Address;
  651. unsigned char GroupNo;
  652. unsigned char GIndex;
  653. }PsuAddressInfoData;
  654. typedef struct
  655. {
  656. unsigned char GroupPsuQuantity;
  657. unsigned char res;
  658. unsigned char PsuSN[MAX_MODULE_PER_GROUP];
  659. }GroupInfoData;
  660. typedef struct
  661. {
  662. bool PsuLocationInit;
  663. bool ReInitPsuLocation;
  664. unsigned char TotalPsuQuantity;
  665. GroupInfoData GroupLocationInfo[MAX_GROUP_QUANTITY];
  666. PsuAddressInfoData PsuAddressInfo[MAX_PSU_MODULE_QUANTITY];
  667. }PsuPositionInfoData;
  668. // ************************************************************************************************* //
  669. typedef enum
  670. {
  671. _GROLE_IDLE = 0,
  672. _GROLE_MASTER = 1,
  673. _GROLE_SLAVE = 2,
  674. _GROLE_PREPARE_SWITCH_OFF = 10, // reduce output current capability
  675. _GROLE_SLAVE_POWER_OFF = 11, // power off
  676. _GROLE_SWITCH_OFF_OK = 12, // power off completed
  677. _GROLE_WAIT_IDLE = 13, // wait a while to change to idle, open parallel relay at this state
  678. _GROLE_WAIT_SLAVE = 14, // wait a while to change to slave
  679. _GROLE_PREPARE_ATTACH_ON = 20, // raise voltage to master output voltage
  680. _GROLE_PRECHARGE_READY = 21, // extend pre-charge ready
  681. _GROLE_EXTEND_STOP = 22, // extend capability stop
  682. _GROLE_REQUEST_TO_CHARGING = 30,
  683. _GROLE_TERMINATE = 40,
  684. _GROLE_WAIT_TERMINATED = 41,
  685. _GROLE_NONE = 99,
  686. }_GROUP_ROLE;
  687. typedef union
  688. {
  689. unsigned int CtrlValue[6];
  690. struct
  691. {
  692. unsigned int IdleCtrlValue;
  693. unsigned int MasterCtrlValue;
  694. unsigned int StopChargingCtrlValue;
  695. unsigned int DeratingCtrlValue;
  696. unsigned int ExtendCapabilityCtrlValue;
  697. unsigned int SlaveCtrlValue;
  698. }RoleCtrl;
  699. struct
  700. {
  701. // IdleCtrlValue
  702. unsigned int ChargingRequest:1; // 0: no effect, 1: charging request from main.c
  703. unsigned int ChargingRequestConfirmed:1; // 0: no effect, 1: request confirmed by psu task
  704. unsigned int GroupShareCheck:1; // 0: no effect, 1: check is there any psu can share
  705. unsigned int ShareConfirmed:1; // 0: no effect, 1: psu share confirmed
  706. unsigned int GrabGroupWait:1; // 0: no effect, 1: need to wait grab psu
  707. unsigned int ShareCheckDone:1; // 0: no effect, 1: psu share completed
  708. unsigned int FindGroupPartner:1; // 0: no effect, 1: find available group partner
  709. unsigned int ParallelRelayOn:1; // 0: no effect, 1: set parallel relay on
  710. unsigned int ParallelRelayConfirmed:1; // 0: no effect, 1: parallel relay confirmed
  711. unsigned int GroupingDone:1; // 0: no effect, 1: grouping completed
  712. unsigned int IdleCtrlRes:22;
  713. // MasterCtrlValue
  714. unsigned int CableCheckDone:1; // 0: no effect, 1: CableCheck done
  715. unsigned int InPrechargeMode:1; // 0: no effect, 1: system status in PreCharge mode
  716. unsigned int AlreadyInChargingMode:1; // 0: no effect, 1: system status ever enter charging mode
  717. unsigned int ExtendAvailable:1; // 0: no effect, 1: extend capability is available
  718. unsigned int NeedCurrentBalance:1; // 0: no effect, 1: need to current balance
  719. unsigned int OutputCurrentStable:1; // 0: no effect, 1: output current is stable
  720. unsigned int ReachMaxCurrentDemand:1; // 0: no effect, 1: reach ev max current demand
  721. unsigned int ReachMaxStageCurrent:1; // 0: no effect, 1: reach ev max stage current
  722. unsigned int SmoothDerating:1; // 0: no effect, 1: start smooth derating
  723. unsigned int MasterCtrlRes:23;
  724. // StopChargingCtrlValue
  725. unsigned int StopChargingRequest:1; // 0: no effect, 1: master need to stop
  726. unsigned int StopChargingConfirmed:1; // 0: no effect, 1: stop charging confirmed
  727. unsigned int AllPowerOffDone:1; // 0: no effect, 1: all member power off done
  728. unsigned int AllParallelRelayOff:1; // 0: no effect, 1: all member's parallel relay off
  729. unsigned int AllParallelRelayConfirmed:1; // 0: no effect, 1: all member's parallel relay off confirmed
  730. unsigned int AllMemberStopCompleted:1; // 0: no effect, 1: all member stop completed
  731. unsigned int StopChargingCompleted:1; // 0: no effect, 1: stop charging completed
  732. unsigned int StopChargingCtrlRes:25;
  733. // DeratingCtrlValue
  734. unsigned int NeedDerating:1; // 0: no effect, 1: need derating
  735. unsigned int DeratingConfirmed:1; // 0: no effect, 1: derating confirmed
  736. unsigned int DeratingStart:1; // 0: no effect, 1: derating start
  737. unsigned int DeratingPowerOffDone:1; // 0: no effect, 1: derating member power off done
  738. unsigned int DeratingRelayOff:1; // 0: no effect, 1: set derating member parallel relay off
  739. unsigned int DeratingRelayConfirmed:1; // 0: no effect, 1: derating member parallel relay confirmed
  740. unsigned int DeratingCompleted:1; // 0: no effect, 1: derating completed
  741. unsigned int DeratingCtrlRes:25;
  742. // ExtendCapabilityCtrlValue
  743. unsigned int MorePowerRequest:1; // 0: no effect, 1: need to request more psu
  744. unsigned int MorePowerConfirmed:1; // 0: no effect, 1: request more psu confirmed
  745. unsigned int ExtendPrecharge:1; // 0: no effect, 1: extend group need to pre-charge
  746. unsigned int ExtendPrechargeDone:1; // 0: no effect, 1: extend group pre-charge completed
  747. unsigned int ExtendRelayOn:1; // 0: no effect, 1: extend group parallel relay on
  748. unsigned int ExtendRelayConfirmed:1; // 0: no effect, 1: extend group parallel relay confirmed
  749. unsigned int ExtendCompleted:1; // 0: no effect, 1: extend capability completed
  750. unsigned int ExtendCapabilityCtrlRes:25;
  751. // SlaveCtrlValue
  752. unsigned int SlaveChargingRequest:1; // 0: no effect, 1: request slave to charging after power off
  753. unsigned int CheckSlaveReady:1; // 0: no effect, 1: check if slave is ready
  754. unsigned int WaitSlaveReady:1; // 0: no effect, 1: wait slave is ready
  755. unsigned int SlavePowerOffRequest:1; // 0: no effect, 1: request slave to power off
  756. unsigned int SlavePowerOffConfirmed:1; // 0: no effect, 1: slave power off confirmed
  757. unsigned int SlaveCtrlRes:27;
  758. }bits;
  759. }PsuGroupControl;
  760. typedef struct
  761. {
  762. unsigned char Quantity;
  763. unsigned char RealQuantity;
  764. unsigned char Member[MAX_GROUP_QUANTITY]; // record slave group index
  765. unsigned short ParallelFlag[MAX_GROUP_QUANTITY];
  766. }PsuGroupPartner;
  767. typedef struct
  768. {
  769. unsigned short Voltage; // output voltage limit, unit: 0.1V
  770. unsigned short Current; // output current limit, unit: 0.1A
  771. unsigned short Power; // output power limit, unit: 0.1kw
  772. }PsuGroupOutputValue;
  773. typedef struct
  774. {
  775. unsigned char Index;
  776. unsigned char Role;
  777. unsigned char PreRole;
  778. unsigned char Location;
  779. PsuGroupPartner Partner; // record slave group information
  780. PsuGroupPartner PossibleMember; // record possible slave group information
  781. unsigned char TargetGroup; // target group index + 1
  782. unsigned char ReservedTarget; // reserved target group index + 1
  783. unsigned char SmoothDeratingTarget; // group index + 1
  784. unsigned char res; // reserved
  785. PsuGroupControl GroupCtrl;
  786. unsigned short ReAssignAvailableCurrent; // group available current when reassign, unit: 0.1A
  787. unsigned short ParallelCheck;
  788. unsigned char ParallelConfig[MAX_GROUP_QUANTITY]; // group parallel relay setting
  789. unsigned short GunLoading; // gun output loading, unit: 0.01%
  790. unsigned char GunPsuQuantity; // record psu quantity at this gun
  791. unsigned char ExtendQuantityLimit; // limit of extend psu group quantity
  792. float DiffPower_Capability; // unit: 1kW, different power between output power and Capability power
  793. float DiffPower_Available; // unit: 1kW, different power between output power and Available power
  794. float DiffPower_PhysicalLimit; // unit: 1kW, different power between output power and PhysicalLimit power
  795. }PsuGroupCollectionData;
  796. typedef struct
  797. {
  798. unsigned short GTargetVoltage; // group target voltage config, unit: 0.1V
  799. unsigned short GTargetCurrent; // group target current config, unit: 0.1A
  800. unsigned short OutputLoading; // group output loading, unit: 0.01%
  801. }GroupOutputConfigInfo;
  802. typedef union
  803. {
  804. unsigned short CtrlValue;
  805. struct
  806. {
  807. unsigned short Output_N:1; // 0: set Output_N off, 1: set Output_N on
  808. unsigned short Output_P:1; // 0: set Output_P off, 1: set Output_P on
  809. unsigned short res:14;
  810. }bits;
  811. }PsuGroupOutputRelay;
  812. typedef union
  813. {
  814. unsigned short CtrlValue;
  815. struct
  816. {
  817. unsigned short Location_1_2:1; // 0: set parallel off, 1: set parallel on
  818. unsigned short Location_2_3:1; // 0: set parallel off, 1: set parallel on
  819. unsigned short Location_3_4:1; // 0: set parallel off, 1: set parallel on
  820. unsigned short Location_4_1:1; // 0: set parallel off, 1: set parallel on
  821. unsigned short Location_4_2:1; // 0: set parallel off, 1: set parallel on
  822. unsigned short Location_3_1:1; // 0: set parallel off, 1: set parallel on
  823. unsigned short res:10;
  824. }bits;
  825. }PsuGroupParallelRelay;
  826. typedef struct
  827. {
  828. byte Location[MAX_GROUP_QUANTITY];
  829. byte Layout[MAX_GROUP_QUANTITY];
  830. PsuGroupCollectionData GroupCollection[MAX_GROUP_QUANTITY];
  831. GroupOutputConfigInfo GroupOutput[MAX_GROUP_QUANTITY]; // for individual group command
  832. GroupOutputConfigInfo TotalGroupOutput[MAX_GROUP_QUANTITY]; // for total group command
  833. PsuGroupOutputRelay OutputRelayConfig[MAX_GROUP_QUANTITY];
  834. PsuGroupOutputRelay OutputRelayConfirmed[MAX_GROUP_QUANTITY];
  835. PsuGroupParallelRelay ParallelRelayConfig;
  836. PsuGroupParallelRelay ParallelRelayConfirmed;
  837. }PsuGroupingInfoData;
  838. // ************************************************************************************************* //
  839. typedef enum
  840. {
  841. _SCONN_FREE = 0,
  842. _SCONN_WAIT = 1,
  843. _SCONN_MATCHED = 2,
  844. }_SOCKET_CONN_STATUS;
  845. typedef enum
  846. {
  847. _DeviceStatus_DisConnect = 0x00, // _DS_None , slave cabinet in re-connection
  848. _DeviceStatus_Identification = 0x01, // _DS_Identification , slave cabinet in identification
  849. _DeviceStatus_Idle = 0x02, // _DS_Idle , slave cabinet in idle
  850. _DeviceStatus_Alarm = 0x03, // _DS_Alarm , slave cabinet in alarm
  851. _DeviceStatus_Charging = 0x04, // _DS_Charging , no use in slave cabinet
  852. _DeviceStatus_Timeout = 0x05, // _DS_Timeout , no use in slave cabinet
  853. _DeviceStatus_RetryWait = 0x06,
  854. }_DEVICE_STATUS;
  855. typedef enum
  856. {
  857. _Parallel_None = 0,
  858. _Parallel_Wait = 1, // ac contactor off, 3s
  859. _Parallel_Working = 2, // ac contactor on and start re-initial psu
  860. _Parallel_Done = 3, // re-initial psu done
  861. }_PARALLEL_STATUS;
  862. typedef struct
  863. {
  864. unsigned char Status; // 0: free, 1: WaitModelName, 2: DispenserMatched
  865. unsigned char DeviceIndex; // record device index
  866. unsigned int IpAddress; // record device ip address
  867. unsigned char DuplicateIp; // 0: unique ip, 1: duplicate ip
  868. unsigned char res;
  869. }SocketConnInfoData;
  870. typedef struct
  871. {
  872. unsigned char LocalStatus; // 0: None, 1: Identification, 2: Idle, 3: Alarm, 4: Charging, 5: _DS_Timeout
  873. unsigned char SlaveID;
  874. unsigned char ModelName[64]; //charger model name
  875. unsigned char SerialNumber[64]; //charger system serial number
  876. unsigned char SystemId[128]; //charger system ID
  877. unsigned char CsuBootLoadFwRev[32]; //CSU board bootloader firmware version
  878. unsigned char CsuKernelFwRev[32]; //CSU board OS kernel firmware version
  879. unsigned char CsuRootFsFwRev[32]; //CSU board root file system firmware version
  880. unsigned char CsuPrimFwRev[32]; //CSU board root file system firmware version
  881. unsigned char LcmFwRev[32]; //LCM module firmware version
  882. unsigned char PsuPrimFwRev[32]; //PSU primary firmware version
  883. unsigned char PsuSecFwRev[32]; //PSU secondary firmware version
  884. unsigned char FanModuleFwRev[32]; //Fan module firmware version
  885. unsigned char RelayModuleFwRev[32]; //Relay control module firmware version
  886. unsigned char TelcomModemFwRev[32]; //the 3G/4G modem firmware version
  887. unsigned char LedModuleFwRev[32]; //LED control module firmware version
  888. unsigned char Connector1FwRev[32]; //Connector1 module firmware version
  889. unsigned char Connector2FwRev[32]; //Connector2 module firmware version
  890. unsigned char AcContactorSetting; // 0: OFF, 1: ON Master -> Slave
  891. unsigned char AcContactorState; // 0: OFF, 1: ON Slave -> Master
  892. unsigned char OutputRelaySetting[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Master -> Slave
  893. unsigned char GunOutputRelayState[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Slave -> Master
  894. unsigned char ParallelRelaySetting[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Master -> Slave
  895. unsigned char ParallelRelayState[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Slave -> Master
  896. unsigned char UpdateRequest; // 0: no effect, 1: need to update
  897. unsigned char res;
  898. char FwFileName[128];
  899. unsigned char SocketChannel; // record socket index
  900. unsigned char IpDuplicatedFlag; // 0: no effect, 1: ip is duplicated
  901. unsigned char ParallelRequest; // 0: no effect, 1: parallel request
  902. unsigned char ParallelConfirm; // 0: no effect, 1: parallel confirm
  903. unsigned short ParallelPower; // parallel power, unit: 0.1kw
  904. }SlaveCabinetInfoData;
  905. typedef struct
  906. {
  907. unsigned char ParallelStatus; // 0: parallel none, 1: wait, 2: in paralleling, 3: parallel done
  908. unsigned char ParallelCabinetQuantity; // record max dispenser quantity
  909. unsigned char PresentParallelCabinetQuantity; // present slave cabinet quantity
  910. unsigned char res;
  911. SlaveCabinetInfoData PCabinet[MAX_SLAVE_CABINET_QUANTITY];
  912. unsigned char PCUpdateState[MAX_SLAVE_CABINET_QUANTITY]; // 0: Not in Update, 1: Updating, 2: Updated
  913. unsigned short TotalParallelPower; // max total parallel power, unit: 0.1kw
  914. }ParallelCabinetInfoData;
  915. typedef struct
  916. {
  917. unsigned char SCabinetStatus;
  918. unsigned char SCabinetID;
  919. unsigned char SOutputRelay[MAX_GROUP_QUANTITY]; // parallel cabinet output relay state
  920. unsigned char SParallelRelay[MAX_GROUP_QUANTITY]; // parallel cabinet parallel relay state
  921. unsigned char SAcContactor; // slave cabinet ac contactor state
  922. unsigned char NeedUpgrade; // 1: Need Upgrade, 2: No Update
  923. unsigned char UpgradeState; // 0: Not in Update, 1: Updating, 2: Updated
  924. unsigned char res;
  925. char FwFileName[128];
  926. }SlaveCabinetControl;
  927. // ************************************************************************************************* //
  928. #define LCM_REQ_REMOTE_START_NO_ID 0x00000001
  929. typedef union
  930. {
  931. unsigned int CtrlValue;
  932. struct
  933. {
  934. // cabinet -> connector
  935. unsigned int RemoteStartNoID:1; // 0: no request, 1: lcm page change to RemoteStartNoID
  936. unsigned int res:31;
  937. }bits;
  938. }ConnectorPageControl;
  939. #define MISC_DISP_CONNECTION_TIMEOUT 0x00000001
  940. #define MISC_DISP_DEFAULT_PRICE 0x00000002
  941. #define MISC_DISP_CURRENCY 0x00000004
  942. #define MISC_DISP_BACKEND_STATUS 0x00000008
  943. #define MISC_DISP_ETHERNET_STATUS 0x00000010
  944. #define MISC_DISP_WIFI_STATUS 0x00000020
  945. #define MISC_DISP_TELCOM_MODEM_STATUS 0x00000040
  946. #define MISC_DISP_BILLING_STATUS 0x00000080
  947. #define MISC_DISP_STOP_BUTTON_STATUS 0x00000100
  948. #define MISC_DISP_AUTH_MODE_CONFIG 0x00000200
  949. #define MISC_DISP_EVCCID_CONFIG 0x00000400
  950. #define MISC_DISP_LED_INTENSITY 0x00000800
  951. #define MISC_DISP_HARDWARE_REBOOT 0x00001000
  952. #define MISC_DISP_SOFTWARE_RESET 0x00002000
  953. #define MISC_DISP_CHANGE_LCM_INFO 0x00004000
  954. #define MISC_DISP_STATION_INFO 0x00008000
  955. #define MISC_DISP_TIME_OFFSET 0x00010000
  956. #define MISC_DISP_DEFAULT_PRICE_STRING 0x00020000
  957. typedef union
  958. {
  959. unsigned int CtrlValue;
  960. struct
  961. {
  962. // cabinet -> dispenser
  963. unsigned int ConnectionTimeout:1; // msic: 0x0001, 0: no request, 1: connection timeout request
  964. unsigned int DefaultPrice:1; // msic: 0x0003, 0: no request, 1: default price request
  965. unsigned int Currency:1; // msic: 0x0004, 0: no request, 1: currency request
  966. unsigned int BackendStatus:1; // msic: 0x0006, 0: no request, 1: backend status request
  967. unsigned int EthernetStatus:1; // msic: 0x0007, 0: no request, 1: ethernet status request
  968. unsigned int WiFiStatus:1; // msic: 0x0008, 0: no request, 1: wifi status request
  969. unsigned int TelcomModemStatus:1; // msic: 0x0009, 0: no request, 1: telcom modem status request
  970. unsigned int BillingStatus:1; // msic: 0x000A, 0: no request, 1: billing status request
  971. unsigned int StopButtonStatus:1; // msic: 0x000B, 0: no request, 1: stop button status request
  972. unsigned int AuthModeConfig:1; // msic: 0x000C, 0: no request, 1: auth mode config request
  973. unsigned int EVCCIDConfig:1; // msic: 0x000D, 0: no request, 1: EVCCID config request
  974. unsigned int LEDIntensity:1; // msic: 0x000E, 0: no request, 1: led intensity request
  975. unsigned int HardwareReboot:1; // msic: 0x0101, 0: no request, 1: hardware reboot request
  976. unsigned int SoftwareReset:1; // msic: 0x0102, 0: no request, 1: software reset request
  977. unsigned int ChangeLcmInfo:1; // msic: 0x0107, 0: no request, 1: change lcm info request
  978. unsigned int ChargerStationInfo:1; // msic: 0x0109, 0: no request, 1: charger station info request
  979. unsigned int TimeOffset:1; // msic: 0x0010, 0: no request, 1: time offset request
  980. unsigned int DefaultPriceString:1; // msic: 0x0010, 0: no request, 1: time offset request
  981. unsigned int res:14;
  982. }bits;
  983. }DispenserMiscControl;
  984. #define MISC_CONN_AVAILABILITY 0x00000001
  985. #define MISC_CONN_ACCOUNT_BALANCE 0x00000002
  986. #define MISC_CONN_REMOTE_START 0x00000004
  987. #define MISC_CONN_REMOTE_STOP 0x00000008
  988. #define MISC_CONN_UNLOCK 0x00000010
  989. #define MISC_CONN_RESERVATION 0x00000020
  990. #define MISC_CONN_QRCODE_INFO 0x00000040
  991. #define MISC_CONN_FINAL_COST 0x00000080
  992. #define MISC_CONN_LINE_STATUS 0x00000100
  993. #define MISC_CONN_USER_PRICE_STRING 0x00000200
  994. #define MISC_CONN_RECEIPT 0x00000400
  995. #define MISC_CONN_CHARGING_BILL 0x00000800
  996. typedef union
  997. {
  998. unsigned int CtrlValue;
  999. struct
  1000. {
  1001. // cabinet -> connector
  1002. unsigned int Availability:1; // msic: 0x0002, 0: no request, 1: availability request
  1003. unsigned int AccountBalance:1; // msic: 0x0005, 0: no request, 1: account balance request
  1004. unsigned int RemoteStart:1; // msic: 0x0103, 0: no request, 1: remote start request
  1005. unsigned int RemoteStop:1; // msic: 0x0104, 0: no request, 1: remote stop request
  1006. unsigned int Unlock:1; // msic: 0x0105, 0: no request, 1: unlock request
  1007. unsigned int Reservation:1; // msic: 0x0106, 0: no request, 1: reservation request
  1008. unsigned int QRCodeRequest:1; // msic: 0x0108, 0: no request, 1: QR Code request
  1009. unsigned int FinalCostRequest:1; // msic: 0x010A, 0: no request, 1: Final Cost request
  1010. unsigned int LineStatusRequest:1; // msic: 0x010B, 0: no request, 1: Line Status request
  1011. unsigned int UserPriceStringRequest:1; // msic: 0x010D, 0: no request, 1: User Price String request
  1012. unsigned int ReceiptRequest:1; // msic: 0x010E, 0: no request, 1: Receipt request
  1013. unsigned int ChargingBillRequest:1; // msic: 0x010F, 0: no request, 1: charging bill request
  1014. unsigned int res:20;
  1015. }bits;
  1016. }ConnectorMiscControl;
  1017. typedef struct
  1018. {
  1019. unsigned int ConnectionTimeout; // unit: 1s
  1020. float DefaultPrice; // unit: 1 (dollar/kWh)
  1021. unsigned int Currency; // currency index
  1022. unsigned int BackendStatus; // 0: disable, 1: connected, 2: disconnected
  1023. unsigned int EthernetStatus; // 0: disable, 1: connected, 2: disconnected
  1024. unsigned int WiFiStatus; // 0: disable, 1: connected, 2: disconnected
  1025. unsigned int TelcomModemStatus; // 0: disable, 1: connected, 2: disconnected
  1026. unsigned int BillingStatus; // 0: disable, 1: enable
  1027. unsigned int StopChargingButton; // 0: disable, 1: enable
  1028. unsigned int HardwareReboot; // 1: HardwareReboot, Other value: no effect
  1029. unsigned int SoftwareRestart; // 1: SoftwareRestart, Other value: no effect
  1030. unsigned int AuthModeConfig; // 0: enable, 1: disable
  1031. unsigned int EVCCIDConfig; // 0: disable, 1: enable
  1032. unsigned int LEDIntensity; // LED intensity, 0: Darkest 1: Medium 2: Brightest
  1033. int TimeOffset; // time offset value, unit: 1 minute
  1034. }MiscCommandValue;
  1035. typedef union
  1036. {
  1037. unsigned int CtrlValue;
  1038. struct
  1039. {
  1040. // dispenser -> cabinet
  1041. unsigned int ChargingCancel:1; // cmd: 0x0001, 0: no request, 1: charging cancel request
  1042. unsigned int res:31;
  1043. }bits;
  1044. }ConnectorActionFlag;
  1045. typedef union
  1046. {
  1047. unsigned int CtrlValue[32];
  1048. struct
  1049. {
  1050. // dispenser -> cabinet
  1051. unsigned int Refund; // 1: request, other: no effect
  1052. unsigned int RefundCancel; // 1: cancel, other: no effect
  1053. unsigned int InvoiceIndex; // invoice index, start from 1 ~
  1054. unsigned int Res[29];
  1055. }bits;
  1056. }ConnectorActionValue;
  1057. typedef struct
  1058. {
  1059. unsigned char ConnectorId; // Connector Id
  1060. unsigned char DeductReq; // 0: no request, 1: deduct request
  1061. unsigned char ReaderStatusReq; // 0: no request, 1: reader status request
  1062. int TransactionId;
  1063. unsigned char creditNo[20];
  1064. unsigned char DeductResult; // DeductResult, 0: Fail, 1: Pass
  1065. unsigned char IsDonateInvoice; // IsDonateInvoice, 0: Do not donate, 1: Donate
  1066. int DeductAmount; // DeductAmount, unit = 0.01 dollar
  1067. char ApprovalNumber[9]; // ApprovalNumber
  1068. char VemData[64]; // Vem Data
  1069. }DeductResultInfoData;
  1070. typedef struct
  1071. {
  1072. ConnectorActionFlag Flag;
  1073. ConnectorActionValue ActionValue;
  1074. }ConnectorActionRequest;
  1075. #define STR_WEATHER_NONE "None"
  1076. #define STR_WEATHER_SUNNY "Sunny"
  1077. #define STR_WEATHER_CLOUDY "Cloudy"
  1078. #define STR_WEATHER_RAIN "Rain"
  1079. #define STR_WEATHER_THUNDERSTORM "ThunderStorm"
  1080. #define STR_WEATHER_SNOW "Snow"
  1081. #define STR_WEATHER_MIST "Mist"
  1082. enum _WEATHER_INFO
  1083. {
  1084. _WEATHER_None = 0,
  1085. _WEATHER_Sunny = 1,
  1086. _WEATHER_Cloudy = 2,
  1087. _WEATHER_Rain = 3,
  1088. _WEATHER_ThunderStorm = 4,
  1089. _WEATHER_Snow = 5,
  1090. _WEATHER_Mist = 6,
  1091. };
  1092. typedef struct
  1093. {
  1094. int StationID;
  1095. char StationName[64];
  1096. char QRCode[MAX_GROUP_QUANTITY][128];
  1097. int WeatherID;
  1098. float Temperature;
  1099. }StationInfoData;
  1100. typedef struct
  1101. {
  1102. int StatusCode[MAX_GROUP_QUANTITY];
  1103. }LineApiStatusInfo;
  1104. typedef struct
  1105. {
  1106. int TransactionId; // connector TransactionId
  1107. float UserPrice; // connector user's user price, unit: 1 (dollar / kWh)
  1108. float TotalCost; // connector user's total cost, unit: 1 dollar
  1109. float AccountBalance; // connector user's account balance, unit: 1 dollar
  1110. float CostDiscount; // connector user's account balance, unit: 1 dollar
  1111. }TransactionInfoData;
  1112. enum DeductResult
  1113. {
  1114. _Deduct_Fail = 0x0, // deduct fail
  1115. _Deduct_Pass = 0x1, // deduct pass
  1116. _Deduct_Cancel = 0x2, // pre-auth cancel
  1117. _Deduct_PreAuth = 0x3, // pre-auth
  1118. };
  1119. #define STR_DEDUCT_FAIL "Deduct Fail"
  1120. #define STR_DEDUCT_PASS "Deduct Pass"
  1121. #define STR_DEDUCT_CANCEL "PreAuth Cancel"
  1122. #define STR_DEDUCT_PREAUTH "PreAuth OK"
  1123. typedef struct
  1124. {
  1125. char DefaultPriceString[512]; // default price string
  1126. char DispenserPriceString[MAX_GUN_QUANTITY][512]; // dispenser user price string
  1127. char UserPriceString[MAX_GUN_QUANTITY][512]; // connector user price string
  1128. char ReceiptUrl[MAX_GUN_QUANTITY][512]; // connector receipt url
  1129. }PriceReceiptInfoData;
  1130. typedef enum
  1131. {
  1132. _Type_Central = 0x0,
  1133. _Type_eMAID = 0x1,
  1134. _Type_ISO14443 = 0x2,
  1135. _Type_ISO15693 = 0x3,
  1136. _Type_KeyCode = 0x4,
  1137. _Type_Local = 0x5,
  1138. _Type_MacAddress = 0x6,
  1139. _Type_NoAuthorization = 0x7,
  1140. }UserIdType;
  1141. #define STR_ID_TYPE_CENTRAL "Central"
  1142. #define STR_ID_TYPE_EMAID "eMAID"
  1143. #define STR_ID_TYPE_ISO14443 "ISO14443"
  1144. #define STR_ID_TYPE_ISO15693 "ISO15693"
  1145. #define STR_ID_TYPE_KEYCODE "KeyCode"
  1146. #define STR_ID_TYPE_LOCAL "Local"
  1147. #define STR_ID_TYPE_MAC_ADDRESS "MacAddress"
  1148. #define STR_ID_TYPE_NO_AUTHORIZATION "NoAuthorization"
  1149. typedef struct
  1150. {
  1151. float LocalConsumption; // power consumption store in cabinet
  1152. float GunConsumption; // power consumption store in dispenser
  1153. }MeterValueInfoData;
  1154. typedef struct
  1155. {
  1156. char StartCharging[32]; // start charging timestamp
  1157. char StopCharging[32]; // stop charging timestamp
  1158. }TimestampInfoData;
  1159. typedef struct
  1160. {
  1161. char MainVersion[32];
  1162. char SubVersion[32];
  1163. }SysMiscInfoData;
  1164. typedef struct
  1165. {
  1166. unsigned char Status;
  1167. }ConnectorConfigAndStatus;
  1168. // ************************************************************************************************* //
  1169. typedef struct
  1170. {
  1171. SysMiscInfoData SysMisc;
  1172. SystemAuthInfoData AuthInfo;
  1173. SysControl Control;
  1174. PsuPositionInfoData PsuPosition;
  1175. PsuGroupingInfoData PsuGrouping;
  1176. SocketConnInfoData CabinetConnInfo[MAX_SLAVE_CABINET_QUANTITY];
  1177. ParallelCabinetInfoData ParallelCabinet;
  1178. SlaveCabinetControl SCabinetControl;
  1179. ConnectorPageControl ConnectorPageReq[MAX_GROUP_QUANTITY];
  1180. DispenserMiscControl DispenserMiscReq[MAX_GROUP_QUANTITY];
  1181. ConnectorMiscControl ConnectorMiscReq[MAX_GROUP_QUANTITY];
  1182. MiscCommandValue CabinetMiscValue;
  1183. ConnectorActionRequest ConnectorActReq[MAX_GROUP_QUANTITY];
  1184. StationInfoData StationInfo;
  1185. TransactionInfoData UserTransaction[MAX_GROUP_QUANTITY];
  1186. DeductResultInfoData DeductResultReq[MAX_GROUP_QUANTITY];
  1187. DeductResultInfoData ReDeductReq;
  1188. DeductResultInfoData ReaderStatus[MAX_GROUP_QUANTITY];
  1189. LineApiStatusInfo LineApi;
  1190. ConnectorConfigAndStatus Connector[MAX_GUN_QUANTITY];
  1191. PriceReceiptInfoData PriceAndReceiptInfo;
  1192. MeterValueInfoData MeterValue[MAX_GUN_QUANTITY];
  1193. TimestampInfoData Timestamp[MAX_GUN_QUANTITY];
  1194. }ChargerInfoData;
  1195. #endif /* CONFIG_H_ */