Config.h 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600
  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_DISPENSER_QUANTITY 4
  44. #define MAX_GUN_QUANTITY 4
  45. #define MAX_GROUP_QUANTITY 4
  46. #define MAX_PSU_MODULE_QUANTITY 62
  47. #define MAX_MODULE_PER_GROUP 12
  48. #define INFY_SINGLE_PSU_POWER 30000 // unit: 1W
  49. #define SM_ChargerInfoKey 3000
  50. #define SAFETY_TEST_ENABLE 0
  51. #define MAX_SLAVE_CABINET_QUANTITY 4
  52. #define MASTER_ETH1_IP "192.168.100.1"
  53. #define MASTER_ETH1_SUBMASK "255.255.255.0"
  54. #define SLAVE_ETH1_IP "192.168.0.10"
  55. #define SLAVE_ETH1_SUBMASK "255.255.255.0"
  56. #define AUTHORIZE_COMPLETED_TIME 3
  57. #define STARTTRANSATION_IMMEDIATELY
  58. #define ENABLE_PCBA_TEST 0
  59. #define PARALLEL_RELAY_COUNT 6
  60. #define _PHIHONG_PRICE_SPLIT_KEY ","
  61. #define _AUDI_PRICE_SPLIT_KEY ";"
  62. #define _OIL_PRICE_SPLIT_KEY "\n"
  63. // ********** Audi ********** //
  64. // Model Name: DOYC182000D2AD
  65. // Model Name: DDYC182V0UE2AD
  66. // ********** e4you ********** //
  67. // Model Name: DKYE182000D1E4
  68. // Model Name: DXYE182E00E1E4
  69. // ********** xpeng ********** //
  70. // Model Name: DOYE362000D2XP
  71. // Model Name: DDYE362F0KE2XP
  72. // *********** BYD *********** //
  73. // Model Name: DOYE242000D2BD
  74. // Model Name: DDYE242V0UE2BD
  75. // *********** TCC *********** //
  76. // Model Name: DBYE182000D1PH
  77. // Model Name: DBYC182000D1TC
  78. // Model Name: DDYC182V0EE1TC
  79. #define STR_LITTLE_ENDIAN "Little Endian"
  80. #define STR_BIG_ENDIAN "Big Endian"
  81. #define STR_MODE_BOOT "Booting"
  82. #define STR_MODE_IDLE "Idle"
  83. #define STR_MODE_AUTHORIZING "Authorizing"
  84. #define STR_MODE_REASSIGN_CHECK "ReassignCheck"
  85. #define STR_MODE_REASSIGN "Reassign"
  86. #define STR_MODE_PREPARNING "Preparing"
  87. #define STR_MODE_PREPARING_EV "PreparnForEV"
  88. #define STR_MODE_PREPARING_EVSE "PrepareForEVSE"
  89. #define STR_MODE_CHARGING "Charging"
  90. #define STR_MODE_TERMINATING "Terminating"
  91. #define STR_MODE_COMPLETE "Completed"
  92. #define STR_MODE_ALARM "Alarm"
  93. #define STR_MODE_FAULT "Fault"
  94. #define STR_MODE_RESERVATION "Reservation"
  95. #define STR_MODE_BOOKING "Booking"
  96. #define STR_MODE_MAINTAIN "Maintain"
  97. #define STR_MODE_DEBUG "Debug"
  98. #define STR_MODE_CCS_ST0 "CCS_ST0"
  99. #define STR_MODE_CCS_ST1 "CCS_ST1"
  100. #define STR_MODE_UPDATE "Update"
  101. #define STR_MODE_NONE "None"
  102. #define GUN_IDLE_TYPE_NORMAL 0
  103. #define GUN_IDLE_TYPE_WHOLE 1
  104. enum _SYSTEM_STATUS
  105. {
  106. S_BOOTING = 0,
  107. S_IDLE,
  108. S_AUTHORIZING,
  109. S_REASSIGN_CHECK,
  110. S_REASSIGN,
  111. S_PREPARNING,
  112. S_PREPARING_FOR_EV,
  113. S_PREPARING_FOR_EVSE,
  114. S_CHARGING,
  115. S_TERMINATING,
  116. S_COMPLETE,
  117. S_ALARM,
  118. S_FAULT,
  119. S_RESERVATION,
  120. S_BOOKING,
  121. S_MAINTAIN,
  122. S_DEBUG,
  123. S_CCS_PRECHARGE_ST0,
  124. S_CCS_PRECHARGE_ST1,
  125. S_UPDATE,
  126. S_NONE,
  127. };
  128. enum _AC_SYSTEM_STATUS
  129. {
  130. AC_SYS_NONE = 0,
  131. AC_SYS_A,
  132. AC_SYS_B,
  133. AC_SYS_C,
  134. AC_SYS_D,
  135. AC_SYS_E
  136. };
  137. #define STR_GUN_TYPE_CHADEMO "CHAdeMO"
  138. #define STR_GUN_TYPE_CCS "CCS"
  139. #define STR_GUN_TYPE_GBT "GBT"
  140. #define STR_GUN_TYPE_AC "AC"
  141. #define STR_GUN_TYPE_UNKNOWN "Unknown Type"
  142. enum _GUN_TYPE
  143. {
  144. _Type_Chademo = 0,
  145. _Type_CCS_2,
  146. _Type_GB,
  147. _Type_AC,
  148. _Type_Unknown = 0xFF
  149. };
  150. enum _LCM_INDEX
  151. {
  152. _LCM_INIT = 0x00,
  153. _LCM_IDLE = 0x01,
  154. _LCM_AUTHORIZING = 0x02,
  155. _LCM_AUTHORIZ_COMP = 0x03,
  156. _LCM_AUTHORIZ_FAIL = 0x04,
  157. _LCM_WAIT_FOR_PLUG = 0x05,
  158. _LCM_PRE_CHARGE = 0x06,
  159. _LCM_CHARGING = 0x07,
  160. _LCM_COMPLETE = 0x08,
  161. _LCM_FIX = 0x09,
  162. _LCM_NONE = 0xFF,
  163. };
  164. enum _DispenserAuthorizeStatus
  165. {
  166. _AuthorizeStatus_Idle = 0x00,
  167. _AuthorizeStatus_Wait = 0x01,
  168. _AuthorizeStatus_Busy = 0x02,
  169. _AuthorizeStatus_Done = 0x03,
  170. _AuthorizeStatus_End = 0x04,
  171. };
  172. enum _ConnectorAuthorizeResult
  173. {
  174. _AuthResult_None = 0x00,
  175. _AuthResult_Valid = 0x01,
  176. _AuthResult_Invalid = 0x02,
  177. };
  178. enum _AuthorizedType
  179. {
  180. _AuthType_None = 0x00,
  181. _AuthType_RFID = 0x01,
  182. _AuthType_RemoteStart = 0x02,
  183. };
  184. enum _SELF_TEST_SEQ
  185. {
  186. _STEST_VERSION = 0x00,
  187. _STEST_CabinetSwitch = 0x01,
  188. _STEST_AC_CONTACTOR = 0x02,
  189. _STEST_PSU_DETECT = 0x03,
  190. _STEST_PSU_CAP = 0x04,
  191. _STEST_PSU_RETRY = 0x05,
  192. _STEST_EMG_BTN = 0x06,
  193. _STEST_FAIL = 0x07,
  194. _STEST_COMPLETE = 0xEE,
  195. };
  196. enum _MODULE_PSU_WORK_STEP
  197. {
  198. INITIAL_START = 0,
  199. GET_PSU_COUNT = 1,
  200. Get_PSU_LOCATION = 2,
  201. Get_PSU_VERSION = 3,
  202. PSU_COUNT_CONFIRM = 4,
  203. GET_SYS_CAP = 5,
  204. BOOTING_COMPLETE = 6,
  205. _WORK_CHARGING = 10,
  206. _TEST_MODE = 20,
  207. _NO_WORKING = 254,
  208. _INIT_PSU_STATUS = 255
  209. };
  210. enum _OFFLINE_POLICY
  211. {
  212. _OFFLINE_POLICY_LOCAL_LIST = 0x00,
  213. _OFFLINE_POLICY_PHIHONG_RFID_TAG = 0x01,
  214. _OFFLINE_POLICY_FREE_CHARGING = 0x02,
  215. _OFFLINE_POLICY_NO_CHARGING = 0x03,
  216. };
  217. enum _REASSIGNED_RESOURCE_STEP
  218. {
  219. _REASSIGNED_NONE = 0, //
  220. _REASSIGNED_PREPARE_M_TO_A = 1, // 系統收到需要降載需求 (輸出總電流降低),PSU Task 收到將狀態切換至下個狀態
  221. _REASSIGNED_GET_NEW_CAP = 2, // 充電中的重新取得屬於自己火線上的總能量並透過小板通知車端 - 超過10秒直接跳下一步
  222. _REASSIGNED_ADJUST_M_TO_A = 3, // 模塊重新分配完成
  223. _REASSIGNED_RELAY_M_TO_A = 4, // 切斷橋接的 Relay
  224. _REASSIGNED_PREPARE_A_TO_M = 11,
  225. _REASSIGNED_ADJUST_A_TO_M = 12, // 模塊升壓
  226. _REASSIGNED_RELAY_A_TO_M = 13, // 搭接橋接的 Relay
  227. _REASSIGNED_WAITING = 14,
  228. _REASSIGNED_COMP = 15
  229. };
  230. enum _MAIN_CHARGING_MODE
  231. {
  232. _MAIN_CHARGING_MODE_MAX = 0,
  233. _MAIN_CHARGING_MODE_AVER = 1,
  234. };
  235. enum _EXTRA_ERR_PROCESS
  236. {
  237. _EXTRA_ERR_PROCESS_NONE = 0,
  238. _EXTRA_ERR_PROCESS_INUVP = 1,
  239. _EXTRA_ERR_PROCESS_INOVP = 2,
  240. _EXTRA_ERR_PROCESS_PRIMARY = 3,
  241. };
  242. enum _CHARGER_TYPE
  243. {
  244. _CHARGER_TYPE_IEC = 0,
  245. _CHARGER_TYPE_UL = 1,
  246. };
  247. enum _SYS_WIFI_MODE
  248. {
  249. _SYS_WIFI_MODE_DISABLE = 0,
  250. _SYS_WIFI_MODE_STATION = 1,
  251. _SYS_WIFI_MODE_AP = 2
  252. };
  253. enum _LED_INTENSITY_LV
  254. {
  255. _LED_INTENSITY_DARKEST = 0,
  256. _LED_INTENSITY_MEDIUM = 1,
  257. _LED_INTENSITY_BRIGHTEST = 2
  258. };
  259. enum _CCS_COMM_PROTOCOL
  260. {
  261. _CCS_COMM_V2GMessage_DIN70121 = 0x01,
  262. _CCS_COMM_V2GMessage_ISO15118_2014 = 0x02,
  263. _CCS_COMM_V2GMessage_ISO15118_2018 = 0x03
  264. };
  265. enum _ETHERNET_USAGE
  266. {
  267. _ETHERNET_USAGE_NONE = 0,
  268. _ETHERNET_USAGE_LAN,
  269. _ETHERNET_USAGE_WIFI,
  270. _ETHERNET_USAGE_3G_4g
  271. };
  272. enum _SYS_POWER_SHARING_MODE
  273. {
  274. _SYS_POWER_SHARING_MODE_DISABLE = 0,
  275. _SYS_POWER_SHARING_MODE_MASTER = 1,
  276. _SYS_POWER_SHARING_MODE_SLAVE = 2,
  277. };
  278. #define STR_CONN_DISABLE "Disable"
  279. #define STR_CONN_CONNECTED "Connected"
  280. #define STR_CONN_DISCONNECTED "Disconnected"
  281. #define STR_DARKEST "Darkest"
  282. #define STR_MEDIUM "Medium"
  283. #define STR_BRIGHTEST "Brightest"
  284. #define STR_PAGE_NONE "PageNone"
  285. #define STR_REMOTE_NO_ID "PlugInPage"
  286. enum _CONN_STATUS
  287. {
  288. _Connnection_Disable = 0,
  289. _Connnection_Connected = 1,
  290. _Connnection_Disconnected = 2,
  291. };
  292. enum _LED_INDICATION_STATUS
  293. {
  294. _LED_INDICATION_OFF = 0, // all led off
  295. _LED_INDICATION_RUN = 1, // green led on, red led off
  296. _LED_INDICATION_FAULT = 2, // green led off, red led on
  297. _LED_INDICATION_ON = 3, // all led on
  298. _LED_INDICATION_GREEN_TOGGLE = 4, // green led toggle
  299. _LED_INDICATION_RED_TOGGLE = 5, // red led toggle
  300. };
  301. enum _STANDARD_INDICATION_STATUS
  302. {
  303. _STANDARD_LED_None = 0,
  304. _STANDARD_LED_Disconnection = 1,
  305. _STANDARD_LED_Running = 2,
  306. _STANDARD_LED_Alarm = 3,
  307. };
  308. enum _E4YOU_INDICATION_STATUS
  309. {
  310. _E4YOU_LED_None = 0,
  311. _E4YOU_LED_Disconnection = 1,
  312. _E4YOU_LED_Idle = 2,
  313. _E4YOU_LED_Charging = 3,
  314. _E4YOU_LED_Alarm = 4,
  315. };
  316. #define STR_QR_DEFAULT "Default"
  317. #define STR_QR_CUSTOMIZED "Customized"
  318. #define STR_QR_CHARGEBOXID "ChargeBoxId"
  319. enum _QR_MODE
  320. {
  321. _QR_MODE_Default = 0,
  322. _QR_MODE_Customized = 1,
  323. _QR_MODE_ChargeBoxId = 2, // for audi
  324. };
  325. enum _CUSTOMER_CODE
  326. {
  327. _CUSTOMER_CODE_Phihong = 0,
  328. _CUSTOMER_CODE_Audi = 1,
  329. _CUSTOMER_CODE_E4U = 2,
  330. _CUSTOMER_CODE_UCar = 3,
  331. _CUSTOMER_CODE_TCC = 4,
  332. _CUSTOMER_CODE_Shell = 5,
  333. };
  334. #define STR_CABINET_ROLE_NONE "Single"
  335. #define STR_CABINET_ROLE_MASTER "Master"
  336. #define STR_CABINET_ROLE_SLAVE "Slave"
  337. enum _CABINET_ROLE
  338. {
  339. _CROLE_SINGLE = 0, // single power cabinet mode
  340. _CROLE_MASTER = 1, // power cabinet master mode
  341. _CROLE_SLAVE = 2, // power cabinet slave mode
  342. };
  343. typedef union
  344. {
  345. unsigned int CtrlValue;
  346. struct
  347. {
  348. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  349. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  350. unsigned int NeedSoftReset:1; // 0: no effect, 1: system need soft reset
  351. unsigned int NeedHardReset:1; // 0: no effect, 1: system need hard reset
  352. unsigned int PrimaryDisable:1; // 0: primary enable, 1: primary disable
  353. unsigned int RelayBoardDisable:1; // 0: relay board enable, 1: relay board disable
  354. unsigned int FanBoardDisable:1; // 0: fan board enable, 1: fan board disable
  355. unsigned int LedBoardDisable:1; // 0: led board enable, 1: led board disable
  356. unsigned int SecondRelayBoardEnable:1; // 0: second relay disable, 1: second relay enable
  357. unsigned int DOLedIndication:1; // 0: no led indication, 1: enable DO Model led indication
  358. unsigned int DKLedIndication:1; // 0: no led indication, 1: enable DK Model led indication
  359. unsigned int BackendEnable:1; // 0: backend disable, 1: backend enable
  360. unsigned int Wifi4gResetEnable:1; // 0: wifi/4g reset io disable, 1: wifi/4g reset io enable
  361. unsigned int PsuInit:1; // 0: no effect, 1: psu is initialized
  362. unsigned int Enable6ParallelRelay:1; // 0: no effect, 1: enable 6 parallel relay
  363. unsigned int FlashConfigChanged:1; // 0: no effect, 1: flash content has changed
  364. unsigned int WriteFlashEnable:1; // 0: no effect, 1: enable write flash after timeout
  365. unsigned int WriteFlashBusy:1; // 0: no effect, 1: flash is writing
  366. unsigned int WriteFlashImmediately:1; // 0: no effect, 1: write flash immediately
  367. unsigned int WriteFlashAndReset:1; // 0: no effect, 1: write flash and soft reset
  368. unsigned int res:12;
  369. }bits;
  370. }SystemControl;
  371. typedef union
  372. {
  373. unsigned int LibValue;
  374. struct
  375. {
  376. unsigned int InfyPwrLib:1; // 0: no effect, 1: infy pwr lib used
  377. unsigned int PhPwrLib:1; // 0: no effect, 1: phihong pwr lib used
  378. unsigned int res:30;
  379. }bits;
  380. }LibUse;
  381. typedef union
  382. {
  383. unsigned int CtrlValue;
  384. struct
  385. {
  386. unsigned int DisableBalance:1; // 0: no effect, 1: disable announce balance
  387. unsigned int FastStandbyTime:1; // 0: no effect, 1: enable fast standby time
  388. unsigned int ChargingSimulation:1; // 0: no effect, 1: enable charging simulation
  389. unsigned int FChargingReleaseExtend:1; // 0: no effect, 1: enable Release and Extend when Force Charging
  390. unsigned int TryUndisposedBill:1; // 0: no effect, 1: enable TryUndisposedBill
  391. unsigned int res:27;
  392. }bits;
  393. }TestControl;
  394. typedef union
  395. {
  396. unsigned int CtrlValue;
  397. struct
  398. {
  399. unsigned int MsgMain:1; // 0: no effect, 1: enable debug message in main
  400. unsigned int MsgPrimaryComm:1; // 0: no effect, 1: enable debug message in primary comm
  401. unsigned int MsgPsu:1; // 0: no effect, 1: enable debug message in psu
  402. unsigned int MsgEvComm:1; // 0: no effect, 1: enable debug message in ev comm
  403. unsigned int MsgInternalComm:1; // 0: no effect, 1: enable debug message in internal comm
  404. unsigned int res:27;
  405. }bits;
  406. }DebugControl;
  407. #define MAX_EVCOMM_DEBUG_LEN 4
  408. typedef union
  409. {
  410. unsigned int DebugVal[MAX_EVCOMM_DEBUG_LEN];
  411. struct
  412. {
  413. // DebugVal[0]
  414. unsigned int RegDbg_All:1;
  415. unsigned int RegDbg_ModelName:1;
  416. unsigned int RegDbg_ConnectorID:1;
  417. unsigned int RegDbg_PowerCabinetStatus:1;
  418. unsigned int RegDbg_DispenserStatus:1;
  419. unsigned int RegDbg_ChargingCapability:1;
  420. unsigned int RegDbg_ChargingTarget:1;
  421. unsigned int RegDbg_SoftwareUpdate:1;
  422. unsigned int RegDbg_PlugInStatus:1;
  423. unsigned int RegDbg_ConnectorState:1;
  424. unsigned int RegDbg_UserID:1;
  425. unsigned int RegDbg_Charging_Permission:1;
  426. unsigned int RegDbg_MiscControl:1;
  427. unsigned int RegDbg_DispenserCsuVersion:1;
  428. unsigned int RegDbg_DispenserOtherVersion:1;
  429. unsigned int RegDbg_ChargingInfo:1;
  430. unsigned int RegDbg_QRCodeDate:1;
  431. unsigned int RegDbg_WaitPlugIn:1;
  432. unsigned int RegDbg_GroundFaultDetection:1;
  433. unsigned int RegDbg_Cabinet_CSU_Version:1;
  434. unsigned int RegDbg_Cabinet_Other_Version:1;
  435. unsigned int RegDbg_PsuQuantity:1;
  436. unsigned int RegDbg_PsuVersion:1;
  437. unsigned int RegDbg_Reservation:1;
  438. unsigned int RegDbg_Dispenser_Request:1;
  439. unsigned int RegDbg_RemoteStartNoIDState:1;
  440. unsigned int RegDbg_RefundAmount:1;
  441. unsigned int RegDbg_PrepaymentInfo:1;
  442. unsigned int RegDbg_PaymentFailReason:1;
  443. unsigned int RegDbg_ConnectorQRCode:1;
  444. unsigned int RegDbg_StationInfo:1;
  445. unsigned int RegDbg_DeductResult:1;
  446. // DebugVal[1]
  447. unsigned int RegDbg_CabinetSystemID:1;
  448. unsigned int RegDbg_DefaultPriceString:1;
  449. unsigned int RegDbg_UserPriceString:1;
  450. unsigned int RegDbg_Receipt:1;
  451. unsigned int RegDbg_PowerConsumption:1;
  452. unsigned int RegDbg_ChargingTimestamp:1;
  453. unsigned int res:26;
  454. // DebugVal[2]
  455. unsigned int DebugVal2:32;
  456. // DebugVal[3]
  457. unsigned int DebugVal3:32;
  458. }bits;
  459. }DebugEvCommMsgFlag;
  460. typedef union
  461. {
  462. unsigned int DebugVal;
  463. struct
  464. {
  465. // DebugVal[0]
  466. unsigned int MsgId_None:1;
  467. unsigned int MsgId_Gun_1:1;
  468. unsigned int MsgId_Gun_2:1;
  469. unsigned int MsgId_Gun_3:1;
  470. unsigned int MsgId_Gun_4:1;
  471. unsigned int MsgId_Gun_5:1;
  472. unsigned int MsgId_Gun_6:1;
  473. unsigned int MsgId_Gun_7:1;
  474. unsigned int MsgId_Gun_8:1;
  475. unsigned int res:23;
  476. }bits;
  477. }DebugEvCommIdFlag;
  478. typedef struct
  479. {
  480. DebugEvCommMsgFlag MsgFlag;
  481. DebugEvCommIdFlag IdFlag;
  482. }EvCommCtrlInfo;
  483. typedef union
  484. {
  485. unsigned int CtrlValue;
  486. struct
  487. {
  488. unsigned int EnableForceCharging:1; // 0: disable, 1: enable force charging
  489. unsigned int StartForceCharging:1; // 0: disable, 1: start force charging
  490. unsigned int EnableReleaseAndExtend:1; // 0: disable, 1: enable Release And Extend when force charging
  491. unsigned int WebApiTrigger:1; // 0: no effect, 1: force charging is triggered by web api
  492. unsigned int res:28;
  493. }bits;
  494. }ForceChargingControl;
  495. typedef struct
  496. {
  497. ForceChargingControl FCtrl;
  498. unsigned short FTargetVoltage; // target voltage, unit: 0.1V
  499. unsigned short FTargetCurrent; // target current, unit: 0.1A
  500. }ForceCharging;
  501. typedef union
  502. {
  503. unsigned int AuthFlag;
  504. struct
  505. {
  506. unsigned int APPEnable:1; // 0: disable, 1: app auth enable
  507. unsigned int QRCodeEnable:1; // 0: disable, 1: qr code auth enable
  508. unsigned int RFIDEnable:1; // 0: disable, 1: rfid auth enable
  509. unsigned int res:29;
  510. }bits;
  511. }AuthModeInfo;
  512. typedef struct
  513. {
  514. AuthModeInfo AuthMode;
  515. unsigned char QRCodeMode; // 0: default, 1: customized, 2: audi type
  516. unsigned char res[3];
  517. }SystemAuthInfoData;
  518. typedef union
  519. {
  520. unsigned int CtrlValue;
  521. struct
  522. {
  523. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  524. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  525. unsigned int Paused:1; // 0: no effect, 1: primary paused
  526. unsigned int DisableDoorSensor:1; // 0: door sensor enable, 1: door sensor disable
  527. unsigned int DisableEmergencyButton:1; // 0: emergency button enable, 1: emergency button disable
  528. unsigned int DoorSensorReverse:1; // 0: the same as ds's, 1: status is different from ds's
  529. unsigned int AcContactorReverse:1; // 0: the same as ds's, 1: status is different from ds's
  530. unsigned int CabinetSwitchDetect:1; // 0: no effect, 1: need detect cabinet switch
  531. unsigned int res:24;
  532. }bits;
  533. }PrimaryControl;
  534. typedef union
  535. {
  536. unsigned int CtrlValue;
  537. struct
  538. {
  539. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  540. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  541. unsigned int Paused:1; // 0: no effect, 1: relay paused
  542. unsigned int AbnormalRelay:1; // 0: no effect, 1: relay abnormal control enable
  543. unsigned int AcContactor:1; // 0: ac contactor off, 1: ac contactor on
  544. unsigned int AcContactorOffByPsu:1; // 0: no effect, 1: ac contactor off
  545. unsigned int AcContactorOffByEmergency:1; // 0: no effect, 1: ac contactor off
  546. unsigned int StandbyCountdown:1; // 0: charger is using, 1: start countdown
  547. unsigned int AcInputDisable:1; // 0: ac input enable, 1: ac input disable
  548. unsigned int DcInputEnable:1; // 0: dc input disable, 1: dc input enable
  549. unsigned int AutoTest:1; // 0: no effect, 1: relay auto test enable
  550. unsigned int res:21;
  551. }bits;
  552. }RelayControl;
  553. typedef union
  554. {
  555. unsigned int CtrlValue;
  556. struct
  557. {
  558. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  559. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  560. unsigned int Paused:1; // 0: no effect, 1: fan paused
  561. unsigned int AbnormalFan:1; // 0: no effect, 1: fan abnormal control enable
  562. unsigned int res:28;
  563. }bits;
  564. }FanControl;
  565. typedef union
  566. {
  567. unsigned int CtrlValue;
  568. struct
  569. {
  570. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  571. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  572. unsigned int Paused:1; // 0: no effect, 1: led paused
  573. unsigned int res:29;
  574. }bits;
  575. }LedFanControl;
  576. typedef union
  577. {
  578. unsigned int CtrlValue;
  579. struct
  580. {
  581. unsigned int SelfTestOK:1; // 0: self test not completed, 1: self test ok
  582. unsigned int NeedSelfTest:1; // 0: no effect, 1: need execute self test
  583. unsigned int Paused:1; // 0: no effect, 1: psu paused
  584. unsigned int FailureResume:1; // 0: no error, 1: psu failure, need resume
  585. unsigned int CommunicationLost:1; // 0: no error, 1: psu communication lost
  586. unsigned int res:27;
  587. }bits;
  588. }PsuControl;
  589. enum _OCPP_PAGE_INDEX
  590. {
  591. _OCPP_Page_None = 0, // page none
  592. _OCPP_Page_LineStatus_1 = 1, // line status 1 page
  593. _OCPP_Page_LineStatus_2 = 2, // line status 2 page
  594. _OCPP_Page_LineStatus_3 = 3, // line status 3 page
  595. _OCPP_Page_LineStatus_4 = 4, // line status 4 page
  596. };
  597. typedef union
  598. {
  599. unsigned int CtrlValue;
  600. struct
  601. {
  602. unsigned int RemoteStartNoId:1; // 0: no effect, 1: trigger remote start without connector id
  603. unsigned int res:31;
  604. }bits;
  605. }OcppControl;
  606. typedef struct
  607. {
  608. int TxCnt;
  609. int RxCnt;
  610. int LostCnt;
  611. int CommCnt;
  612. }DevideCommInfo;
  613. typedef struct
  614. {
  615. DevideCommInfo PrimaryComm;
  616. DevideCommInfo Relay1Comm;
  617. DevideCommInfo Relay2Comm;
  618. DevideCommInfo FanComm;
  619. DevideCommInfo LedComm;
  620. DevideCommInfo PsuComm;
  621. }CommInfoData;
  622. typedef union
  623. {
  624. unsigned int CtrlValue;
  625. struct
  626. {
  627. unsigned int UpdateReq:1; // 0: no effect, 1: update request
  628. unsigned int UpdateConfirm:1; // 0: no effect, 1: update confirm
  629. unsigned int UpdateDone:1; // 0: no effect, 1: update done
  630. unsigned int res:29;
  631. }bits;
  632. }UpdateControl;
  633. typedef struct
  634. {
  635. int Pri232Fd;
  636. int Rs422Fd;
  637. int PsuCanFd;
  638. int EvCanFd;
  639. }FdControl;
  640. typedef struct
  641. {
  642. unsigned char MaxDispenser;
  643. unsigned char MaxConnector;
  644. unsigned char CabinetSwitch;
  645. unsigned char CabinetRole;
  646. unsigned char SelfTestStep;
  647. unsigned char CustomerCode;
  648. unsigned short ChargerRatingPower; // unit: 0.1kw, charger rating power, parsing from model name
  649. unsigned char PsuQuantityByModel;
  650. unsigned char res;
  651. CommInfoData CommInfo;
  652. SystemControl SysCtrl;
  653. LibUse LibCtrl;
  654. UpdateControl UpdateCtrl;
  655. TestControl TestCtrl;
  656. DebugControl DebugCtrl;
  657. EvCommCtrlInfo EvCommCtrl;
  658. PrimaryControl PrimaryCtrl;
  659. RelayControl RelayCtrl;
  660. FanControl FanCtrl;
  661. LedFanControl LedCtrl;
  662. PsuControl PsuCtrl;
  663. OcppControl OcppCtrl;
  664. FdControl FdCtrl;
  665. ForceCharging FCharging[MAX_GROUP_QUANTITY];
  666. unsigned char GunAvailable[MAX_GROUP_QUANTITY];
  667. unsigned char PsuInitQuantity[MAX_GROUP_QUANTITY];
  668. char ResevedIdTag[MAX_GROUP_QUANTITY][32];
  669. }SysControl;
  670. // ************************************************************************************************* //
  671. typedef struct
  672. {
  673. bool CheckIn;
  674. unsigned char res;
  675. unsigned short Full_Address;
  676. unsigned char GroupNo;
  677. unsigned char GIndex;
  678. }PsuAddressInfoData;
  679. typedef struct
  680. {
  681. unsigned char GroupPsuQuantity;
  682. unsigned char res;
  683. unsigned short PsuIndex[MAX_MODULE_PER_GROUP];
  684. }GroupInfoData;
  685. #define PSU_STATUS_FLAG_OUTPUT 0x00000001
  686. #define PSU_STATUS_FLAG_FAULT 0x00000002
  687. #define PSU_STATUS_FLAG_ALARM 0x00000004
  688. #define PSU_STATUS_FLAG_LOCK 0x00000008
  689. typedef union
  690. {
  691. unsigned int StatusVal;
  692. struct
  693. {
  694. unsigned int Output:1; // 0: no output, 1: psu is output
  695. unsigned int Fault:1; // 0: no fault, 1: psu is fault
  696. unsigned int Alarm:1; // 0: no alarm, 1: psu is alarm
  697. unsigned int Lock:1; // 0: no lock, 1: psu is lock
  698. unsigned int res:28;
  699. }bits;
  700. }PsuStatusInfo;
  701. typedef union
  702. {
  703. unsigned int StatusVal;
  704. struct
  705. {
  706. unsigned int Changed:1; // 0: no output, 1: psu is output
  707. unsigned int res:31;
  708. }bits;
  709. }PsuErrorStatusInfo;
  710. typedef struct
  711. {
  712. int ErrorCount;
  713. PsuErrorStatusInfo ErrFlag;
  714. unsigned char PsuError[8];
  715. }PsuErrorCodeInfo;
  716. typedef struct
  717. {
  718. bool PsuLocationInit;
  719. bool ReInitPsuLocation;
  720. unsigned char TotalPsuQuantity;
  721. GroupInfoData GroupLocationInfo[MAX_GROUP_QUANTITY];
  722. PsuAddressInfoData PsuAddressInfo[MAX_PSU_MODULE_QUANTITY];
  723. PsuStatusInfo SinglePsuStatus[MAX_PSU_MODULE_QUANTITY];
  724. PsuErrorCodeInfo SinglePsuError[MAX_PSU_MODULE_QUANTITY];
  725. }PsuPositionInfoData;
  726. // ************************************************************************************************* //
  727. typedef enum
  728. {
  729. _GROLE_IDLE = 0,
  730. _GROLE_MASTER = 1,
  731. _GROLE_SLAVE = 2,
  732. _GROLE_PREPARE_SWITCH_OFF = 10, // reduce output current capability
  733. _GROLE_SLAVE_POWER_OFF = 11, // power off
  734. _GROLE_SWITCH_OFF_OK = 12, // power off completed
  735. _GROLE_WAIT_IDLE = 13, // wait a while to change to idle, open parallel relay at this state
  736. _GROLE_WAIT_SLAVE = 14, // wait a while to change to slave
  737. _GROLE_PREPARE_ATTACH_ON = 20, // raise voltage to master output voltage
  738. _GROLE_PRECHARGE_READY = 21, // extend pre-charge ready
  739. _GROLE_EXTEND_STOP = 22, // extend capability stop
  740. _GROLE_REQUEST_TO_CHARGING = 30,
  741. _GROLE_TERMINATE = 40,
  742. _GROLE_WAIT_TERMINATED = 41,
  743. _GROLE_NONE = 99,
  744. }_GROUP_ROLE;
  745. typedef union
  746. {
  747. unsigned int CtrlValue[6];
  748. struct
  749. {
  750. unsigned int IdleCtrlValue;
  751. unsigned int MasterCtrlValue;
  752. unsigned int StopChargingCtrlValue;
  753. unsigned int DeratingCtrlValue;
  754. unsigned int ExtendCapabilityCtrlValue;
  755. unsigned int SlaveCtrlValue;
  756. }RoleCtrl;
  757. struct
  758. {
  759. // IdleCtrlValue
  760. unsigned int ChargingRequest:1; // 0: no effect, 1: charging request from main.c
  761. unsigned int ChargingRequestConfirmed:1; // 0: no effect, 1: request confirmed by psu task
  762. unsigned int GroupShareCheck:1; // 0: no effect, 1: check is there any psu can share
  763. unsigned int ShareConfirmed:1; // 0: no effect, 1: psu share confirmed
  764. unsigned int GrabGroupWait:1; // 0: no effect, 1: need to wait grab psu
  765. unsigned int ShareCheckDone:1; // 0: no effect, 1: psu share completed
  766. unsigned int FindGroupPartner:1; // 0: no effect, 1: find available group partner
  767. unsigned int ParallelRelayOn:1; // 0: no effect, 1: set parallel relay on
  768. unsigned int ParallelRelayConfirmed:1; // 0: no effect, 1: parallel relay confirmed
  769. unsigned int GroupingDone:1; // 0: no effect, 1: grouping completed
  770. unsigned int IdleCtrlRes:22;
  771. // MasterCtrlValue
  772. unsigned int CableCheckDone:1; // 0: no effect, 1: CableCheck done
  773. unsigned int InPrechargeMode:1; // 0: no effect, 1: system status in PreCharge mode
  774. unsigned int AlreadyInChargingMode:1; // 0: no effect, 1: system status ever enter charging mode
  775. unsigned int ExtendAvailable:1; // 0: no effect, 1: extend capability is available
  776. unsigned int NeedCurrentBalance:1; // 0: no effect, 1: need to current balance
  777. unsigned int OutputCurrentStable:1; // 0: no effect, 1: output current is stable
  778. unsigned int ReachMaxCurrentDemand:1; // 0: no effect, 1: reach ev max current demand
  779. unsigned int ReachMaxStageCurrent:1; // 0: no effect, 1: reach ev max stage current
  780. unsigned int SmoothDerating:1; // 0: no effect, 1: start smooth derating
  781. unsigned int MasterCtrlRes:23;
  782. // StopChargingCtrlValue
  783. unsigned int StopChargingRequest:1; // 0: no effect, 1: master need to stop
  784. unsigned int StopChargingConfirmed:1; // 0: no effect, 1: stop charging confirmed
  785. unsigned int AllPowerOffDone:1; // 0: no effect, 1: all member power off done
  786. unsigned int AllParallelRelayOff:1; // 0: no effect, 1: all member's parallel relay off
  787. unsigned int AllParallelRelayConfirmed:1; // 0: no effect, 1: all member's parallel relay off confirmed
  788. unsigned int AllMemberStopCompleted:1; // 0: no effect, 1: all member stop completed
  789. unsigned int StopChargingCompleted:1; // 0: no effect, 1: stop charging completed
  790. unsigned int StopChargingCtrlRes:25;
  791. // DeratingCtrlValue
  792. unsigned int NeedDerating:1; // 0: no effect, 1: need derating
  793. unsigned int DeratingConfirmed:1; // 0: no effect, 1: derating confirmed
  794. unsigned int DeratingStart:1; // 0: no effect, 1: derating start
  795. unsigned int DeratingPowerOffDone:1; // 0: no effect, 1: derating member power off done
  796. unsigned int DeratingRelayOff:1; // 0: no effect, 1: set derating member parallel relay off
  797. unsigned int DeratingRelayConfirmed:1; // 0: no effect, 1: derating member parallel relay confirmed
  798. unsigned int DeratingCompleted:1; // 0: no effect, 1: derating completed
  799. unsigned int DeratingCtrlRes:25;
  800. // ExtendCapabilityCtrlValue
  801. unsigned int MorePowerRequest:1; // 0: no effect, 1: need to request more psu
  802. unsigned int MorePowerConfirmed:1; // 0: no effect, 1: request more psu confirmed
  803. unsigned int ExtendPrecharge:1; // 0: no effect, 1: extend group need to pre-charge
  804. unsigned int ExtendPrechargeDone:1; // 0: no effect, 1: extend group pre-charge completed
  805. unsigned int ExtendRelayOn:1; // 0: no effect, 1: extend group parallel relay on
  806. unsigned int ExtendRelayConfirmed:1; // 0: no effect, 1: extend group parallel relay confirmed
  807. unsigned int ExtendCompleted:1; // 0: no effect, 1: extend capability completed
  808. unsigned int ExtendCapabilityCtrlRes:25;
  809. // SlaveCtrlValue
  810. unsigned int SlaveChargingRequest:1; // 0: no effect, 1: request slave to charging after power off
  811. unsigned int CheckSlaveReady:1; // 0: no effect, 1: check if slave is ready
  812. unsigned int WaitSlaveReady:1; // 0: no effect, 1: wait slave is ready
  813. unsigned int SlavePowerOffRequest:1; // 0: no effect, 1: request slave to power off
  814. unsigned int SlavePowerOffConfirmed:1; // 0: no effect, 1: slave power off confirmed
  815. unsigned int SlaveCtrlRes:27;
  816. }bits;
  817. }PsuGroupControl;
  818. typedef struct
  819. {
  820. unsigned char Quantity;
  821. unsigned char RealQuantity;
  822. unsigned char Member[MAX_GROUP_QUANTITY]; // record slave group index
  823. unsigned short ParallelFlag[MAX_GROUP_QUANTITY];
  824. }PsuGroupPartner;
  825. typedef struct
  826. {
  827. unsigned short Voltage; // output voltage limit, unit: 0.1V
  828. unsigned short Current; // output current limit, unit: 0.1A
  829. unsigned short Power; // output power limit, unit: 0.1kw
  830. }PsuGroupOutputValue;
  831. typedef struct
  832. {
  833. unsigned char Index;
  834. unsigned char Role;
  835. unsigned char PreRole;
  836. unsigned char Location;
  837. PsuGroupPartner Partner; // record slave group information
  838. PsuGroupPartner PossibleMember; // record possible slave group information
  839. unsigned char TargetGroup; // target group index + 1
  840. unsigned char ReservedTarget; // reserved target group index + 1
  841. unsigned char SmoothDeratingTarget; // group index + 1
  842. unsigned char res; // reserved
  843. PsuGroupControl GroupCtrl;
  844. unsigned short ReAssignAvailableCurrent; // group available current when reassign, unit: 0.1A
  845. unsigned short ParallelCheck;
  846. unsigned char ParallelConfig[MAX_GROUP_QUANTITY]; // group parallel relay setting
  847. unsigned short GunLoading; // gun output loading, unit: 0.01%
  848. unsigned char GunPsuQuantity; // record psu quantity at this gun
  849. unsigned char ExtendQuantityLimit; // limit of extend psu group quantity
  850. float MaxOutputRatio; // max output ratio (gun psu quantity / total psu in using)
  851. float DiffPower_Capability; // unit: 1kW, different power between output power and Capability power
  852. float DiffPower_Available; // unit: 1kW, different power between output power and Available power
  853. float DiffPower_PhysicalLimit; // unit: 1kW, different power between output power and PhysicalLimit power
  854. }PsuGroupCollectionData;
  855. typedef struct
  856. {
  857. unsigned short GTargetVoltage; // group target voltage config, unit: 0.1V
  858. unsigned short GTargetCurrent; // group target current config, unit: 0.1A
  859. unsigned short OutputLoading; // group output loading, unit: 0.01%
  860. }GroupOutputConfigInfo;
  861. typedef union
  862. {
  863. unsigned short CtrlValue;
  864. struct
  865. {
  866. unsigned short Output_N:1; // 0: set Output_N off, 1: set Output_N on
  867. unsigned short Output_P:1; // 0: set Output_P off, 1: set Output_P on
  868. unsigned short res:14;
  869. }bits;
  870. }PsuGroupOutputRelay;
  871. typedef union
  872. {
  873. unsigned short CtrlValue;
  874. struct
  875. {
  876. unsigned short Location_1_2:1; // 0: set parallel off, 1: set parallel on
  877. unsigned short Location_2_3:1; // 0: set parallel off, 1: set parallel on
  878. unsigned short Location_3_4:1; // 0: set parallel off, 1: set parallel on
  879. unsigned short Location_4_1:1; // 0: set parallel off, 1: set parallel on
  880. unsigned short Location_4_2:1; // 0: set parallel off, 1: set parallel on
  881. unsigned short Location_3_1:1; // 0: set parallel off, 1: set parallel on
  882. unsigned short res:10;
  883. }bits;
  884. }PsuGroupParallelRelay;
  885. typedef struct
  886. {
  887. byte Location[MAX_GROUP_QUANTITY];
  888. byte Layout[MAX_GROUP_QUANTITY];
  889. PsuGroupCollectionData GroupCollection[MAX_GROUP_QUANTITY];
  890. GroupOutputConfigInfo GroupOutput[MAX_GROUP_QUANTITY]; // for individual group command
  891. GroupOutputConfigInfo TotalGroupOutput[MAX_GROUP_QUANTITY]; // for total group command
  892. PsuGroupOutputRelay OutputRelayConfig[MAX_GUN_QUANTITY];
  893. PsuGroupOutputRelay OutputRelayConfirmed[MAX_GUN_QUANTITY];
  894. PsuGroupParallelRelay ParallelRelayConfig;
  895. PsuGroupParallelRelay ParallelRelayConfirmed;
  896. PsuStatusInfo GroupPsuStatus_OR[MAX_GROUP_QUANTITY];
  897. PsuStatusInfo GroupPsuStatus_AND[MAX_GROUP_QUANTITY];
  898. }PsuGroupingInfoData;
  899. // ************************************************************************************************* //
  900. typedef enum
  901. {
  902. _SCONN_FREE = 0,
  903. _SCONN_WAIT = 1,
  904. _SCONN_MATCHED = 2,
  905. }_SOCKET_CONN_STATUS;
  906. typedef enum
  907. {
  908. _DeviceStatus_DisConnect = 0x00, // _DS_None , slave cabinet in re-connection
  909. _DeviceStatus_Identification = 0x01, // _DS_Identification , slave cabinet in identification
  910. _DeviceStatus_Idle = 0x02, // _DS_Idle , slave cabinet in idle
  911. _DeviceStatus_Alarm = 0x03, // _DS_Alarm , slave cabinet in alarm
  912. _DeviceStatus_Charging = 0x04, // _DS_Charging , no use in slave cabinet
  913. _DeviceStatus_Timeout = 0x05, // _DS_Timeout , no use in slave cabinet
  914. _DeviceStatus_RetryWait = 0x06,
  915. }_DEVICE_STATUS;
  916. typedef enum
  917. {
  918. _Parallel_None = 0,
  919. _Parallel_Wait = 1, // ac contactor off, 3s
  920. _Parallel_Working = 2, // ac contactor on and start re-initial psu
  921. _Parallel_Done = 3, // re-initial psu done
  922. }_PARALLEL_STATUS;
  923. typedef struct
  924. {
  925. unsigned char Status; // 0: free, 1: WaitModelName, 2: DispenserMatched
  926. unsigned char DeviceIndex; // record device index
  927. unsigned int IpAddress; // record device ip address
  928. unsigned char DuplicateIp; // 0: unique ip, 1: duplicate ip
  929. unsigned char res;
  930. }SocketConnInfoData;
  931. typedef struct
  932. {
  933. unsigned char LocalStatus; // 0: None, 1: Identification, 2: Idle, 3: Alarm, 4: Charging, 5: _DS_Timeout
  934. unsigned char SlaveID;
  935. unsigned char ModelName[64]; //charger model name
  936. unsigned char SerialNumber[64]; //charger system serial number
  937. unsigned char SystemId[128]; //charger system ID
  938. unsigned char CsuBootLoadFwRev[32]; //CSU board bootloader firmware version
  939. unsigned char CsuKernelFwRev[32]; //CSU board OS kernel firmware version
  940. unsigned char CsuRootFsFwRev[32]; //CSU board root file system firmware version
  941. unsigned char CsuPrimFwRev[32]; //CSU board root file system firmware version
  942. unsigned char LcmFwRev[32]; //LCM module firmware version
  943. unsigned char PsuPrimFwRev[32]; //PSU primary firmware version
  944. unsigned char PsuSecFwRev[32]; //PSU secondary firmware version
  945. unsigned char FanModuleFwRev[32]; //Fan module firmware version
  946. unsigned char RelayModuleFwRev[32]; //Relay control module firmware version
  947. unsigned char TelcomModemFwRev[32]; //the 3G/4G modem firmware version
  948. unsigned char LedModuleFwRev[32]; //LED control module firmware version
  949. unsigned char Connector1FwRev[32]; //Connector1 module firmware version
  950. unsigned char Connector2FwRev[32]; //Connector2 module firmware version
  951. unsigned char AcContactorSetting; // 0: OFF, 1: ON Master -> Slave
  952. unsigned char AcContactorState; // 0: OFF, 1: ON Slave -> Master
  953. unsigned char OutputRelaySetting[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Master -> Slave
  954. unsigned char GunOutputRelayState[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Slave -> Master
  955. unsigned char ParallelRelaySetting[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Master -> Slave
  956. unsigned char ParallelRelayState[MAX_GROUP_QUANTITY]; // 0: OFF, 1: ON Slave -> Master
  957. unsigned char UpdateRequest; // 0: no effect, 1: need to update
  958. unsigned char res;
  959. char FwFileName[128];
  960. unsigned char SocketChannel; // record socket index
  961. unsigned char IpDuplicatedFlag; // 0: no effect, 1: ip is duplicated
  962. unsigned char ParallelRequest; // 0: no effect, 1: parallel request
  963. unsigned char ParallelConfirm; // 0: no effect, 1: parallel confirm
  964. unsigned short ParallelPower; // parallel power, unit: 0.1kw
  965. }SlaveCabinetInfoData;
  966. typedef struct
  967. {
  968. unsigned char ParallelStatus; // 0: parallel none, 1: wait, 2: in paralleling, 3: parallel done
  969. unsigned char ParallelCabinetQuantity; // record max dispenser quantity
  970. unsigned char PresentParallelCabinetQuantity; // present slave cabinet quantity
  971. unsigned char res;
  972. SlaveCabinetInfoData PCabinet[MAX_SLAVE_CABINET_QUANTITY];
  973. unsigned char PCUpdateState[MAX_SLAVE_CABINET_QUANTITY]; // 0: Not in Update, 1: Updating, 2: Updated
  974. unsigned short TotalParallelPower; // max total parallel power, unit: 0.1kw
  975. }ParallelCabinetInfoData;
  976. typedef struct
  977. {
  978. unsigned char SCabinetStatus;
  979. unsigned char SCabinetID;
  980. unsigned char SOutputRelay[MAX_GROUP_QUANTITY]; // parallel cabinet output relay state
  981. unsigned char SParallelRelay[MAX_GROUP_QUANTITY]; // parallel cabinet parallel relay state
  982. unsigned char SAcContactor; // slave cabinet ac contactor state
  983. unsigned char NeedUpgrade; // 1: Need Upgrade, 2: No Update
  984. unsigned char UpgradeState; // 0: Not in Update, 1: Updating, 2: Updated
  985. unsigned char res;
  986. char FwFileName[128];
  987. }SlaveCabinetControl;
  988. // ************************************************************************************************* //
  989. #define LCM_REQ_REMOTE_START_NO_ID 0x00000001
  990. typedef union
  991. {
  992. unsigned int CtrlValue;
  993. struct
  994. {
  995. // cabinet -> connector
  996. unsigned int RemoteStartNoID:1; // 0: no request, 1: lcm page change to RemoteStartNoID
  997. unsigned int res:31;
  998. }bits;
  999. }ConnectorPageControl;
  1000. #define MISC_DISP_CONNECTION_TIMEOUT 0x00000001
  1001. #define MISC_DISP_DEFAULT_PRICE 0x00000002
  1002. #define MISC_DISP_CURRENCY 0x00000004
  1003. #define MISC_DISP_BACKEND_STATUS 0x00000008
  1004. #define MISC_DISP_ETHERNET_STATUS 0x00000010
  1005. #define MISC_DISP_WIFI_STATUS 0x00000020
  1006. #define MISC_DISP_TELCOM_MODEM_STATUS 0x00000040
  1007. #define MISC_DISP_BILLING_STATUS 0x00000080
  1008. #define MISC_DISP_STOP_BUTTON_STATUS 0x00000100
  1009. #define MISC_DISP_AUTH_MODE_CONFIG 0x00000200
  1010. #define MISC_DISP_EVCCID_CONFIG 0x00000400
  1011. #define MISC_DISP_LED_INTENSITY 0x00000800
  1012. #define MISC_DISP_HARDWARE_REBOOT 0x00001000
  1013. #define MISC_DISP_SOFTWARE_RESET 0x00002000
  1014. #define MISC_DISP_CHANGE_LCM_INFO 0x00004000
  1015. #define MISC_DISP_STATION_INFO 0x00008000
  1016. #define MISC_DISP_TIME_OFFSET 0x00010000
  1017. #define MISC_DISP_DEFAULT_PRICE_STRING 0x00020000
  1018. #define MISC_DISP_PARKING_PRICE 0x00040000
  1019. #define MISC_DISP_RFID_CARD_ENDIAN 0x00080000
  1020. #define MISC_DISP_RFID_ENABLE 0x00100000
  1021. typedef union
  1022. {
  1023. unsigned int CtrlValue;
  1024. struct
  1025. {
  1026. // cabinet -> dispenser
  1027. unsigned int ConnectionTimeout:1; // msic: 0x0001, 0: no request, 1: connection timeout request
  1028. unsigned int DefaultPrice:1; // msic: 0x0003, 0: no request, 1: default price request
  1029. unsigned int Currency:1; // msic: 0x0004, 0: no request, 1: currency request
  1030. unsigned int BackendStatus:1; // msic: 0x0006, 0: no request, 1: backend status request
  1031. unsigned int EthernetStatus:1; // msic: 0x0007, 0: no request, 1: ethernet status request
  1032. unsigned int WiFiStatus:1; // msic: 0x0008, 0: no request, 1: wifi status request
  1033. unsigned int TelcomModemStatus:1; // msic: 0x0009, 0: no request, 1: telcom modem status request
  1034. unsigned int BillingStatus:1; // msic: 0x000A, 0: no request, 1: billing status request
  1035. unsigned int StopButtonStatus:1; // msic: 0x000B, 0: no request, 1: stop button status request
  1036. unsigned int AuthModeConfig:1; // msic: 0x000C, 0: no request, 1: auth mode config request
  1037. unsigned int EVCCIDConfig:1; // msic: 0x000D, 0: no request, 1: EVCCID config request
  1038. unsigned int LEDIntensity:1; // msic: 0x000E, 0: no request, 1: led intensity request
  1039. unsigned int HardwareReboot:1; // msic: 0x0101, 0: no request, 1: hardware reboot request
  1040. unsigned int SoftwareReset:1; // msic: 0x0102, 0: no request, 1: software reset request
  1041. unsigned int ChangeLcmInfo:1; // msic: 0x0107, 0: no request, 1: change lcm info request
  1042. unsigned int ChargerStationInfo:1; // msic: 0x0109, 0: no request, 1: charger station info request
  1043. unsigned int TimeOffset:1; // msic: 0x0010, 0: no request, 1: time offset request
  1044. unsigned int DefaultPriceString:1; // msic: 0x0010, 0: no request, 1: default price string request
  1045. unsigned int ParkingPrice:1; // msic: 0x0011, 0: no request, 1: parking price request
  1046. unsigned int RFIDCardEndian:1; // msic: 0x0012, 0: no request, 1: RFID card endian request
  1047. unsigned int RFIDEnable:1; // msic: 0x0013, 0: no request, 1: RFID enable request
  1048. unsigned int res:11;
  1049. }bits;
  1050. }DispenserMiscControl;
  1051. #define MISC_CONN_AVAILABILITY 0x00000001
  1052. #define MISC_CONN_ACCOUNT_BALANCE 0x00000002
  1053. #define MISC_CONN_REMOTE_START 0x00000004
  1054. #define MISC_CONN_REMOTE_STOP 0x00000008
  1055. #define MISC_CONN_UNLOCK 0x00000010
  1056. #define MISC_CONN_RESERVATION 0x00000020
  1057. #define MISC_CONN_QRCODE_INFO 0x00000040
  1058. #define MISC_CONN_FINAL_COST 0x00000080
  1059. #define MISC_CONN_LINE_STATUS 0x00000100
  1060. #define MISC_CONN_USER_PRICE_STRING 0x00000200
  1061. #define MISC_CONN_RECEIPT 0x00000400
  1062. #define MISC_CONN_CHARGING_BILL 0x00000800
  1063. #define MISC_CONN_PARKING_STATUS 0x00001000
  1064. typedef union
  1065. {
  1066. unsigned int CtrlValue;
  1067. struct
  1068. {
  1069. // cabinet -> connector
  1070. unsigned int Availability:1; // msic: 0x0002, 0: no request, 1: availability request
  1071. unsigned int AccountBalance:1; // msic: 0x0005, 0: no request, 1: account balance request
  1072. unsigned int RemoteStart:1; // msic: 0x0103, 0: no request, 1: remote start request
  1073. unsigned int RemoteStop:1; // msic: 0x0104, 0: no request, 1: remote stop request
  1074. unsigned int Unlock:1; // msic: 0x0105, 0: no request, 1: unlock request
  1075. unsigned int Reservation:1; // msic: 0x0106, 0: no request, 1: reservation request
  1076. unsigned int QRCodeRequest:1; // msic: 0x0108, 0: no request, 1: QR Code request
  1077. unsigned int FinalCostRequest:1; // msic: 0x010A, 0: no request, 1: Final Cost request
  1078. unsigned int LineStatusRequest:1; // msic: 0x010B, 0: no request, 1: Line Status request
  1079. unsigned int UserPriceStringRequest:1; // msic: 0x010D, 0: no request, 1: User Price String request
  1080. unsigned int ReceiptRequest:1; // msic: 0x010E, 0: no request, 1: Receipt request
  1081. unsigned int ChargingBillRequest:1; // msic: 0x010F, 0: no request, 1: charging bill request
  1082. unsigned int ParkingStatusRequest:1; // msic: 0x0110, 0: no request, 1: parking status request
  1083. unsigned int res:19;
  1084. }bits;
  1085. }ConnectorMiscControl;
  1086. typedef struct
  1087. {
  1088. unsigned int ConnectionTimeout; // unit: 1s
  1089. float DefaultPrice; // unit: 1 (dollar/kWh)
  1090. unsigned int Currency; // currency index
  1091. unsigned int BackendStatus; // 0: disable, 1: connected, 2: disconnected
  1092. unsigned int EthernetStatus; // 0: disable, 1: connected, 2: disconnected
  1093. unsigned int WiFiStatus; // 0: disable, 1: connected, 2: disconnected
  1094. unsigned int TelcomModemStatus; // 0: disable, 1: connected, 2: disconnected
  1095. unsigned int BillingStatus; // 0: disable, 1: enable
  1096. unsigned int StopChargingButton; // 0: disable, 1: enable
  1097. unsigned int HardwareReboot; // 1: HardwareReboot, Other value: no effect
  1098. unsigned int SoftwareRestart; // 1: SoftwareRestart, Other value: no effect
  1099. unsigned int AuthModeConfig; // 0: enable, 1: disable
  1100. unsigned int EVCCIDConfig; // 0: disable, 1: enable
  1101. unsigned int LEDIntensity; // LED intensity, 0: Darkest 1: Medium 2: Brightest
  1102. int TimeOffset; // time offset value, unit: 1 minute
  1103. float ParkingPrice; // unit: 1 (dollar/minute)
  1104. unsigned int RfidEndian; // 0: little endian, 1: big endian
  1105. unsigned int RfidReaderEnable; // 0: disable, 1: enable
  1106. }MiscCommandValue;
  1107. typedef union
  1108. {
  1109. unsigned int CtrlValue;
  1110. struct
  1111. {
  1112. // dispenser -> cabinet
  1113. unsigned int ChargingCancel:1; // cmd: 0x0001, 0: no request, 1: charging cancel request
  1114. unsigned int ParkingFeeRequest:1; // cmd: 0x0002, 0: no request, 1: parking fee request
  1115. unsigned int res:30;
  1116. }bits;
  1117. }ConnectorActionFlag;
  1118. typedef union
  1119. {
  1120. unsigned int CtrlValue[32];
  1121. struct
  1122. {
  1123. // dispenser -> cabinet
  1124. unsigned int Refund; // 1: request, other: no effect
  1125. unsigned int RefundCancel; // 1: cancel, other: no effect
  1126. unsigned int InvoiceIndex; // invoice index, start from 1 ~
  1127. unsigned int Res[29];
  1128. }bits;
  1129. }ConnectorActionValue;
  1130. typedef struct
  1131. {
  1132. unsigned char ConnectorId; // Connector Id
  1133. unsigned char DeductReq; // 0: no request, 1: deduct request
  1134. unsigned char ReaderStatusReq; // 0: no request, 1: reader status request
  1135. int TransactionId;
  1136. unsigned char creditNo[20];
  1137. unsigned char DeductResult; // DeductResult, 0: Fail, 1: Pass
  1138. unsigned char IsDonateInvoice; // IsDonateInvoice, 0: Do not donate, 1: Donate
  1139. int DeductAmount; // DeductAmount, unit = 0.01 dollar
  1140. char ApprovalNumber[9]; // ApprovalNumber
  1141. char VemData[64]; // Vem Data
  1142. char Sn[36];
  1143. }DeductResultInfoData;
  1144. typedef struct
  1145. {
  1146. ConnectorActionFlag Flag;
  1147. ConnectorActionValue ActionValue;
  1148. }ConnectorActionRequest;
  1149. #define STR_WEATHER_NONE "None"
  1150. #define STR_WEATHER_SUNNY "Sunny"
  1151. #define STR_WEATHER_CLOUDY "Cloudy"
  1152. #define STR_WEATHER_RAIN "Rain"
  1153. #define STR_WEATHER_THUNDERSTORM "ThunderStorm"
  1154. #define STR_WEATHER_SNOW "Snow"
  1155. #define STR_WEATHER_MIST "Mist"
  1156. enum _WEATHER_INFO
  1157. {
  1158. _WEATHER_None = 0,
  1159. _WEATHER_Sunny = 1,
  1160. _WEATHER_Cloudy = 2,
  1161. _WEATHER_Rain = 3,
  1162. _WEATHER_ThunderStorm = 4,
  1163. _WEATHER_Snow = 5,
  1164. _WEATHER_Mist = 6,
  1165. };
  1166. typedef struct
  1167. {
  1168. int StationID;
  1169. char StationName[64];
  1170. char QRCode[MAX_GROUP_QUANTITY][128];
  1171. int WeatherID;
  1172. float Temperature;
  1173. }StationInfoData;
  1174. typedef struct
  1175. {
  1176. int StatusCode[MAX_GROUP_QUANTITY];
  1177. }LineApiStatusInfo;
  1178. typedef struct
  1179. {
  1180. int TransactionId; // connector TransactionId
  1181. float UserPrice; // connector user's user price, unit: 1 (dollar / kWh)
  1182. float TotalCost; // connector user's total cost, unit: 1 dollar
  1183. float AccountBalance; // connector user's account balance, unit: 1 dollar
  1184. float CostDiscount; // connector user's account balance, unit: 1 dollar
  1185. }TransactionInfoData;
  1186. enum DeductResult
  1187. {
  1188. _Deduct_PreAuth_Fail = 0x0, // pre-auth fail
  1189. _Deduct_PreAuth_Pass = 0x1, // pre-auth pass
  1190. _Deduct_PreAuth_Cancel = 0x2, // pre-auth cancel
  1191. _Deduct_PreAuth = 0x3, // pre-auth
  1192. _Deduct_Sale_Fail = 0x4, // sale fail
  1193. _Deduct_Sale_Pass = 0x5, // sale pass
  1194. };
  1195. #define STR_DEDUCT_FAIL "Deduct Fail"
  1196. #define STR_DEDUCT_PASS "Deduct Pass"
  1197. #define STR_DEDUCT_CANCEL "PreAuth Cancel"
  1198. #define STR_DEDUCT_PREAUTH "PreAuth OK"
  1199. #define STR_SALE_FAIL "Sale Fail"
  1200. #define STR_SALE_PASS "Sale Pass"
  1201. typedef struct
  1202. {
  1203. float CurrentRate;
  1204. float TimeOfDayPricing[24];
  1205. char DefaultPriceString[512]; // default price string
  1206. char DispenserPriceString[MAX_GUN_QUANTITY][512]; // dispenser user price string
  1207. char UserPriceString[MAX_GUN_QUANTITY][512]; // connector user price string
  1208. char ReceiptUrl[MAX_GUN_QUANTITY][512]; // connector receipt url
  1209. }PriceReceiptInfoData;
  1210. typedef enum
  1211. {
  1212. _Type_Central = 0x0,
  1213. _Type_eMAID = 0x1,
  1214. _Type_ISO14443 = 0x2,
  1215. _Type_ISO15693 = 0x3,
  1216. _Type_KeyCode = 0x4,
  1217. _Type_Local = 0x5,
  1218. _Type_MacAddress = 0x6,
  1219. _Type_NoAuthorization = 0x7,
  1220. }UserIdType;
  1221. #define STR_ID_TYPE_CENTRAL "Central"
  1222. #define STR_ID_TYPE_EMAID "eMAID"
  1223. #define STR_ID_TYPE_ISO14443 "ISO14443"
  1224. #define STR_ID_TYPE_ISO15693 "ISO15693"
  1225. #define STR_ID_TYPE_KEYCODE "KeyCode"
  1226. #define STR_ID_TYPE_LOCAL "Local"
  1227. #define STR_ID_TYPE_MAC_ADDRESS "MacAddress"
  1228. #define STR_ID_TYPE_NO_AUTHORIZATION "NoAuthorization"
  1229. typedef struct
  1230. {
  1231. float LocalConsumption; // power consumption store in cabinet
  1232. float GunConsumption; // power consumption store in dispenser
  1233. }MeterValueInfoData;
  1234. typedef struct
  1235. {
  1236. char StartCharging[32]; // start charging timestamp
  1237. char StopCharging[32]; // stop charging timestamp
  1238. }TimestampInfoData;
  1239. typedef struct
  1240. {
  1241. char MainVersion[32];
  1242. char SubVersion[32];
  1243. }SysMiscInfoData;
  1244. typedef struct
  1245. {
  1246. unsigned char Status;
  1247. }ConnectorConfigAndStatus;
  1248. typedef union
  1249. {
  1250. unsigned int ErrorValue;
  1251. struct
  1252. {
  1253. unsigned int OutputRelayWelding:1; // 0: no effect, 1: Welding
  1254. unsigned int OutputRelayDrivingFault:1; // 0: no effect, 1: DrivingFault
  1255. unsigned int ParallelRelayWelding:1; // 0: no effect, 1: Welding
  1256. unsigned int ParallelRelayDrivingFault:1; // 0: no effect, 1: DrivingFault
  1257. unsigned int PsuGroupAllAlarmFault:1; // 0: no effect, 1: psu group all alarm or fault
  1258. unsigned int res:27;
  1259. }bits;
  1260. }GunErrorFlag;
  1261. typedef struct
  1262. {
  1263. GunErrorFlag ErrFlag;
  1264. char GunAlarmCode[7];
  1265. }GunError;
  1266. typedef struct
  1267. {
  1268. int Offline_MaxChargingPower; // unit: W, offline max charging power, received from backend
  1269. int GunOfflineMaxPower[MAX_GUN_QUANTITY]; // unit: W, calculate from Offline_MaxChargingPower
  1270. int GunMaxProfilePower[MAX_GUN_QUANTITY]; // unit: W, calculate from MaxChargingProfilePower
  1271. int GunMaxProfileCurrent[MAX_GUN_QUANTITY]; // unit: 0.1A, Calculate from MaxChargingProfilePower
  1272. int GunAbsoluteMaxPower[MAX_GUN_QUANTITY]; // unit: W
  1273. int GunAbsoluteMaxVoltage[MAX_GUN_QUANTITY]; // unit: 0.1V
  1274. int GunAbsoluteMaxCurrent[MAX_GUN_QUANTITY]; // unit: 0.1A
  1275. int GunOtpMaxPower[MAX_GUN_QUANTITY]; // unit: W
  1276. int GunOtpMaxCurrent[MAX_GUN_QUANTITY]; // unit: 0.1A
  1277. int GunDynamicMaxPower[MAX_GUN_QUANTITY]; // unit: W
  1278. int GunDynamicMaxCurrent[MAX_GUN_QUANTITY]; // unit: 0.1A
  1279. int GunManualLimitPower[MAX_GUN_QUANTITY]; // unit: W
  1280. int GunManualLimitVoltage[MAX_GUN_QUANTITY]; // unit: 0.1V
  1281. int GunManualLimitCurrent[MAX_GUN_QUANTITY]; // unit: 0.1A
  1282. }OutputLimitation;
  1283. typedef enum
  1284. {
  1285. _BillStatus_Idle = 0x00, // no final cost received
  1286. _BillStatus_MiscReq = 0x01, // receive final cost and set final cost misc command
  1287. _BillStatus_WaitMiscClean = 0x02, // wait for dispenser to read misc command
  1288. _BillStatus_MiscClean = 0x03, // final cost misc command has update to dispenser, timeout: 3s
  1289. _BillStatus_UpdateDone = 0x04, // dispenser read final cost packet
  1290. _BillStatus_Completed = 0x05, // stay this status 3s
  1291. _BillStatus_Fail = 0x06, // clean bill info and return to idle
  1292. _BillStatus_End = 0x07, // clean bill info and return to idle
  1293. }BillStatus;
  1294. #define BILL_SATAUS_UNDISPOSED -1
  1295. #define BILL_SATAUS_UPDATED_FAIL 0
  1296. #define BILL_SATAUS_UPDATED_OK 1
  1297. #define BILL_SATAUS_Bypass_OK 2
  1298. typedef struct
  1299. {
  1300. float TotalCost; // connector user's total cost, unit: 1 dollar
  1301. float AccountBalance; // connector user's account balance, unit: 1 dollar
  1302. float CostDiscount; // connector user's Discount or couponPoint, unit: 1 point
  1303. float EnergyCost; // connector user's energy cost, unit: 1 dollar
  1304. float ParkingFee; // connector user's parking fee, unit: 1 dollar
  1305. float RemainAmount; // connector user's remain amount, unit: 1 dollar
  1306. float ConnectionFee; // connector user's connection fee, unit: 1 dollar
  1307. float SessionFee; // connector user's session fee, unit: 1 dollar
  1308. }FeeInfoData;
  1309. typedef struct
  1310. {
  1311. unsigned char BillStatus; // 0: idle, 1: misc request, 2 misc clean, 3: bill update done
  1312. unsigned char PreStatus; // 0: idle, 1: misc request, 2 misc clean, 3: bill update done
  1313. unsigned short TryCnt;
  1314. int TxId;
  1315. FeeInfoData FeeInfo;
  1316. char Receipt[512];
  1317. }ChargingBillInfoData;
  1318. typedef enum
  1319. {
  1320. _ParkingAction_None = 0x00, // no action
  1321. _ParkingAction_DisplayButton = 0x01, // Display Occupancy Fee button
  1322. _ParkingAction_CancelOccupancy = 0x02, // Cancel Occupancy Fee button
  1323. _ParkingAction_PaidOnlineOK = 0x03, // Successed to pay occupancy fee with online method, then close Occupancy Fee button
  1324. _ParkingAction_PaidOnlineFail = 0x04, // Failed to pay occupancy fee with online method
  1325. }OccupancyAction;
  1326. #define STR_OCCUPANCY_ACT_NONE "NoAction"
  1327. #define STR_OCCUPANCY_ACT_DISPLAY "DisplayButton"
  1328. #define STR_OCCUPANCY_ACT_CANCEL "CancelOccupancy"
  1329. #define STR_OCCUPANCY_ACT_PAID_OK "PaidOnlineOK"
  1330. #define STR_OCCUPANCY_ACT_PAID_NG "PaidOnlineFail"
  1331. typedef enum
  1332. {
  1333. _Parking_NoOccupancy = 0x00, // no occupancy
  1334. _Parking_SyncOccupancy = 0x01, // sync occupancy with dispenser
  1335. _Parking_Occupied = 0x02, // occupancy start
  1336. _Parking_RequestFee = 0x03, // user request occupancy fee
  1337. _Parking_WaitToPay = 0x04, // wait for user to pay the fee
  1338. _Parking_PaidOnlineOK = 0x05, // user to paid success via online method
  1339. _Parking_PaidOnlineFail = 0x06, // user to paid fail via online method
  1340. }OccupancyStatus;
  1341. #define STR_NO_OCCUPANCY "NoOccupancy"
  1342. #define STR_SYNC_OCCUPANCY "SyncOccupancy"
  1343. #define STR_OCCUPIED "Occupied"
  1344. #define STR_REQUEST_FEE "RequestFee"
  1345. #define STR_WAIT_TO_PAY "WaitToPay"
  1346. #define STR_PAID_ONLINE_OK "PaidOK"
  1347. #define STR_PAID_ONLINE_FAIL "PaidFail"
  1348. #define STR_NOTIFY_NONE "Notify None"
  1349. #define STR_GET_OCCUPANCY_FEE "GetOccupancyFee"
  1350. #define STR_CANCEL_OCCUPANCY_DEDUCT "CancelDeduction"
  1351. typedef enum
  1352. {
  1353. _Notify_None = 0x00, // act: None
  1354. _Notify_GetOccupancyFee = 0x01, // act: Get OccupancyFee
  1355. _Notify_CancelLocalDeduction = 0x02, // act: Cancel Local Deduction
  1356. }NotifyOccupancyFeeAct;
  1357. typedef struct
  1358. {
  1359. unsigned char MiscStatus; // 0: idle, 1: misc request, 2 misc clean, 3: bill update done
  1360. unsigned char PreStatus; // 0: idle, 1: misc request, 2 misc clean, 3: bill update done
  1361. unsigned short TryCnt;
  1362. }MiscRequestStatus;
  1363. typedef struct
  1364. {
  1365. char StartTime[32];
  1366. unsigned int Duration;
  1367. float Fee;
  1368. char Sn[37];
  1369. char res;
  1370. }OccupancyBillInfo;
  1371. typedef struct
  1372. {
  1373. float Fee;
  1374. char Sn[37];
  1375. char res;
  1376. char creditNo[21];
  1377. char ApprovalNumber[10]; // ApprovalNumber
  1378. char VemData[65]; // Vem Data
  1379. }OccupancyDeductInfo;
  1380. typedef union
  1381. {
  1382. unsigned int CtrlValue;
  1383. struct
  1384. {
  1385. unsigned int DeductReq:1; // 0: no request, 1: deduct request
  1386. unsigned int KeepCounting:1; // 0: no effect, 1: occupancy keep counting
  1387. unsigned int SelfReq:1; // 0: no request, 1: self request
  1388. unsigned int res:29;
  1389. }bits;
  1390. }OccupancyReqFlag;
  1391. typedef struct
  1392. {
  1393. unsigned char Status; // 0: NoOccupancy, 1: Occupied, 2: RequestFee, 3: WaitToPay
  1394. unsigned char PreStatus; // 0: NoOccupancy, 1: Occupied, 2: RequestFee, 3: WaitToPay
  1395. MiscRequestStatus ButtonReqStatus;
  1396. MiscRequestStatus BillReqStatus;
  1397. unsigned char ActionId;
  1398. unsigned char res;
  1399. OccupancyReqFlag OccupancyReq; // 0: no request, 1: deduct request
  1400. OccupancyBillInfo OccupancyBill;
  1401. OccupancyDeductInfo OccupancyDeduct;
  1402. }OccupancyInfoData;
  1403. typedef struct
  1404. {
  1405. ChargingBillInfoData DispBill[MAX_DISPENSER_QUANTITY];
  1406. ChargingBillInfoData GunBill[MAX_GUN_QUANTITY];
  1407. OccupancyInfoData OccupancyInfo[MAX_GUN_QUANTITY];
  1408. }AllBillInfoData;
  1409. // ************************************************************************************************* //
  1410. typedef struct
  1411. {
  1412. SysMiscInfoData SysMisc;
  1413. SystemAuthInfoData AuthInfo;
  1414. SysControl Control;
  1415. PsuPositionInfoData PsuPosition;
  1416. PsuGroupingInfoData PsuGrouping;
  1417. SocketConnInfoData CabinetConnInfo[MAX_SLAVE_CABINET_QUANTITY];
  1418. ParallelCabinetInfoData ParallelCabinet;
  1419. SlaveCabinetControl SCabinetControl;
  1420. ConnectorPageControl ConnectorPageReq[MAX_GROUP_QUANTITY];
  1421. DispenserMiscControl DispenserMiscReq[MAX_GROUP_QUANTITY];
  1422. ConnectorMiscControl ConnectorMiscReq[MAX_GROUP_QUANTITY];
  1423. MiscCommandValue CabinetMiscValue;
  1424. ConnectorActionRequest ConnectorActReq[MAX_GROUP_QUANTITY];
  1425. StationInfoData StationInfo;
  1426. TransactionInfoData UserTransaction[MAX_GROUP_QUANTITY];
  1427. DeductResultInfoData DeductResultReq[MAX_GROUP_QUANTITY];
  1428. DeductResultInfoData ReDeductReq;
  1429. DeductResultInfoData ReaderStatus[MAX_GROUP_QUANTITY];
  1430. LineApiStatusInfo LineApi;
  1431. ConnectorConfigAndStatus Connector[MAX_GUN_QUANTITY];
  1432. PriceReceiptInfoData PriceAndReceiptInfo;
  1433. MeterValueInfoData MeterValue[MAX_GUN_QUANTITY];
  1434. TimestampInfoData Timestamp[MAX_GUN_QUANTITY];
  1435. GunError GunError[MAX_GUN_QUANTITY];
  1436. OutputLimitation OutputLimit;
  1437. AllBillInfoData AllBill;
  1438. }ChargerInfoData;
  1439. #endif /* CONFIG_H_ */