Config.h 74 KB

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