Config.h 49 KB

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