Config.h 46 KB

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