main.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  1. /*
  2. * Config.h
  3. *
  4. * Created on: 2020年01月15日
  5. * Author: Eason Yang
  6. */
  7. #ifndef CONFIG_MAIN_H_
  8. #define CONFIG_MAIN_H_
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <sys/time.h>
  12. #include <sys/timeb.h>
  13. #include <sys/types.h>
  14. #include <sys/ioctl.h>
  15. #include <sys/socket.h>
  16. #include <sys/ipc.h>
  17. #include <sys/shm.h>
  18. #include <sys/mman.h>
  19. #include <linux/wireless.h>
  20. #include <arpa/inet.h>
  21. #include <netinet/in.h>
  22. #include <dirent.h>
  23. #include <unistd.h>
  24. #include <stdarg.h>
  25. #include <stdio.h> /*標準輸入輸出定義*/
  26. #include <stdlib.h> /*標準函數庫定義*/
  27. #include <unistd.h> /*Unix 標準函數定義*/
  28. #include <fcntl.h> /*檔控制定義*/
  29. #include <termios.h> /*PPSIX 終端控制定義*/
  30. #include <errno.h> /*錯誤號定義*/
  31. #include <errno.h>
  32. #include <string.h>
  33. #include <time.h>
  34. #include <ctype.h>
  35. #include <ifaddrs.h>
  36. #include <stdbool.h>
  37. #include <stddef.h>
  38. #include <stdint.h>
  39. #include <sqlite3.h>
  40. //===================================
  41. // Define CP State constant
  42. //===================================
  43. #define CP_STATE_UNKNOWN 0
  44. #define CP_STATE_A 1
  45. #define CP_STATE_B 2
  46. #define CP_STATE_C 3
  47. #define CP_STATE_D 4
  48. #define CP_STATE_E 5
  49. #define CP_STATE_F 6
  50. //===================================
  51. // Define CCS CP State constant
  52. //===================================
  53. #define CCS_CP_STATE_UNKNOWN 0
  54. #define CCS_CP_STATE_A 1 //A (12V, no PWM)
  55. #define CCS_CP_STATE_B1 2 //B1 (9V, no PWM)
  56. #define CCS_CP_STATE_B2 3 //B2 (9V, with PWM)
  57. #define CCS_CP_STATE_C 4 //C (6V, with PWM)
  58. #define CCS_CP_STATE_D 5 //D (3V, with PWM)
  59. #define CCS_CP_STATE_E 6 //E (0V, no PWM)
  60. #define CCS_CP_STATE_F 7 //F (-12V, no PWM)
  61. #define CCS_CP_STATE_G 8 //G (>12V)
  62. #define CCS_CP_STATE_H 9 //H (<12V)
  63. //===================================
  64. // Define start mode constant
  65. //===================================
  66. #define START_METHOD_FREE 0
  67. #define START_METHOD_RFID 1
  68. #define START_METHOD_BACKEND 2
  69. #define START_METHOD_BLE 3
  70. //===================================
  71. // Define Speaker type constant
  72. //===================================
  73. #define SPEAKER_STOP 0
  74. #define SPEAKER_ALWAYS_ON 1
  75. #define SPEAKER_SHORT 2
  76. #define SPEAKER_LONG 3
  77. #define SPEAKER_INTERVAL_SHORT 4
  78. #define SPEAKER_INTERVAL_LONG 5
  79. #define SPEAKER_INTERVAL_3COUNT 6
  80. //===================================
  81. // Define Alarm code constant
  82. //===================================
  83. #define ALARM_L1_OVER_VOLTAGE 0x00000001
  84. #define ALARM_L1_UNDER_VOLTAGE 0x00000002
  85. #define ALARM_L1_OVER_CURRENT 0x00000004
  86. #define ALARM_OVER_TEMPERATURE 0x00000008
  87. #define ALARM_GROUND_FAIL 0x00000010
  88. #define ALARM_CP_ERROR 0x00000020
  89. #define ALARM_CURRENT_LEAK_AC 0x00000040
  90. #define ALARM_CURRENT_LEAK_DC 0x00000080
  91. #define ALARM_MCU_TESTFAIL 0x00000100
  92. #define ALARM_HANDSHAKE_TIMEOUT 0x00000200
  93. #define ALARM_EMERGENCY_STOP 0x00000400
  94. #define ALARM_RELAY_WELDING 0x00000800
  95. #define ALARM_LEAK_MODULE_FAIL 0x00001000
  96. #define ALARM_SHUTTER_FAULT 0x00002000
  97. #define ALARM_LOCKER_FAULT 0x00004000
  98. #define ALARM_POWER_DROP 0x00008000
  99. #define ALARM_L1_CIRCUIT_SHORT 0x00010000
  100. #define ALARM_ROTATORY_SWITCH_FAULT 0x00020000
  101. #define ALARM_RELAY_DRIVE_FAULT 0x00040000
  102. #define ALARM_BLE_MODULE_BROKEN 0x00080000
  103. #define ALARM_L2_OVER_VOLTAGE 0x00100000
  104. #define ALARM_L3_OVER_VOLTAGE 0x00200000
  105. #define ALARM_L2_UNDER_VOLTAGE 0x00400000
  106. #define ALARM_L3_UNDER_VOLTAGE 0x00800000
  107. #define ALARM_L2_OVER_CURRENT 0x01000000
  108. #define ALARM_L3_OVER_CURRENT 0x02000000
  109. #define ALARM_L2_CIRCUIT_SHORT 0x04000000
  110. #define ALARM_L3_CIRCUIT_SHORT 0x08000000
  111. //===================================
  112. // Define Led constant
  113. //===================================
  114. #define LED_ACTION_INIT 0
  115. #define LED_ACTION_IDLE 1
  116. #define LED_ACTION_AUTHED 2
  117. #define LED_ACTION_CONNECTED 3
  118. #define LED_ACTION_CHARGING 4
  119. #define LED_ACTION_STOP 5
  120. #define LED_ACTION_ALARM 6
  121. #define LED_ACTION_MAINTAIN 7
  122. #define LED_ACTION_RFID_PASS 8
  123. #define LED_ACTION_RFID_FAIL 9
  124. #define LED_ACTION_BLE_CONNECT 10
  125. #define LED_ACTION_BLE_DISABLE 11
  126. #define LED_ACTION_DEBUG 12
  127. #define LED_ACTION_ALL_OFF 13
  128. #define LED_RELAY_ON 14
  129. #define LED_RELAY_OFF 15
  130. #define LED_ACTION_HANDSHAKE_FAIL 16
  131. #define LED_ACTION_INTERNET_DISCONNECT 17
  132. //=================================
  133. //CCS related define
  134. //=================================
  135. //#define CCS_SIMULATION_DATA
  136. #define CCS_PWM_DUTY_CP_STATE_F 0
  137. #define CCS_PWM_DUTY_CP_STATE_E 1
  138. #define CCS_PWM_DUTY_5 5
  139. #define CCS_PWM_DUTY_100 100
  140. #define HANDSHAKE_DUTY_5 1
  141. #define HANDSHAKE_DUTY_5_CHECK 2
  142. #define HANDSHAKE_CCS 3
  143. #define HANDSHAKE_CP_STATE_E 4
  144. #define HANDSHAKE_SET_MAX_CURRENT 5
  145. #define HANDSHAKE_BS_MODE 6
  146. #define HANDSHAKE_HLC_MODE 7
  147. #define CHARGING_MODE_BS 0
  148. #define CHARGING_MODE_HLC 1
  149. #define HLC_STOP_MODE 0
  150. #define HLC_START_MODE 1
  151. #define HLC_RENEGOTIATE_MODE 2
  152. #define HLC_STANDBY_MODE 3
  153. #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  154. #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  155. #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
  156. extern int StoreLogMsg(const char *fmt, ...);
  157. //============================================================
  158. // Private shared memory key define
  159. //============================================================
  160. #define ShmChargerKey 2001
  161. typedef struct Verion
  162. {
  163. char Version_FW[32];
  164. char Version_HW[32];
  165. }Ver;
  166. typedef struct PRESENTINPUTVOLTAGE
  167. {
  168. unsigned char inputType; // 0x00: Line to Line 0x01: Line to Neutral
  169. double L1N_L12;
  170. double L2N_L23;
  171. double L3N_L31;
  172. }PresentInputVoltage;
  173. typedef struct PRESENTOUTPUTVOLTAGE
  174. {
  175. double behindFuse_Voltage_C1;
  176. double behindRelay_Voltage_C1;
  177. double behindFuse_Voltage_C2;
  178. double behindRelay_Voltage_C2;
  179. }PresentOutputVoltage;
  180. typedef struct FANSPEED
  181. {
  182. unsigned short int speed[4];
  183. }FanSpeed;
  184. typedef struct TEMPERATURE
  185. {
  186. unsigned char point[8];
  187. }Temperature;
  188. typedef struct AUXPOWER
  189. {
  190. unsigned char voltage[8];
  191. }AuxPower;
  192. typedef struct RELAY
  193. {
  194. unsigned char relay_status[2][8];
  195. }Relay;
  196. typedef struct GFD
  197. {
  198. unsigned short int adc_value_positive[2];
  199. unsigned short int adc_value_negative[2];
  200. }Gfd;
  201. typedef struct GPIO_IN
  202. {
  203. unsigned char AC_Connector;
  204. unsigned char AC_MainBreaker;
  205. unsigned char SPD;
  206. unsigned char Door_Open;
  207. unsigned char GFD[2];
  208. unsigned char Button[2];
  209. unsigned char Button_Emergency;
  210. }Gpio_in;
  211. typedef struct GPIO_OUT
  212. {
  213. unsigned char AC_Connector;
  214. unsigned char Button_LED[2];
  215. unsigned char System_LED[4];
  216. }Gpio_out;
  217. typedef struct ALARM_LOG
  218. {
  219. unsigned char logArea;
  220. unsigned int alarmIndex;
  221. unsigned char log[8];
  222. }Alarm_Log;
  223. typedef struct BLE_CONFIG_DATA
  224. {
  225. unsigned char isLogin:1;
  226. unsigned char isRequestStart:1;
  227. unsigned char isRequestStop:1;
  228. }Ble_Config_Data;
  229. typedef struct BLE_LONGIN_CENTRAL_ID
  230. {
  231. unsigned char id[32];
  232. }Ble_Login_Central_Id;
  233. typedef struct RTC
  234. {
  235. unsigned short int year;
  236. unsigned char month;
  237. unsigned char day;
  238. unsigned char hour;
  239. unsigned char min;
  240. unsigned char sec;
  241. }Rtc;
  242. typedef struct PRESENTOUTPUTCURRENT
  243. {
  244. double L1N_L12[2];
  245. double L2N_L23[2];
  246. double L3N_L31[2];
  247. }Presentoutputcurrent;
  248. typedef struct AC_PRIMARY_MCU
  249. {
  250. unsigned char cp_state;
  251. unsigned int current_limit;
  252. float cp_voltage_positive;
  253. float cp_voltage_negtive;
  254. unsigned char locker_state;
  255. unsigned char relay_state;
  256. unsigned char shutter_state;
  257. unsigned char meter_state;
  258. unsigned char pp_state;
  259. unsigned char rating_current;
  260. unsigned char rotatory_switch;
  261. Relay relayState;
  262. }Ac_Primary_Mcu;
  263. typedef struct AC_PRIMARY_MCU_ALARM
  264. {
  265. union
  266. {
  267. unsigned long InputAlarmCode;
  268. struct
  269. {
  270. unsigned long OVP_L1:1;
  271. unsigned long UVP_L1:1;
  272. unsigned long OCP_L1:1;
  273. unsigned long OTP:1;
  274. unsigned long gmi_fault:1;
  275. unsigned long cp_fault:1;
  276. unsigned long ac_leak:1;
  277. unsigned long dc_leak:1;
  278. unsigned long mcu_selftest_fail:1;
  279. unsigned long handshaking_timeout:1;
  280. unsigned long emergency_stop:1;
  281. unsigned long relay_welding:1;
  282. unsigned long leak_module_fail:1;
  283. unsigned long shutter_fault:1;
  284. unsigned long locker_fault:1;
  285. unsigned long power_drop:1;
  286. unsigned long rotate_switch_fault:1;
  287. unsigned long short_circuit_L1:1;
  288. unsigned long relay_drive_fault:1;
  289. unsigned long comm_timeout:1;
  290. unsigned long OVP_L2:1;
  291. unsigned long UVP_L2:1;
  292. unsigned long OCP_L2:1;
  293. unsigned long OVP_L3:1;
  294. unsigned long UVP_L3:1;
  295. unsigned long OCP_L3:1;
  296. unsigned long short_circuit_L2:1;
  297. unsigned long short_circuit_L3:1;
  298. }bits;
  299. };
  300. }Ac_Primary_Mcu_Alarm;
  301. typedef struct AC_PRIMARY_MCU_LED
  302. {
  303. unsigned char mode;
  304. unsigned long alarm_code;
  305. }Ac_Primary_Mcu_Led;
  306. typedef struct EVSE_ID
  307. {
  308. unsigned char model_name[14];
  309. unsigned char serial_number[12];
  310. }Evse_Id;
  311. typedef struct AC_PRIMARY_MCU_CP_PWM_DUTY
  312. {
  313. unsigned int max_current;
  314. }Ac_Primary_Mcu_Cp_Pwm_Duty;
  315. typedef struct LEGACY_REQUEST
  316. {
  317. unsigned char isLegacyRequest:1;
  318. uint8_t isRelayOn:1;
  319. }Legacy_Request;
  320. typedef struct POWER_CONSUMPTION
  321. {
  322. uint32_t power_consumption;
  323. uint32_t power_consumption_at_start;
  324. }Power_Consumption;
  325. typedef struct MCU_OP_FLAG
  326. {
  327. unsigned char isSetModePass:1;
  328. unsigned char isSetSerialNumberPass:1;
  329. unsigned char isSetModelNamePass:1;
  330. unsigned char isReadFwVerPass:1;
  331. unsigned char isMcuUpgradeReq:1;
  332. unsigned char isSetCpPwmDuty:1;
  333. }Mcu_Op_Flag;
  334. typedef struct SYSTEM_ALARM_CODE
  335. {
  336. unsigned long SystemAlarmCode;
  337. }System_Alarm_Code;
  338. typedef struct OTHER_ALARM_CODE
  339. {
  340. unsigned long isHandshakingTimeOut:1;
  341. unsigned long isDcLeakage:1;
  342. unsigned long isACLeakage:1;
  343. }Other_Alarm_Code;
  344. typedef struct PILOT_VOLTAGE
  345. {
  346. float PilotVoltagePositive;
  347. float PilotVoltageNegative;
  348. }Pilot_Voltage;
  349. typedef struct FW_UPGRADE_INFO
  350. {
  351. int fwType;
  352. char modelName[17];
  353. char location[384];
  354. }Fw_Upgrade_Info;
  355. typedef struct GUN_PLUGIN_TIMES
  356. {
  357. uint32_t GunPluginTimes;
  358. }Gun_Plugin_Times;
  359. typedef struct MCU_RESET_REQUEST
  360. {
  361. unsigned char isMcuResetRequest:1;
  362. }Mcu_Reset_Request;
  363. typedef struct TIMEOUT_SPEC
  364. {
  365. int Setting_Timeout_Spec;
  366. int Present_Timeout_Spec;
  367. }Timeout_Spec;
  368. typedef struct SET_BREATHE_LED_TIMING
  369. {
  370. uint16_t set_Led_Action_Connected_Fade_In;
  371. uint16_t set_Led_Action_Connected_Fade_Out;
  372. uint16_t set_Led_Action_Authed_Fade_In;
  373. uint16_t set_Led_Action_Authed_Fade_Out;
  374. uint16_t Set_Led_Action_Chaging_Fade_In;
  375. uint16_t set_Led_Action_Chaging_Fade_Out;
  376. }Set_Breathe_Led_Timing;
  377. typedef struct SET_LED_BRIGHTNESS
  378. {
  379. uint8_t sector_1; // 0~1 AM and 1~2 AM
  380. uint8_t sector_2; // 2~3 AM and 3~4 AM
  381. uint8_t sector_3; // 4~5 AM and 5~6 AM
  382. uint8_t sector_4; // 6~7 AM and 7~8 AM
  383. uint8_t sector_5; // 8~9 AM and 9~10 AM
  384. uint8_t sector_6; // 10~11 AM and 11~12 AM
  385. uint8_t sector_7; // 12~13 PM and 13~14 PM
  386. uint8_t sector_8; // 14~15 PM and 15~16 PM
  387. uint8_t sector_9; // 16~17 PM and 17~18 PM
  388. uint8_t sector_10; // 18~19 PM and 19~20 PM
  389. uint8_t sector_11; // 20~21 PM and 21~22 PM
  390. uint8_t sector_12; // 22~23 PM and 23~24 PM
  391. }Set_Led_Brightness;
  392. typedef struct CCS_INFO
  393. {
  394. uint8_t BatteryChargeType; /*0x00: AC charging, 0x01: DC charging*/
  395. uint8_t PresentMsgFlowStatus;
  396. /* ISO15118_2018
  397. 0: Idle(wait B2 state),
  398. 1: CM_SLAC_PARM.REQ,
  399. 2: CM_SLAC_PARM.CNF,
  400. 3: CM_START_ATTEN_CHAR.IND
  401. 4: CM_MNBC_SOUND.IND,
  402. 5: CM_ATTEN_CHAR.IND,
  403. 6: CM_ATTEN_CHAR.RSP,
  404. 7: CM_VALIDATE.REQ
  405. 8: CM_VALIDATE.CNF,
  406. 9: CM_SLAC_MATCH.REQ,
  407. 10: CM_SLAC_MATCH.CNF,
  408. 11: CM_AMP_MAP.REQ
  409. 12: CM_AMP_MAP.CNF,
  410. 13: SLACC/SDP/TCP connection,
  411. 16: SupportedAppProtocolRequest,
  412. 17: SupportedAppProtocolResponse,
  413. 18: SessionSetupRequest
  414. 19: SessionSetupResponse,
  415. 20: ServiceDiscoveryRequest,
  416. 21: ServiceDiscoveryResponse
  417. 22: ServiceDetailRequest,
  418. 23: ServiceDetailResponse
  419. 24:ServiceAndPaymentSelectionRequest/ServiceSelectionRequest,
  420. 25: ServiceAndPaymentSelectionResponse/ServiceSelectionResponse
  421. 26: PaymentDetailsRequest/IdentificationDetailsRequest;,
  422. 27: PaymentDetailsResponse/IdentificationDetailsResponse,
  423. 28: AuthorizationRequest,
  424. 29: AuthorizationResponse,
  425. 30: CertificateUpdateRequest,
  426. 31: CertificateUpdateResponse,
  427. 32:CertificateInstallationRequest,
  428. 33: CertificateInstallationResponse
  429. 34: ChargeParameterDiscoveryRequest,
  430. 35: ChargeParameterDiscoveryResponse
  431. 36: CableCheckRequest,
  432. 37: CableCheckResponse,
  433. 38: PreChargeRequest,
  434. 39: PreChargeResponse
  435. 40: PowerDeliveryRequest start,
  436. 41: PowerDeliveryResponse start,
  437. 42: ChargingStatusRequest,
  438. 43: ChargingStatusResponse
  439. 44:CurrentDemandRequest,
  440. 45:CurrentDemandResponse,
  441. 46:MeteringReceiptRequest,
  442. 47: MeteringReceiptResponse
  443. 48: PowerDeliveryRequest end,
  444. 49: PowerDeliveryRequest end,
  445. 50: WeldingDetectionRequest,
  446. 51: WeldingDetectionResponse,
  447. 52: SessionStopRequest,
  448. 53: SessionStopResponse
  449. 253: Performance Timeout,
  450. 254: Sequence Timeout,
  451. 255: Fault
  452. */
  453. float ConnectorTemperature1; /*unit: 1°C*/
  454. float ConnectorTemperature2; /*unit: 1°C*/
  455. uint16_t ChargingRemainTime; /*0x0000: 0 sec ~ 0xFFFF: 65535 sec, unit: 1 second*/
  456. float TotalBatteryCapacity; /*unit: Wh*/
  457. float BatteryMaximumVoltage; /*unit: 1 volt*/
  458. float BatteryMaximumCurrent; /*unit: 1 amp*/
  459. uint8_t EVCCID[8];
  460. uint8_t EVSEID[40];
  461. uint8_t CCSLibRev[32];
  462. uint8_t EVSEModelName[32];
  463. uint32_t CSUAlarmStatusCode;
  464. uint16_t CCSAlarmStatusCode;
  465. uint8_t PaymentOption; /* 0x00 EIM, 0x01 Pnc */
  466. float EVSEMaxCurrent; /*unit: 1 amp*/
  467. float EVSEMinCurrent; /*unit: 1 amp*/
  468. float GridVoltage[3]; /*unit: 1 volt*/
  469. uint8_t MeterID[32]; /*unit: 1 amp*/
  470. float MeterReadingValue; /*unit: 1Wh*/
  471. uint8_t EVOperation; /*0:Charge, 1:Discharge*/
  472. uint8_t EVChargeProgress; /*0: Stop
  473. 1: Start
  474. 2: Renegotiate
  475. 3: Standby */
  476. uint8_t CpSetPWMDuty; /*unit: 1%
  477. 0: 0%
  478. 5: 5%
  479. 100: 100%*/
  480. uint8_t CpSetStateE; /*0:disable, 1:enable*/
  481. uint8_t CpPresentPWMDuty; /*unit:1%*/
  482. uint8_t CpPresentState; /*1: A (12V, no PWM)
  483. 2: B1 (9V, no PWM)
  484. 3: B2 (9V, with PWM)
  485. 4: C (6V, with PWM)
  486. 5: D (3V, with PWM)
  487. 6: E (0V, no PWM)
  488. 7: F (-12V, no PWM)
  489. 8: G (>12V)
  490. 9: H (<12V)*/
  491. float CpPositiveVoltage; /*uint: 1V*/
  492. float CpNegativeVoltage; /*uint: 1V*/
  493. uint32_t CcsHeartBeat; /*unit: 1*/
  494. float EVSEPresentCurrent[3]; //unit: 1A
  495. float AvailableChargingPower; //1KW
  496. uint8_t EVSENotification; /*0: None
  497. 1: StopCharging
  498. 2: ReNegotiation*/
  499. uint16_t ChargingPermission:1; /*0x00: Not ready yet, stay in idle mode or go into terminating process.
  500. 0x01: start charging process*/
  501. uint16_t ConnectorLockerStatus:1; /*0x00: released
  502. 0x01: locked*/
  503. uint16_t RcdStatus:1; /* 0x00 no error
  504. 0x01 an error */
  505. uint16_t OutputRelayStatus:1; /*0: OFF
  506. 1: ON*/
  507. uint16_t TempFlag4:1;
  508. uint16_t TempFlag5:1;
  509. uint16_t TempFlag6:1;
  510. uint16_t TempFlag7:1;
  511. uint16_t TempFlag8:1;
  512. uint16_t TempFlag9:1;
  513. uint16_t TempFlag10:1;
  514. uint16_t TempFlag11:1;
  515. uint16_t TempFlag12:1;
  516. uint16_t TempFlag13:1;
  517. uint16_t TempFlag14:1;
  518. uint16_t TempFlag15:1;
  519. }Ac_Ccs_Info;
  520. typedef struct GUN_INFO
  521. {
  522. Ver ver;
  523. PresentInputVoltage inputVoltage;
  524. Presentoutputcurrent outputCurrent;
  525. Temperature temperature;
  526. Ble_Config_Data bleConfigData;
  527. Ble_Login_Central_Id bleLoginCentralId;
  528. Rtc rtc;
  529. Ac_Primary_Mcu primaryMcuState;
  530. Ac_Primary_Mcu_Alarm primaryMcuAlarm;
  531. Ac_Primary_Mcu_Led primaryMcuLed;
  532. Mcu_Op_Flag mcuFlag;
  533. Power_Consumption powerConsumption;
  534. Legacy_Request legacyRequest;
  535. System_Alarm_Code systemAlarmCode;
  536. Ac_Primary_Mcu_Cp_Pwm_Duty primaryMcuCp_Pwn_Duty;
  537. Other_Alarm_Code otherAlarmCode;
  538. Pilot_Voltage PilotVoltage;
  539. Gun_Plugin_Times gunPluginTimes;
  540. Mcu_Reset_Request mcuResetRequest;
  541. Set_Breathe_Led_Timing setBreatheLedTiming;
  542. Set_Led_Brightness setLedBrightness;
  543. Ac_Ccs_Info acCcsInfo;
  544. uint8_t ccsHandshakeState;
  545. uint8_t PreviousEVChargeProgress;
  546. uint8_t chargingMode;
  547. uint16_t targetCurrent;
  548. uint16_t isAuthPassEnd:1;
  549. uint16_t rfidReq:1;
  550. uint16_t isGunPlugged:1;
  551. uint16_t isInitialPass:1;
  552. uint16_t isSetBreatheLedTiming:1;
  553. uint16_t isSetLedBrightness:1;
  554. uint16_t isUnlockerConnetor:1;
  555. uint16_t isOperactive:1;
  556. uint16_t isCCSWaitChangeDuty:1;
  557. uint16_t isCCSStartTransation:1;
  558. }Gun_Info;
  559. struct Charger
  560. {
  561. Ver ver;
  562. Evse_Id evseId;
  563. Gun_Info gun_info[2];
  564. Fw_Upgrade_Info fwUpgradeInfo;
  565. Timeout_Spec timeoutSpec;
  566. uint8_t gun_selectd;
  567. uint8_t speaker_type;
  568. uint8_t isSpeakerOn:1;
  569. uint8_t isUpdateSuccess:1;
  570. };
  571. #endif /* CONFIG_MAIN_H_ */