Config.h 61 KB

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