Config.h 61 KB

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