Config.h 76 KB

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