Config.h 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  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 Enable6ParallelRelay:1; // 0: no effect, 1: enable 6 parallel relay
  326. unsigned int res:17;
  327. }bits;
  328. }SystemControl;
  329. typedef union
  330. {
  331. unsigned int CtrlValue;
  332. struct
  333. {
  334. unsigned int DisableBalance:1; // 0: no effect, 1: disable announce balance
  335. unsigned int FastStandbyTime:1; // 0: no effect, 1: enable fast standby time
  336. unsigned int ChargingSimulation:1; // 0: no effect, 1: enable charging simulation
  337. unsigned int res:29;
  338. }bits;
  339. }TestControl;
  340. typedef union
  341. {
  342. unsigned int CtrlValue;
  343. struct
  344. {
  345. unsigned int MsgMain:1; // 0: no effect, 1: enable debug message in main
  346. unsigned int MsgPrimaryComm:1; // 0: no effect, 1: enable debug message in primary comm
  347. unsigned int MsgPsu:1; // 0: no effect, 1: enable debug message in psu
  348. unsigned int MsgEvComm:1; // 0: no effect, 1: enable debug message in ev comm
  349. unsigned int MsgInternalComm:1; // 0: no effect, 1: enable debug message in internal comm
  350. unsigned int res:27;
  351. }bits;
  352. }DebugControl;
  353. typedef union
  354. {
  355. unsigned int CtrlValue;
  356. struct
  357. {
  358. unsigned int EnableForceCharging:1; // 0: disable, 1: enable force charging
  359. unsigned int StartForceCharging:1; // 0: disable, 1: start force charging
  360. unsigned int res:30;
  361. }bits;
  362. }ForceChargingControl;
  363. typedef struct
  364. {
  365. ForceChargingControl FCtrl;
  366. unsigned short FTargetVoltage; // target voltage, unit: 0.1V
  367. unsigned short FTargetCurrent; // target current, unit: 0.1A
  368. }ForceCharging;
  369. typedef union
  370. {
  371. unsigned int AuthFlag;
  372. struct
  373. {
  374. unsigned int AutoStartEnable:1; // 0: disable, 1: enable auto charging after plug in
  375. unsigned int APPEnable:1; // 0: disable, 1: app auth enable
  376. unsigned int QRCodeEnable:1; // 0: disable, 1: qr code auth enable
  377. unsigned int RFIDEnable:1; // 0: disable, 1: rfid auth enable
  378. unsigned int res:24;
  379. }bits;
  380. }AuthModeInfo;
  381. typedef struct
  382. {
  383. AuthModeInfo AuthMode;
  384. unsigned char QRCodeMode; // 0: default, 1: customized, 2: audi type
  385. unsigned char res[3];
  386. }SystemAuthInfoData;
  387. typedef union
  388. {
  389. unsigned int CtrlValue;
  390. struct
  391. {
  392. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  393. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  394. unsigned int Paused:1; // 0: no effect, 1: primary paused
  395. unsigned int DisableDoorSensor:1; // 0: door sensor enable, 1: door sensor disable
  396. unsigned int DisableEmergencyButton:1; // 0: emergency button enable, 1: emergency button disable
  397. unsigned int DoorSensorReverse:1; // 0: the same as ds's, 1: status is different from ds's
  398. unsigned int AcContactorReverse:1; // 0: the same as ds's, 1: status is different from ds's
  399. unsigned int CabinetSwitchDetect:1; // 0: no effect, 1: need detect cabinet switch
  400. unsigned int res:24;
  401. }bits;
  402. }PrimaryControl;
  403. typedef union
  404. {
  405. unsigned int CtrlValue;
  406. struct
  407. {
  408. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  409. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  410. unsigned int Paused:1; // 0: no effect, 1: relay paused
  411. unsigned int AcContactor:1; // 0: ac contactor off, 1: ac contactor on
  412. unsigned int AcContactorOffByPsu:1; // 0: no effect, 1: ac contactor off
  413. unsigned int AcContactorOffByEmergency:1; // 0: no effect, 1: ac contactor off
  414. unsigned int StandbyCountdown:1; // 0: charger is using, 1: start countdown
  415. unsigned int AcInputDisable:1; // 0: ac input enable, 1: ac input disable
  416. unsigned int DcInputEnable:1; // 0: dc input disable, 1: dc input enable
  417. unsigned int res:23;
  418. }bits;
  419. }RelayControl;
  420. typedef union
  421. {
  422. unsigned int CtrlValue;
  423. struct
  424. {
  425. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  426. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  427. unsigned int Paused:1; // 0: no effect, 1: fan paused
  428. unsigned int res:29;
  429. }bits;
  430. }FanControl;
  431. typedef union
  432. {
  433. unsigned int CtrlValue;
  434. struct
  435. {
  436. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  437. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  438. unsigned int Paused:1; // 0: no effect, 1: led paused
  439. unsigned int res:29;
  440. }bits;
  441. }LedFanControl;
  442. typedef union
  443. {
  444. unsigned int CtrlValue;
  445. struct
  446. {
  447. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  448. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  449. unsigned int Paused:1; // 0: no effect, 1: psu paused
  450. unsigned int FailureResume:1; // 0: no error, 1: psu failure, need resume
  451. unsigned int CommunicationLost:1; // 0: no error, 1: psu communication lost
  452. unsigned int res:27;
  453. }bits;
  454. }PsuControl;
  455. enum _OCPP_PAGE_INDEX
  456. {
  457. _OCPP_Page_None = 0, // page none
  458. _OCPP_Page_LineStatus_1 = 1, // line status 1 page
  459. _OCPP_Page_LineStatus_2 = 2, // line status 2 page
  460. _OCPP_Page_LineStatus_3 = 3, // line status 3 page
  461. _OCPP_Page_LineStatus_4 = 4, // line status 4 page
  462. };
  463. typedef union
  464. {
  465. unsigned int CtrlValue;
  466. struct
  467. {
  468. unsigned int RemoteStartNoId:1; // 0: no effect, 1: trigger remote start without connector id
  469. unsigned int res:31;
  470. }bits;
  471. }OcppControl;
  472. typedef struct
  473. {
  474. int TxCnt;
  475. int RxCnt;
  476. int LostCnt;
  477. int CommCnt;
  478. }DevideCommInfo;
  479. typedef struct
  480. {
  481. DevideCommInfo PrimaryComm;
  482. DevideCommInfo Relay1Comm;
  483. DevideCommInfo Relay2Comm;
  484. DevideCommInfo FanComm;
  485. DevideCommInfo LedComm;
  486. DevideCommInfo PsuComm;
  487. }CommInfoData;
  488. typedef union
  489. {
  490. unsigned int CtrlValue;
  491. struct
  492. {
  493. unsigned int UpdateReq:1; // 0: no effect, 1: update request
  494. unsigned int UpdateConfirm:1; // 0: no effect, 1: update confirm
  495. unsigned int UpdateDone:1; // 0: no effect, 1: update done
  496. unsigned int res:29;
  497. }bits;
  498. }UpdateControl;
  499. typedef struct
  500. {
  501. int Pri232Fd;
  502. int Rs422Fd;
  503. int PsuCanFd;
  504. int EvCanFd;
  505. }FdControl;
  506. typedef struct
  507. {
  508. unsigned char MaxDispenser;
  509. unsigned char MaxConnector;
  510. unsigned char CabinetSwitch;
  511. unsigned char CabinetRole;
  512. unsigned char SelfTestStep;
  513. unsigned char CustomerCode;
  514. unsigned short ChargerRatingPower; // unit: 0.1kw, charger rating power, parsing from model name
  515. CommInfoData CommInfo;
  516. SystemControl SysCtrl;
  517. UpdateControl UpdateCtrl;
  518. TestControl TestCtrl;
  519. DebugControl DebugCtrl;
  520. PrimaryControl PrimaryCtrl;
  521. RelayControl RelayCtrl;
  522. FanControl FanCtrl;
  523. LedFanControl LedCtrl;
  524. PsuControl PsuCtrl;
  525. OcppControl OcppCtrl;
  526. FdControl FdCtrl;
  527. ForceCharging FCharging[MAX_GROUP_QUANTITY];
  528. unsigned char GunAvailable[MAX_GROUP_QUANTITY];
  529. unsigned char PsuInitQuantity[MAX_GROUP_QUANTITY];
  530. char ResevedIdTag[MAX_GROUP_QUANTITY][32];
  531. }SysControl;
  532. // ************************************************************************************************* //
  533. typedef struct
  534. {
  535. bool CheckIn;
  536. unsigned char Address;
  537. unsigned char GroupNo;
  538. unsigned char GIndex;
  539. }PsuAddressInfoData;
  540. typedef struct
  541. {
  542. unsigned char GroupPsuQuantity;
  543. unsigned char res;
  544. unsigned char PsuSN[MAX_MODULE_PER_GROUP];
  545. }GroupInfoData;
  546. typedef struct
  547. {
  548. bool PsuLocationInit;
  549. bool ReInitPsuLocation;
  550. unsigned char TotalPsuQuantity;
  551. GroupInfoData GroupLocationInfo[MAX_GROUP_QUANTITY];
  552. PsuAddressInfoData PsuAddressInfo[MAX_PSU_MODULE_QUANTITY];
  553. }PsuPositionInfoData;
  554. // ************************************************************************************************* //
  555. typedef enum
  556. {
  557. _GROLE_IDLE = 0,
  558. _GROLE_MASTER = 1,
  559. _GROLE_SLAVE = 2,
  560. _GROLE_PREPARE_SWITCH_OFF = 10, // reduce output current capability
  561. _GROLE_SLAVE_POWER_OFF = 11, // power off
  562. _GROLE_SWITCH_OFF_OK = 12, // power off completed
  563. _GROLE_WAIT_IDLE = 13, // wait a while to change to idle, open parallel relay at this state
  564. _GROLE_WAIT_SLAVE = 14, // wait a while to change to slave
  565. _GROLE_PREPARE_ATTACH_ON = 20, // raise voltage to master output voltage
  566. _GROLE_PRECHARGE_READY = 21, // extend pre-charge ready
  567. _GROLE_EXTEND_STOP = 22, // extend capability stop
  568. _GROLE_REQUEST_TO_CHARGING = 30,
  569. _GROLE_TERMINATE = 40,
  570. _GROLE_WAIT_TERMINATED = 41,
  571. _GROLE_NONE = 99,
  572. }_GROUP_ROLE;
  573. typedef union
  574. {
  575. unsigned int CtrlValue[6];
  576. struct
  577. {
  578. unsigned int IdleCtrlValue;
  579. unsigned int MasterCtrlValue;
  580. unsigned int StopChargingCtrlValue;
  581. unsigned int DeratingCtrlValue;
  582. unsigned int ExtendCapabilityCtrlValue;
  583. unsigned int SlaveCtrlValue;
  584. }RoleCtrl;
  585. struct
  586. {
  587. // IdleCtrlValue
  588. unsigned int ChargingRequest:1; // 0: no effect, 1: charging request from main.c
  589. unsigned int ChargingRequestConfirmed:1; // 0: no effect, 1: request confirmed by psu task
  590. unsigned int GroupShareCheck:1; // 0: no effect, 1: check is there any psu can share
  591. unsigned int ShareConfirmed:1; // 0: no effect, 1: psu share confirmed
  592. unsigned int GrabGroupWait:1; // 0: no effect, 1: need to wait grab psu
  593. unsigned int ShareCheckDone:1; // 0: no effect, 1: psu share completed
  594. unsigned int FindGroupPartner:1; // 0: no effect, 1: find available group partner
  595. unsigned int ParallelRelayOn:1; // 0: no effect, 1: set parallel relay on
  596. unsigned int ParallelRelayConfirmed:1; // 0: no effect, 1: parallel relay confirmed
  597. unsigned int GroupingDone:1; // 0: no effect, 1: grouping completed
  598. unsigned int IdleCtrlRes:22;
  599. // MasterCtrlValue
  600. unsigned int CableCheckDone:1; // 0: no effect, 1: CableCheck done
  601. unsigned int InPrechargeMode:1; // 0: no effect, 1: system status in PreCharge mode
  602. unsigned int AlreadyInChargingMode:1; // 0: no effect, 1: system status ever enter charging mode
  603. unsigned int ExtendAvailable:1; // 0: no effect, 1: extend capability is available
  604. unsigned int NeedCurrentBalance:1; // 0: no effect, 1: need to current balance
  605. unsigned int OutputCurrentStable:1; // 0: no effect, 1: output current is stable
  606. unsigned int ReachMaxCurrentDemand:1; // 0: no effect, 1: reach ev max current demand
  607. unsigned int ReachMaxStageCurrent:1; // 0: no effect, 1: reach ev max stage current
  608. unsigned int MasterCtrlRes:24;
  609. // StopChargingCtrlValue
  610. unsigned int StopChargingRequest:1; // 0: no effect, 1: master need to stop
  611. unsigned int StopChargingConfirmed:1; // 0: no effect, 1: stop charging confirmed
  612. unsigned int AllPowerOffDone:1; // 0: no effect, 1: all member power off done
  613. unsigned int AllParallelRelayOff:1; // 0: no effect, 1: all member's parallel relay off
  614. unsigned int AllParallelRelayConfirmed:1; // 0: no effect, 1: all member's parallel relay off confirmed
  615. unsigned int AllMemberStopCompleted:1; // 0: no effect, 1: all member stop completed
  616. unsigned int StopChargingCompleted:1; // 0: no effect, 1: stop charging completed
  617. unsigned int StopChargingCtrlRes:25;
  618. // DeratingCtrlValue
  619. unsigned int NeedDerating:1; // 0: no effect, 1: need derating
  620. unsigned int DeratingConfirmed:1; // 0: no effect, 1: derating confirmed
  621. unsigned int DeratingStart:1; // 0: no effect, 1: derating start
  622. unsigned int DeratingPowerOffDone:1; // 0: no effect, 1: derating member power off done
  623. unsigned int DeratingRelayOff:1; // 0: no effect, 1: set derating member parallel relay off
  624. unsigned int DeratingRelayConfirmed:1; // 0: no effect, 1: derating member parallel relay confirmed
  625. unsigned int DeratingCompleted:1; // 0: no effect, 1: derating completed
  626. unsigned int DeratingCtrlRes:25;
  627. // ExtendCapabilityCtrlValue
  628. unsigned int MorePowerRequest:1; // 0: no effect, 1: need to request more psu
  629. unsigned int MorePowerConfirmed:1; // 0: no effect, 1: request more psu confirmed
  630. unsigned int ExtendPrecharge:1; // 0: no effect, 1: extend group need to pre-charge
  631. unsigned int ExtendPrechargeDone:1; // 0: no effect, 1: extend group pre-charge completed
  632. unsigned int ExtendRelayOn:1; // 0: no effect, 1: extend group parallel relay on
  633. unsigned int ExtendRelayConfirmed:1; // 0: no effect, 1: extend group parallel relay confirmed
  634. unsigned int ExtendCompleted:1; // 0: no effect, 1: extend capability completed
  635. unsigned int ExtendCapabilityCtrlRes:25;
  636. // SlaveCtrlValue
  637. unsigned int SlaveChargingRequest:1; // 0: no effect, 1: request slave to charging after power off
  638. unsigned int CheckSlaveReady:1; // 0: no effect, 1: check if slave is ready
  639. unsigned int WaitSlaveReady:1; // 0: no effect, 1: wait slave is ready
  640. unsigned int SlavePowerOffRequest:1; // 0: no effect, 1: request slave to power off
  641. unsigned int SlavePowerOffConfirmed:1; // 0: no effect, 1: slave power off confirmed
  642. unsigned int SlaveCtrlRes:27;
  643. }bits;
  644. }PsuGroupControl;
  645. typedef struct
  646. {
  647. unsigned char Quantity;
  648. unsigned char RealQuantity;
  649. unsigned char Member[MAX_GROUP_QUANTITY]; // record slave group index
  650. }PsuGroupPartner;
  651. typedef struct
  652. {
  653. unsigned char Index;
  654. unsigned char Role;
  655. unsigned char PreRole;
  656. unsigned char Location;
  657. PsuGroupPartner Partner; // record slave group information
  658. PsuGroupPartner PossibleMember; // record possible slave group information
  659. unsigned char TargetGroup; // target group index + 1
  660. unsigned char ReservedTarget; // reserved target group index + 1
  661. PsuGroupControl GroupCtrl;
  662. unsigned short ReAssignAvailableCurrent; // group available current when reassign, unit: 0.1A
  663. unsigned short ParallelCheck;
  664. unsigned char ParallelConfig[MAX_GROUP_QUANTITY]; // group parallel relay setting
  665. unsigned short GunLoading; // gun output loading, unit: 0.01%
  666. unsigned char GunPsuQuantity; // record psu quantity at this gun
  667. unsigned char res;
  668. }PsuGroupCollectionData;
  669. typedef struct
  670. {
  671. unsigned short GTargetVoltage; // group target voltage config, unit: 0.1V
  672. unsigned short GTargetCurrent; // group target current config, unit: 0.1A
  673. unsigned short OutputLoading; // group output loading, unit: 0.01%
  674. }GroupOutputConfigInfo;
  675. typedef union
  676. {
  677. unsigned short CtrlValue;
  678. struct
  679. {
  680. unsigned short Output_N:1; // 0: set Output_N off, 1: set Output_N on
  681. unsigned short Output_P:1; // 0: set Output_P off, 1: set Output_P on
  682. unsigned short res:14;
  683. }bits;
  684. }PsuGroupOutputRelay;
  685. typedef union
  686. {
  687. unsigned short CtrlValue;
  688. struct
  689. {
  690. unsigned short Location_1_2:1; // 0: set parallel off, 1: set parallel on
  691. unsigned short Location_2_3:1; // 0: set parallel off, 1: set parallel on
  692. unsigned short Location_3_4:1; // 0: set parallel off, 1: set parallel on
  693. unsigned short Location_4_5:1; // 0: set parallel off, 1: set parallel on
  694. unsigned short res:12;
  695. }bits;
  696. }PsuGroupParallelRelay;
  697. typedef struct
  698. {
  699. byte Location[MAX_GROUP_QUANTITY];
  700. byte Layout[MAX_GROUP_QUANTITY];
  701. PsuGroupCollectionData GroupCollection[MAX_GROUP_QUANTITY];
  702. GroupOutputConfigInfo GroupOutput[MAX_GROUP_QUANTITY];
  703. PsuGroupOutputRelay OutputRelayConfig[MAX_GROUP_QUANTITY];
  704. PsuGroupOutputRelay OutputRelayConfirmed[MAX_GROUP_QUANTITY];
  705. PsuGroupParallelRelay ParallelRelayConfig;
  706. PsuGroupParallelRelay ParallelRelayConfirmed;
  707. }PsuGroupingInfoData;
  708. // ************************************************************************************************* //
  709. typedef enum
  710. {
  711. _SCONN_FREE = 0,
  712. _SCONN_WAIT = 1,
  713. _SCONN_MATCHED = 2,
  714. }_SOCKET_CONN_STATUS;
  715. typedef enum
  716. {
  717. _DeviceStatus_DisConnect = 0x00, // _DS_None , slave cabinet in re-connection
  718. _DeviceStatus_Identification = 0x01, // _DS_Identification , slave cabinet in identification
  719. _DeviceStatus_Idle = 0x02, // _DS_Idle , slave cabinet in idle
  720. _DeviceStatus_Alarm = 0x03, // _DS_Alarm , slave cabinet in alarm
  721. _DeviceStatus_Charging = 0x04, // _DS_Charging , no use in slave cabinet
  722. _DeviceStatus_Timeout = 0x05, // _DS_Timeout , no use in slave cabinet
  723. _DeviceStatus_RetryWait = 0x06,
  724. }_DEVICE_STATUS;
  725. typedef enum
  726. {
  727. _Parallel_None = 0,
  728. _Parallel_Wait = 1, // ac contactor off, 3s
  729. _Parallel_Working = 2, // ac contactor on and start re-initial psu
  730. _Parallel_Done = 3, // re-initial psu done
  731. }_PARALLEL_STATUS;
  732. typedef struct
  733. {
  734. unsigned char Status; // 0: free, 1: WaitModelName, 2: DispenserMatched
  735. unsigned char DeviceIndex; // record device index
  736. unsigned int IpAddress; // record device ip address
  737. unsigned char DuplicateIp; // 0: unique ip, 1: duplicate ip
  738. unsigned char res;
  739. }SocketConnInfoData;
  740. typedef struct
  741. {
  742. unsigned char LocalStatus; // 0: None, 1: Identification, 2: Idle, 3: Alarm, 4: Charging, 5: _DS_Timeout
  743. unsigned char SlaveID;
  744. unsigned char ModelName[64]; //charger model name
  745. unsigned char SerialNumber[64]; //charger system serial number
  746. unsigned char SystemId[128]; //charger system ID
  747. unsigned char CsuBootLoadFwRev[32]; //CSU board bootloader firmware version
  748. unsigned char CsuKernelFwRev[32]; //CSU board OS kernel firmware version
  749. unsigned char CsuRootFsFwRev[32]; //CSU board root file system firmware version
  750. unsigned char CsuPrimFwRev[32]; //CSU board root file system firmware version
  751. unsigned char LcmFwRev[32]; //LCM module firmware version
  752. unsigned char PsuPrimFwRev[32]; //PSU primary firmware version
  753. unsigned char PsuSecFwRev[32]; //PSU secondary firmware version
  754. unsigned char FanModuleFwRev[32]; //Fan module firmware version
  755. unsigned char RelayModuleFwRev[32]; //Relay control module firmware version
  756. unsigned char TelcomModemFwRev[32]; //the 3G/4G modem firmware version
  757. unsigned char LedModuleFwRev[32]; //LED control module firmware version
  758. unsigned char Connector1FwRev[32]; //Connector1 module firmware version
  759. unsigned char Connector2FwRev[32]; //Connector2 module firmware version
  760. unsigned char AcContactorSetting; // 0: OFF, 1: ON Master -> Slave
  761. unsigned char AcContactorState; // 0: OFF, 1: ON Slave -> Master
  762. unsigned char OutputRelaySetting[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Master -> Slave
  763. unsigned char GunOutputRelayState[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Slave -> Master
  764. unsigned char ParallelRelaySetting[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Master -> Slave
  765. unsigned char ParallelRelayState[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Slave -> Master
  766. unsigned char UpdateRequest; // 0: no effect, 1: need to update
  767. unsigned char res;
  768. char FwFileName[128];
  769. unsigned char SocketChannel; // record socket index
  770. unsigned char IpDuplicatedFlag; // 0: no effect, 1: ip is duplicated
  771. unsigned char ParallelRequest; // 0: no effect, 1: parallel request
  772. unsigned char ParallelConfirm; // 0: no effect, 1: parallel confirm
  773. unsigned short ParallelPower; // parallel power, unit: 0.1kw
  774. }SlaveCabinetInfoData;
  775. typedef struct
  776. {
  777. unsigned char ParallelStatus; // 0: parallel none, 1: wait, 2: in paralleling, 3: parallel done
  778. unsigned char ParallelCabinetQuantity; // record max dispenser quantity
  779. unsigned char PresentParallelCabinetQuantity; // present slave cabinet quantity
  780. unsigned char res;
  781. SlaveCabinetInfoData PCabinet[MAX_SLAVE_CABINET_QUANTITY];
  782. unsigned char PCUpdateState[MAX_SLAVE_CABINET_QUANTITY]; // 0: Not in Update, 1: Updating, 2: Updated
  783. unsigned short TotalParallelPower; // max total parallel power, unit: 0.1kw
  784. }ParallelCabinetInfoData;
  785. typedef struct
  786. {
  787. unsigned char SCabinetStatus;
  788. unsigned char SCabinetID;
  789. unsigned char SOutputRelay[MAX_GROUP_QUANTITY]; // parallel cabinet output relay state
  790. unsigned char SParallelRelay[MAX_GROUP_QUANTITY]; // parallel cabinet parallel relay state
  791. unsigned char SAcContactor; // slave cabinet ac contactor state
  792. unsigned char NeedUpgrade; // 1: Need Upgrade, 2: No Update
  793. unsigned char UpgradeState; // 0: Not in Update, 1: Updating, 2: Updated
  794. unsigned char res;
  795. char FwFileName[128];
  796. }SlaveCabinetControl;
  797. // ************************************************************************************************* //
  798. #define LCM_REQ_REMOTE_START_NO_ID 0x00000001
  799. typedef union
  800. {
  801. unsigned int CtrlValue;
  802. struct
  803. {
  804. // cabinet -> connector
  805. unsigned int RemoteStartNoID:1; // 0: no request, 1: lcm page change to RemoteStartNoID
  806. unsigned int res:31;
  807. }bits;
  808. }ConnectorPageControl;
  809. #define MISC_DISP_CONNECTION_TIMEOUT 0x00000001
  810. #define MISC_DISP_DEFAULT_PRICE 0x00000002
  811. #define MISC_DISP_CURRENCY 0x00000004
  812. #define MISC_DISP_BACKEND_STATUS 0x00000008
  813. #define MISC_DISP_ETHERNET_STATUS 0x00000010
  814. #define MISC_DISP_WIFI_STATUS 0x00000020
  815. #define MISC_DISP_TELCOM_MODEM_STATUS 0x00000040
  816. #define MISC_DISP_BILLING_STATUS 0x00000080
  817. #define MISC_DISP_STOP_BUTTON_STATUS 0x00000100
  818. #define MISC_DISP_AUTH_MODE_CONFIG 0x00000200
  819. #define MISC_DISP_EVCCID_CONFIG 0x00000400
  820. #define MISC_DISP_LED_INTENSITY 0x00000800
  821. #define MISC_DISP_HARDWARE_REBOOT 0x00001000
  822. #define MISC_DISP_SOFTWARE_RESET 0x00002000
  823. #define MISC_DISP_CHANGE_LCM_INFO 0x00004000
  824. #define MISC_DISP_STATION_INFO 0x00008000
  825. #define MISC_DISP_TIME_OFFSET 0x00010000
  826. typedef union
  827. {
  828. unsigned int CtrlValue;
  829. struct
  830. {
  831. // cabinet -> dispenser
  832. unsigned int ConnectionTimeout:1; // msic: 0x0001, 0: no request, 1: connection timeout request
  833. unsigned int DefaultPrice:1; // msic: 0x0003, 0: no request, 1: default price request
  834. unsigned int Currency:1; // msic: 0x0004, 0: no request, 1: currency request
  835. unsigned int BackendStatus:1; // msic: 0x0006, 0: no request, 1: backend status request
  836. unsigned int EthernetStatus:1; // msic: 0x0007, 0: no request, 1: ethernet status request
  837. unsigned int WiFiStatus:1; // msic: 0x0008, 0: no request, 1: wifi status request
  838. unsigned int TelcomModemStatus:1; // msic: 0x0009, 0: no request, 1: telcom modem status request
  839. unsigned int BillingStatus:1; // msic: 0x000A, 0: no request, 1: billing status request
  840. unsigned int StopButtonStatus:1; // msic: 0x000B, 0: no request, 1: stop button status request
  841. unsigned int AuthModeConfig:1; // msic: 0x000C, 0: no request, 1: auth mode config request
  842. unsigned int EVCCIDConfig:1; // msic: 0x000D, 0: no request, 1: EVCCID config request
  843. unsigned int LEDIntensity:1; // msic: 0x000E, 0: no request, 1: led intensity request
  844. unsigned int HardwareReboot:1; // msic: 0x0101, 0: no request, 1: hardware reboot request
  845. unsigned int SoftwareReset:1; // msic: 0x0102, 0: no request, 1: software reset request
  846. unsigned int ChangeLcmInfo:1; // msic: 0x0107, 0: no request, 1: change lcm info request
  847. unsigned int ChargerStationInfo:1; // msic: 0x0109, 0: no request, 1: charger station info request
  848. unsigned int TimeOffset:1; // msic: 0x0010, 0: no request, 1: time offset request
  849. unsigned int res:15;
  850. }bits;
  851. }DispenserMiscControl;
  852. #define MISC_CONN_AVAILABILITY 0x00000001
  853. #define MISC_CONN_ACCOUNT_BALANCE 0x00000002
  854. #define MISC_CONN_REMOTE_START 0x00000004
  855. #define MISC_CONN_REMOTE_STOP 0x00000008
  856. #define MISC_CONN_UNLOCK 0x00000010
  857. #define MISC_CONN_RESERVATION 0x00000020
  858. #define MISC_CONN_QRCODE_INFO 0x00000040
  859. #define MISC_CONN_FINAL_COST 0x00000080
  860. #define MISC_CONN_LINE_STATUS 0x00000100
  861. typedef union
  862. {
  863. unsigned int CtrlValue;
  864. struct
  865. {
  866. // cabinet -> connector
  867. unsigned int Availability:1; // msic: 0x0002, 0: no request, 1: availability request
  868. unsigned int AccountBalance:1; // msic: 0x0005, 0: no request, 1: account balance request
  869. unsigned int RemoteStart:1; // msic: 0x0103, 0: no request, 1: remote start request
  870. unsigned int RemoteStop:1; // msic: 0x0104, 0: no request, 1: remote stop request
  871. unsigned int Unlock:1; // msic: 0x0105, 0: no request, 1: unlock request
  872. unsigned int Reservation:1; // msic: 0x0106, 0: no request, 1: reservation request
  873. unsigned int QRCodeRequest:1; // msic: 0x0108, 0: no request, 1: QR Code request
  874. unsigned int FinalCostRequest:1; // msic: 0x010A, 0: no request, 1: Final Cost request
  875. unsigned int LineStatusRequest:1; // msic: 0x010B, 0: no request, 1: Line Status request
  876. unsigned int res:23;
  877. }bits;
  878. }ConnectorMiscControl;
  879. typedef struct
  880. {
  881. unsigned int ConnectionTimeout; // unit: 1s
  882. float DefaultPrice; // unit: 1 (dollar/kWh)
  883. unsigned int Currency; // currency index
  884. unsigned int BackendStatus; // 0: disable, 1: connected, 2: disconnected
  885. unsigned int EthernetStatus; // 0: disable, 1: connected, 2: disconnected
  886. unsigned int WiFiStatus; // 0: disable, 1: connected, 2: disconnected
  887. unsigned int TelcomModemStatus; // 0: disable, 1: connected, 2: disconnected
  888. unsigned int BillingStatus; // 0: disable, 1: enable
  889. unsigned int StopChargingButton; // 0: disable, 1: enable
  890. unsigned int HardwareReboot; // 1: HardwareReboot, Other value: no effect
  891. unsigned int SoftwareRestart; // 1: SoftwareRestart, Other value: no effect
  892. unsigned int AuthModeConfig; // 0: enable, 1: disable
  893. unsigned int EVCCIDConfig; // 0: disable, 1: enable
  894. unsigned int LEDIntensity; // LED intensity, 0: Darkest 1: Medium 2: Brightest
  895. int TimeOffset; // time offset value, unit: 1 minute
  896. }MiscCommandValue;
  897. typedef union
  898. {
  899. unsigned int CtrlValue;
  900. struct
  901. {
  902. // dispenser -> cabinet
  903. unsigned int ChargingCancel:1; // cmd: 0x0001, 0: no request, 1: charging cancel request
  904. unsigned int res:31;
  905. }bits;
  906. }ConnectorActionFlag;
  907. typedef union
  908. {
  909. unsigned int CtrlValue[32];
  910. struct
  911. {
  912. // dispenser -> cabinet
  913. unsigned int Refund; // 1: request, other: no effect
  914. unsigned int RefundCancel; // 1: cancel, other: no effect
  915. unsigned int InvoiceIndex; // invoice index, start from 1 ~
  916. unsigned int Res[29];
  917. }bits;
  918. }ConnectorActionValue;
  919. typedef struct
  920. {
  921. unsigned char ConnectorId; // Connector Id
  922. unsigned char DeductReq; // 0: no request, 1: deduct request
  923. unsigned char ReaderStatusReq; // 0: no request, 1: reader status request
  924. int TransactionId;
  925. unsigned char creditNo[20];
  926. unsigned char DeductResult; // DeductResult, 0: Fail, 1: Pass
  927. unsigned char IsDonateInvoice; // IsDonateInvoice, 0: Do not donate, 1: Donate
  928. int DeductAmount; // DeductAmount, unit = 0.01 dollar
  929. char ApprovalNumber[9]; // ApprovalNumber
  930. char VemData[64]; // Vem Data
  931. }DeductResultInfoData;
  932. typedef struct
  933. {
  934. ConnectorActionFlag Flag;
  935. ConnectorActionValue ActionValue;
  936. }ConnectorActionRequest;
  937. #define STR_WEATHER_NONE "None"
  938. #define STR_WEATHER_SUNNY "Sunny"
  939. #define STR_WEATHER_CLOUDY "Cloudy"
  940. #define STR_WEATHER_RAIN "Rain"
  941. #define STR_WEATHER_THUNDERSTORM "ThunderStorm"
  942. #define STR_WEATHER_SNOW "Snow"
  943. #define STR_WEATHER_MIST "Mist"
  944. enum _WEATHER_INFO
  945. {
  946. _WEATHER_None = 0,
  947. _WEATHER_Sunny = 1,
  948. _WEATHER_Cloudy = 2,
  949. _WEATHER_Rain = 3,
  950. _WEATHER_ThunderStorm = 4,
  951. _WEATHER_Snow = 5,
  952. _WEATHER_Mist = 6,
  953. };
  954. typedef struct
  955. {
  956. int StationID;
  957. char StationName[64];
  958. char QRCode[MAX_GROUP_QUANTITY][128];
  959. int WeatherID;
  960. float Temperature;
  961. }StationInfoData;
  962. typedef struct
  963. {
  964. int StatusCode[MAX_GROUP_QUANTITY];
  965. }LineApiStatusInfo;
  966. typedef struct
  967. {
  968. int TransactionId; // connector TransactionId
  969. float UserPrice; // connector user's user price, unit: 1 (dollar / kWh)
  970. float TotalCost; // connector user's total cost, unit: 1 dollar
  971. float AccountBalance; // connector user's account balance, unit: 1 dollar
  972. float CostDiscount; // connector user's account balance, unit: 1 dollar
  973. }TransactionInfoData;
  974. enum DeductResult
  975. {
  976. _Deduct_Fail = 0x0, // deduct fail
  977. _Deduct_Pass = 0x1, // deduct pass
  978. _Deduct_Cancel = 0x2, // pre-auth cancel
  979. _Deduct_PreAuth = 0x3, // pre-auth
  980. };
  981. #define STR_DEDUCT_FAIL "Deduct Fail"
  982. #define STR_DEDUCT_PASS "Deduct Pass"
  983. #define STR_DEDUCT_CANCEL "PreAuth Cancel"
  984. #define STR_DEDUCT_PREAUTH "PreAuth OK"
  985. // ************************************************************************************************* //
  986. typedef struct
  987. {
  988. SystemAuthInfoData AuthInfo;
  989. SysControl Control;
  990. PsuPositionInfoData PsuPosition;
  991. PsuGroupingInfoData PsuGrouping;
  992. SocketConnInfoData CabinetConnInfo[MAX_SLAVE_CABINET_QUANTITY];
  993. ParallelCabinetInfoData ParallelCabinet;
  994. SlaveCabinetControl SCabinetControl;
  995. ConnectorPageControl ConnectorPageReq[MAX_GROUP_QUANTITY];
  996. DispenserMiscControl DispenserMiscReq[MAX_GROUP_QUANTITY];
  997. ConnectorMiscControl ConnectorMiscReq[MAX_GROUP_QUANTITY];
  998. MiscCommandValue CabinetMiscValue;
  999. ConnectorActionRequest ConnectorActReq[MAX_GROUP_QUANTITY];
  1000. StationInfoData StationInfo;
  1001. TransactionInfoData UserTransaction[MAX_GROUP_QUANTITY];
  1002. DeductResultInfoData DeductResultReq[MAX_GROUP_QUANTITY];
  1003. DeductResultInfoData ReDeductReq;
  1004. DeductResultInfoData ReaderStatus[MAX_GROUP_QUANTITY];
  1005. LineApiStatusInfo LineApi;
  1006. }ChargerInfoData;
  1007. #endif /* CONFIG_H_ */