Config.h 45 KB

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