Config.h 54 KB

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