Config.h 47 KB

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