MessageHandler.h 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020
  1. #ifndef MessageHandler_H
  2. #define MessageHandler_H
  3. //===================================
  4. // Define SQLite file constant
  5. //===================================
  6. #define OCPP_LOCAL_DB_FILE "/Storage/OCPP/charger.db"
  7. //===================================
  8. // Define CP State constant
  9. //===================================
  10. #define CP_STATE_UNKNOWN 0
  11. #define CP_STATE_A 1
  12. #define CP_STATE_B 2
  13. #define CP_STATE_C 3
  14. #define CP_STATE_D 4
  15. #define CP_STATE_E 5
  16. #define CP_STATE_F 6
  17. //==========================================
  18. // Init all Enumeration & Mapping String
  19. //==========================================
  20. #define MACROSTR(k) #k
  21. /* Common Data Type */
  22. /*APNAuthenticationEnumType */
  23. typedef enum {
  24. APNAuthenticationEnumType_CHAP,
  25. APNAuthenticationEnumType_NONE,
  26. APNAuthenticationEnumType_PAP,
  27. APNAuthenticationEnumType_AUTO
  28. } APNAuthenticationEnumType;
  29. /* AttributeEnumType */
  30. typedef enum {
  31. AttributeEnumType_Actual,
  32. AttributeEnumType_Target,
  33. AttributeEnumType_MinSet,
  34. AttributeEnumType_MaxSet
  35. } AttributeEnumType;
  36. /* AuthorizationStatusEnumType */
  37. typedef enum {
  38. AuthorizationStatusEnumType_Accepted,
  39. AuthorizationStatusEnumType_Blocked,
  40. AuthorizationStatusEnumType_ConcurrentTx,
  41. AuthorizationStatusEnumType_Expired,
  42. AuthorizationStatusEnumType_Invalid,
  43. AuthorizationStatusEnumType_NoCredit,
  44. AuthorizationStatusEnumType_NotAllowedTypeEVSE,
  45. AuthorizationStatusEnumType_NotAtThisLocation,
  46. AuthorizationStatusEnumType_NotAtThisTime,
  47. AuthorizationStatusEnumType_Unknown
  48. } AuthorizationStatusEnumType;
  49. /* AuthorizeCertificateStatusEnumType */
  50. typedef enum {
  51. AuthorizeCertificateStatusEnumType_Accepted,
  52. AuthorizeCertificateStatusEnumType_SignatureError,
  53. AuthorizeCertificateStatusEnumType_CertificateExpired,
  54. AuthorizeCertificateStatusEnumType_CertificateRevoked
  55. } AuthorizeCertificateStatusEnumType;
  56. /* BootReasonEnumType */
  57. typedef enum {
  58. BootReasonEnumType_ApplicationReset,
  59. BootReasonEnumType_FirmwareUpdate,
  60. BootReasonEnumType_LocalReset,
  61. BootReasonEnumType_PowerUp,
  62. BootReasonEnumType_RemoteReset,
  63. BootReasonEnumType_ScheduledReset,
  64. BootReasonEnumType_Triggered,
  65. BootReasonEnumType_Unknown,
  66. BootReasonEnumType_Watchdog
  67. } BootReasonEnumType;
  68. /* CancelReservationStatusEnumType */
  69. typedef enum {
  70. CancelReservationStatusEnumType_Accepted,
  71. CancelReservationStatusEnumType_Rejected
  72. } CancelReservationStatusEnumType;
  73. /* CertificateActionEnumType */
  74. typedef enum {
  75. CertificateActionEnumType_Install,
  76. CertificateActionEnumType_Update
  77. } CertificateActionEnumType;
  78. /* CertificateSignedStatusEnumType */
  79. typedef enum {
  80. CertificateSignedStatusEnumType_Accepted,
  81. CertificateSignedStatusEnumType_Rejected
  82. } CertificateSignedStatusEnumType;
  83. /* CertificateSignedStatusEnumType */
  84. typedef enum {
  85. CertificateSignedStatusEnumType_ChargingStationCertificate,
  86. CertificateSignedStatusEnumType_V2GCertificate
  87. } CertificateSigningUseEnumType;
  88. /* ChangeAvailabilityStatusEnumType */
  89. typedef enum {
  90. ChangeAvailabilityStatusEnumType_Accepted,
  91. ChangeAvailabilityStatusEnumType_Rejected,
  92. ChangeAvailabilityStatusEnumType_Scheduled
  93. } ChangeAvailabilityStatusEnumType;
  94. /* ChargingLimitSourceEnumType */
  95. typedef enum {
  96. ChargingLimitSourceEnumType_EMS,
  97. ChargingLimitSourceEnumType_Other,
  98. ChargingLimitSourceEnumType_SO,
  99. ChargingLimitSourceEnumType_CSO
  100. } ChargingLimitSourceEnumType;
  101. /* ChargingProfileKindEnumType */
  102. typedef enum {
  103. ChargingProfileKindEnumType_Absolute,
  104. ChargingProfileKindEnumType_Recurring,
  105. ChargingProfileKindEnumType_Relative
  106. } ChargingProfileKindEnumType;
  107. /* ChargingProfilePurposeEnumType */
  108. typedef enum {
  109. ChargingProfilePurposeEnumType_ChargingStationExternalConstraints,
  110. ChargingProfilePurposeEnumType_ChargingStationMaxProfile,
  111. ChargingProfilePurposeEnumType_TxDefaultProfile,
  112. ChargingProfilePurposeEnumType_TxProfile
  113. } ChargingProfilePurposeEnumType;
  114. /* ChargingProfileStatusEnumType */
  115. typedef enum {
  116. ChargingProfileStatusEnumType_Accepted,
  117. ChargingProfileStatusEnumType_Rejected
  118. } ChargingProfileStatusEnumType;
  119. /* ChargingRateUnitEnumType */
  120. typedef enum {
  121. ChargingRateUnitEnumType_W,
  122. ChargingRateUnitEnumType_A
  123. } ChargingRateUnitEnumType;
  124. /* ChargingStateEnumType */
  125. typedef enum {
  126. ChargingStateEnumType_Charging,
  127. ChargingStateEnumType_EVConnected,
  128. ChargingStateEnumType_SuspendedEV,
  129. ChargingStateEnumType_SuspendedEVSE,
  130. ChargingStateEnumType_Idle
  131. }ChargingStateEnumType;
  132. /* ClearCacheStatusEnumType */
  133. typedef enum {
  134. ClearCacheStatusEnumType_Accepted,
  135. ClearCacheStatusEnumType_Rejected
  136. } ClearCacheStatusEnumType;
  137. /* ClearChargingProfileStatusEnumType */
  138. typedef enum {
  139. ClearChargingProfileStatusEnumType_Accepted,
  140. ClearChargingProfileStatusEnumType_Unknown
  141. } ClearChargingProfileStatusEnumType;
  142. /* ClearMessageStatusEnumType */
  143. typedef enum {
  144. ClearMessageStatusEnumType_Accepted,
  145. ClearMessageStatusEnumType_Unknown
  146. } ClearMessageStatusEnumType;
  147. /* ClearMonitoringStatusEnumType */
  148. typedef enum {
  149. ClearMonitoringStatusEnumType_Accepted,
  150. ClearMonitoringStatusEnumType_Rejected,
  151. ClearMonitoringStatusEnumType_NotFound
  152. } ClearMonitoringStatusEnumType;
  153. /* ComponentCriterionEnumType */
  154. typedef enum {
  155. ComponentCriterionEnumType_Active,
  156. ComponentCriterionEnumType_Available,
  157. ComponentCriterionEnumType_Enabled,
  158. ComponentCriterionEnumType_Problem
  159. } ComponentCriterionEnumType;
  160. /* ConnectorEnumType */
  161. typedef enum {
  162. ConnectorEnumType_cCCS1,
  163. ConnectorEnumType_cCCS2,
  164. ConnectorEnumType_cG105,
  165. ConnectorEnumType_cTesla,
  166. ConnectorEnumType_cType1,
  167. ConnectorEnumType_cType2,
  168. ConnectorEnumType_s309_1P_16A,
  169. ConnectorEnumType_s309_1P_32A,
  170. ConnectorEnumType_s309_3P_16A,
  171. ConnectorEnumType_s309_3P_32A,
  172. ConnectorEnumType_sBS1361,
  173. ConnectorEnumType_sCEE_7_7,
  174. ConnectorEnumType_sType2,
  175. ConnectorEnumType_sType3,
  176. ConnectorEnumType_Other1PhMax16A,
  177. ConnectorEnumType_Other1PhOver16A,
  178. ConnectorEnumType_Other3Ph,
  179. ConnectorEnumType_Pan,
  180. ConnectorEnumType_wInductive,
  181. ConnectorEnumType_wResonant,
  182. ConnectorEnumType_Undetermined,
  183. ConnectorEnumType_Unknown
  184. } ConnectorEnumType;
  185. /* ConnectorStatusEnumType */
  186. typedef enum {
  187. ConnectorStatusEnumType_Available,
  188. ConnectorStatusEnumType_Occupied,
  189. ConnectorStatusEnumType_Reserved,
  190. ConnectorStatusEnumType_Unavailable,
  191. ConnectorStatusEnumType_Faulted
  192. } ConnectorStatusEnumType;
  193. /* CostKindEnumType */
  194. typedef enum {
  195. CostKindEnumType_CarbonDioxideEmission,
  196. CostKindEnumType_RelativePricePercentage,
  197. CostKindEnumType_RenewableGenerationPercentage
  198. } CostKindEnumType;
  199. /* CustomerInformationStatusEnumType */
  200. typedef enum {
  201. CustomerInformationStatusEnumType_Accepted,
  202. CustomerInformationStatusEnumType_Rejected,
  203. CustomerInformationStatusEnumType_Invalid
  204. } CustomerInformationStatusEnumType;
  205. /* DataEnumType */
  206. typedef enum {
  207. DataEnumType_string,
  208. DataEnumType_decimal,
  209. DataEnumType_integer,
  210. DataEnumType_dateTime,
  211. DataEnumType_boolean,
  212. DataEnumType_OptionList,
  213. DataEnumType_SequenceList,
  214. DataEnumType_MemberList
  215. } DataEnumType;
  216. /* DataTransferStatusEnumType */
  217. typedef enum {
  218. DataTransferStatusEnumType_Accepted,
  219. DataTransferStatusEnumType_Rejected,
  220. DataTransferStatusEnumType_UnknownMessageId,
  221. DataTransferStatusEnumType_UnknownVendorId
  222. } DataTransferStatusEnumType;
  223. /* DeleteCertificateStatusEnumType */
  224. typedef enum {
  225. DeleteCertificateStatusEnumType_Accepted,
  226. DeleteCertificateStatusEnumType_Failed,
  227. DeleteCertificateStatusEnumType_NotFound
  228. } DeleteCertificateStatusEnumType;
  229. /* DisplayMessageStatusEnumType */
  230. typedef enum {
  231. DisplayMessageStatusEnumType_Accepted,
  232. DisplayMessageStatusEnumType_NotSupportedMessageFormat,
  233. DisplayMessageStatusEnumType_Rejected,
  234. DisplayMessageStatusEnumType_NotSupportedPriority,
  235. DisplayMessageStatusEnumType_NotSupportedState,
  236. DisplayMessageStatusEnumType_UnknownTransaction
  237. } DisplayMessageStatusEnumType;
  238. /* EnergyTransferModeEnumType */
  239. typedef enum {
  240. EnergyTransferModeEnumType_DC,
  241. EnergyTransferModeEnumType_AC_single_phase,
  242. EnergyTransferModeEnumType_AC_two_phase,
  243. EnergyTransferModeEnumType_AC_three_phase
  244. } EnergyTransferModeEnumType;
  245. /* EventNotificationEnumType */
  246. typedef enum {
  247. EventNotificationEnumType_HardWiredNotification,
  248. EventNotificationEnumType_HardWiredMonitor,
  249. EventNotificationEnumType_PreconfiguredMonitor,
  250. EventNotificationEnumType_CustomMonitor
  251. } EventNotificationEnumType;
  252. /* EventTriggerEnumType */
  253. typedef enum {
  254. EventTriggerEnumType_Alerting,
  255. EventTriggerEnumType_Delta,
  256. EventTriggerEnumType_Periodic
  257. } EventTriggerEnumType;
  258. /* FirmwareStatusEnumType */
  259. typedef enum {
  260. FirmwareStatusEnumType_Downloaded,
  261. FirmwareStatusEnumType_DownloadFailed,
  262. FirmwareStatusEnumType_Downloading,
  263. FirmwareStatusEnumType_DownloadScheduled,
  264. FirmwareStatusEnumType_DownloadPaused,
  265. FirmwareStatusEnumType_Idle,
  266. FirmwareStatusEnumType_InstallationFailed,
  267. FirmwareStatusEnumType_Installing,
  268. FirmwareStatusEnumType_Installed,
  269. FirmwareStatusEnumType_InstallRebooting,
  270. FirmwareStatusEnumType_InstallScheduled,
  271. FirmwareStatusEnumType_InstallVerificationFailed,
  272. FirmwareStatusEnumType_InvalidSignature,
  273. FirmwareStatusEnumType_SignatureVerified
  274. } FirmwareStatusEnumType;
  275. /* GenericDeviceModelStatusEnumType */
  276. typedef enum {
  277. GenericDeviceModelStatusEnumType_Accepted,
  278. GenericDeviceModelStatusEnumType_Rejected,
  279. GenericDeviceModelStatusEnumType_NotSupported,
  280. GenericDeviceModelStatusEnumType_EmptyResultSet
  281. } GenericDeviceModelStatusEnumType;
  282. /* GenericStatusEnumType */
  283. typedef enum {
  284. GenericStatusEnumType_Accepted,
  285. GenericStatusEnumType_Rejected
  286. } GenericStatusEnumType;
  287. /* GetCertificateIdUseEnumType */
  288. typedef enum {
  289. GetCertificateIdUseEnumType_V2GRootCertificate,
  290. GetCertificateIdUseEnumType_MORootCertificate,
  291. GetCertificateIdUseEnumType_CSMSRootCertificate,
  292. GetCertificateIdUseEnumType_V2GCertificateChain,
  293. GetCertificateIdUseEnumType_ManufacturerRootCertificate
  294. } GetCertificateIdUseEnumType;
  295. /* GetCertificateStatusEnumType */
  296. typedef enum {
  297. GetCertificateStatusEnumType_Accepted,
  298. GetCertificateStatusEnumType_Failed
  299. } GetCertificateStatusEnumType;
  300. /* GetChargingProfileStatusEnumType */
  301. typedef enum {
  302. GetChargingProfileStatusEnumType_Accepted,
  303. GetChargingProfileStatusEnumType_NoProfiles
  304. } GetChargingProfileStatusEnumType;
  305. /* GetDisplayMessagesStatusEnumType */
  306. typedef enum {
  307. GetDisplayMessagesStatusEnumType_Accepted,
  308. GetDisplayMessagesStatusEnumType_Unknown
  309. } GetDisplayMessagesStatusEnumType;
  310. /* GetInstalledCertificateStatusEnumType */
  311. typedef enum {
  312. GetInstalledCertificateStatusEnumType_Accepted,
  313. GetInstalledCertificateStatusEnumType_NotFound
  314. } GetInstalledCertificateStatusEnumType;
  315. /* GetVariableStatusEnumType */
  316. typedef enum {
  317. GetVariableStatusEnumType_Accepted,
  318. GetVariableStatusEnumType_Rejected,
  319. GetVariableStatusEnumType_UnknownComponent,
  320. GetVariableStatusEnumType_UnknownVariable,
  321. GetVariableStatusEnumType_NotSupportedAttributeType
  322. } GetVariableStatusEnumType;
  323. /* HashAlgorithmEnumType */
  324. typedef enum {
  325. HashAlgorithmEnumType_SHA256,
  326. HashAlgorithmEnumType_SHA384,
  327. HashAlgorithmEnumType_SHA512
  328. } HashAlgorithmEnumType;
  329. /* IdTokenEnumType */
  330. typedef enum {
  331. IdTokenEnumType_Central,
  332. IdTokenEnumType_eMAID,
  333. IdTokenEnumType_ISO14443,
  334. IdTokenEnumType_KeyCode,
  335. IdTokenEnumType_Local,
  336. IdTokenEnumType_NoAuthorization,
  337. IdTokenEnumType_ISO15693
  338. } IdTokenEnumType;
  339. /* InstallCertificateUseEnumType */
  340. typedef enum {
  341. InstallCertificateUseEnumType_V2GRootCertificate,
  342. InstallCertificateUseEnumType_MORootCertificate,
  343. InstallCertificateUseEnumType_CSMSRootCertificate,
  344. InstallCertificateUseEnumType_ManufacturerRootCertificate
  345. } InstallCertificateUseEnumType;
  346. /* InstallCertificateStatusEnumType */
  347. typedef enum {
  348. InstallCertificateStatusEnumType_Accepted,
  349. InstallCertificateStatusEnumType_Failed,
  350. InstallCertificateStatusEnumType_Rejected
  351. } InstallCertificateStatusEnumType;
  352. /* Iso15118EVCertificateStatusEnumType */
  353. typedef enum {
  354. Iso15118EVCertificateStatusEnumType_Accepted,
  355. Iso15118EVCertificateStatusEnumType_Failed
  356. } Iso15118EVCertificateStatusEnumType;
  357. /* LocationEnumType */
  358. typedef enum {
  359. LocationEnumType_Body,
  360. LocationEnumType_Cable,
  361. LocationEnumType_EV,
  362. LocationEnumType_Inlet,
  363. LocationEnumType_Outlet
  364. } LocationEnumType;
  365. /* LogEnumType */
  366. typedef enum {
  367. LogEnumType_DiagnosticsLog,
  368. LogEnumType_SecurityLog
  369. } LogEnumType;
  370. /* LogStatusEnumType */
  371. typedef enum {
  372. LogStatusEnumType_Accepted,
  373. LogStatusEnumType_Rejected,
  374. LogStatusEnumType_AcceptedCanceled
  375. } LogStatusEnumType;
  376. /* MeasurandEnumType */
  377. typedef enum {
  378. MeasurandEnumType_Current_Export,
  379. MeasurandEnumType_Current_Import,
  380. MeasurandEnumType_Current_Offered,
  381. MeasurandEnumType_Energy_Active_Export_Register,
  382. MeasurandEnumType_Energy_Active_Import_Register,
  383. MeasurandEnumType_Energy_Reactive_Export_Register,
  384. MeasurandEnumType_Energy_Reactive_Import_Register,
  385. MeasurandEnumType_Energy_Active_Export_Interval,
  386. MeasurandEnumType_Energy_Active_Import_Interval,
  387. MeasurandEnumType_Energy_Active_Net,
  388. MeasurandEnumType_Energy_Reactive_Export_Interval,
  389. MeasurandEnumType_Energy_Reactive_Import_Interval,
  390. MeasurandEnumType_Energy_Reactive_Net,
  391. MeasurandEnumType_Energy_Apparent_Net,
  392. MeasurandEnumType_Energy_Apparent_Import,
  393. MeasurandEnumType_Energy_Apparent_Export,
  394. MeasurandEnumType_Frequency,
  395. MeasurandEnumType_Power_Active_Export ,
  396. MeasurandEnumType_Power_Active_Import,
  397. MeasurandEnumType_Power_Factor,
  398. MeasurandEnumType_Power_Offered,
  399. MeasurandEnumType_Power_Reactive_Export,
  400. MeasurandEnumType_Power_Reactive_Import,
  401. MeasurandEnumType_SoC,
  402. MeasurandEnumType_Voltage
  403. } MeasurandEnumType;
  404. /* MessageFormatEnumType */
  405. typedef enum {
  406. MessageFormatEnumType_ASCII,
  407. MessageFormatEnumType_HTML,
  408. MessageFormatEnumType_URI,
  409. MessageFormatEnumType_UTF8
  410. } MessageFormatEnumType;
  411. /* MessagePriorityEnumType */
  412. typedef enum {
  413. MessagePriorityEnumType_AlwaysFront,
  414. MessagePriorityEnumType_InFront,
  415. MessagePriorityEnumType_NormalCycle
  416. } MessagePriorityEnumType;
  417. /* MessageStateEnumType */
  418. typedef enum {
  419. MessageStateEnumType_Charging,
  420. MessageStateEnumType_Faulted,
  421. MessageStateEnumType_Idle,
  422. MessageStateEnumType_Unavailable
  423. } MessageStateEnumType;
  424. /* MessageTriggerEnumType */
  425. typedef enum {
  426. MessageTriggerEnumType_BootNotification,
  427. MessageTriggerEnumType_LogStatusNotification,
  428. MessageTriggerEnumType_FirmwareStatusNotification,
  429. MessageTriggerEnumType_Heartbeat,
  430. MessageTriggerEnumType_MeterValues,
  431. MessageTriggerEnumType_SignChargingStationCertificate,
  432. MessageTriggerEnumType_SignV2GCertificate,
  433. MessageTriggerEnumType_StatusNotification,
  434. MessageTriggerEnumType_TransactionEvent,
  435. MessageTriggerEnumType_SignCombinedCertificate,
  436. MessageTriggerEnumType_PublishFirmwareStatusNotification
  437. } MessageTriggerEnumType;
  438. /* MonitorEnumType */
  439. typedef enum {
  440. MonitorEnumType_UpperThreshold,
  441. MonitorEnumType_LowerThreshold,
  442. MonitorEnumType_Delta,
  443. MonitorEnumType_Periodic,
  444. MonitorEnumType_PeriodicClockAligned
  445. } MonitorEnumType;
  446. /* MonitoringBaseEnumType */
  447. typedef enum {
  448. MonitoringBaseEnumType_All,
  449. MonitoringBaseEnumType_FactoryDefault,
  450. MonitoringBaseEnumType_HardWiredOnly
  451. } MonitoringBaseEnumType;
  452. /* MonitoringCriterionEnumType */
  453. typedef enum {
  454. MonitoringCriterionEnumType_ThresholdMonitoring,
  455. MonitoringCriterionEnumType_DeltaMonitoring,
  456. MonitoringCriterionEnumType_PeriodicMonitoring
  457. } MonitoringCriterionEnumType;
  458. /* MutabilityEnumType */
  459. typedef enum {
  460. MutabilityEnumType_ReadOnly,
  461. MutabilityEnumType_WriteOnly,
  462. MutabilityEnumType_ReadWrite
  463. } MutabilityEnumType;
  464. /* NotifyEVChargingNeedsStatusEnumType */
  465. typedef enum {
  466. NotifyEVChargingNeedsStatusEnumType_Accepted,
  467. NotifyEVChargingNeedsStatusEnumType_Rejected,
  468. NotifyEVChargingNeedsStatusEnumType_Processing
  469. } NotifyEVChargingNeedsStatusEnumType;
  470. /* OCPPInterfaceEnumType */
  471. typedef enum {
  472. OCPPInterfaceEnumType_Wired0,
  473. OCPPInterfaceEnumType_Wired1,
  474. OCPPInterfaceEnumType_Wired2,
  475. OCPPInterfaceEnumType_Wired3,
  476. OCPPInterfaceEnumType_Wireless0,
  477. OCPPInterfaceEnumType_Wireless1,
  478. OCPPInterfaceEnumType_Wireless2,
  479. OCPPInterfaceEnumType_Wireless3
  480. } OCPPInterfaceEnumType;
  481. /* OCPPTransportEnumType */
  482. typedef enum {
  483. OCPPTransportEnumType_JSON,
  484. OCPPTransportEnumType_SOAP
  485. } OCPPTransportEnumType;
  486. /* OCPPVersionEnumType */
  487. typedef enum {
  488. OCPPVersionEnumType_OCPP12,
  489. OCPPVersionEnumType_OCPP15,
  490. OCPPVersionEnumType_OCPP16,
  491. OCPPVersionEnumType_OCPP20
  492. } OCPPVersionEnumType;
  493. /* OperationalStatusEnumType */
  494. typedef enum {
  495. OperationalStatusEnumType_Inoperative,
  496. OperationalStatusEnumType_Operative
  497. } OperationalStatusEnumType;
  498. /* PhaseEnumType */
  499. typedef enum {
  500. PhaseEnumType_L1,
  501. PhaseEnumType_L2,
  502. PhaseEnumType_L3,
  503. PhaseEnumType_N,
  504. PhaseEnumType_L1_N,
  505. PhaseEnumType_L2_N,
  506. PhaseEnumType_L3_N,
  507. PhaseEnumType_L1_L2,
  508. PhaseEnumType_L2_L3,
  509. PhaseEnumType_L3_L1
  510. } PhaseEnumType;
  511. /* PublishFirmwareStatusEnumType */
  512. typedef enum {
  513. PublishFirmwareStatusEnumType_Downloaded,
  514. PublishFirmwareStatusEnumType_DownloadFailed,
  515. PublishFirmwareStatusEnumType_Downloading,
  516. PublishFirmwareStatusEnumType_DownloadScheduled,
  517. PublishFirmwareStatusEnumType_DownloadPaused,
  518. PublishFirmwareStatusEnumType_PublishFailed,
  519. PublishFirmwareStatusEnumType_Published,
  520. PublishFirmwareStatusEnumType_InvalidChecksum,
  521. PublishFirmwareStatusEnumType_ChecksumVerified
  522. } PublishFirmwareStatusEnumType;
  523. /* ReadingContextEnumType */
  524. typedef enum {
  525. ReadingContextEnumType_Interruption_Begin,
  526. ReadingContextEnumType_Interruption_End,
  527. ReadingContextEnumType_Other,
  528. ReadingContextEnumType_Sample_Clock,
  529. ReadingContextEnumType_Sample_Periodic,
  530. ReadingContextEnumType_Transaction_Begin,
  531. ReadingContextEnumType_Transaction_End,
  532. ReadingContextEnumType_Trigger
  533. } ReadingContextEnumType;
  534. /* ReasonEnumType */
  535. typedef enum {
  536. ReasonEnumType_DeAuthorized,
  537. ReasonEnumType_EmergencyStop,
  538. ReasonEnumType_EnergyLimitReached,
  539. ReasonEnumType_EVDisconnected,
  540. ReasonEnumType_GroundFault,
  541. ReasonEnumType_ImmediateReset,
  542. ReasonEnumType_Local,
  543. ReasonEnumType_LocalOutOfCredit,
  544. ReasonEnumType_MasterPass,
  545. ReasonEnumType_Other,
  546. ReasonEnumType_OvercurrentFault,
  547. ReasonEnumType_PowerLoss,
  548. ReasonEnumType_PowerQuality,
  549. ReasonEnumType_Reboot,
  550. ReasonEnumType_Remote,
  551. ReasonEnumType_SOCLimitReached,
  552. ReasonEnumType_StoppedByEV,
  553. ReasonEnumType_TimeLimitReached,
  554. ReasonEnumType_Timeout
  555. } ReasonEnumType;
  556. /* RecurrencyKindEnumType */
  557. typedef enum {
  558. RecurrencyKindEnumType_Daily,
  559. RecurrencyKindEnumType_Weekly
  560. } RecurrencyKindEnumType;
  561. /* RegistrationStatusEnumType */
  562. typedef enum {
  563. RegistrationStatusEnumType_Accepted,
  564. RegistrationStatusEnumType_Pending,
  565. RegistrationStatusEnumType_Rejected
  566. } RegistrationStatusEnumType;
  567. /* ReportBaseEnumType */
  568. typedef enum {
  569. ReportBaseEnumType_ConfigurationInventory,
  570. ReportBaseEnumType_FullInventory,
  571. ReportBaseEnumType_SummaryInventory
  572. } ReportBaseEnumType;
  573. /* RequestStartStopStatusEnumType */
  574. typedef enum {
  575. RequestStartStopStatusEnumType_Accepted,
  576. RequestStartStopStatusEnumType_Rejected
  577. } RequestStartStopStatusEnumType;
  578. /* ReservationUpdateStatusEnumType */
  579. typedef enum {
  580. ReservationUpdateStatusEnumType_Expired,
  581. ReservationUpdateStatusEnumType_Removed
  582. } ReservationUpdateStatusEnumType;
  583. /* ReserveNowStatusEnumType */
  584. typedef enum {
  585. ReserveNowStatusEnumType_Accepted,
  586. ReserveNowStatusEnumType_Faulted,
  587. ReserveNowStatusEnumType_Occupied,
  588. ReserveNowStatusEnumType_Rejected,
  589. ReserveNowStatusEnumType_Unavailable
  590. } ReserveNowStatusEnumType;
  591. /* ResetEnumType */
  592. typedef enum {
  593. ResetEnumType_Immediate,
  594. ResetEnumType_OnIdle
  595. } ResetEnumType;
  596. /* ResetStatusEnumType */
  597. typedef enum {
  598. ResetStatusEnumType_Accepted,
  599. ResetStatusEnumType_Rejected,
  600. ResetStatusEnumType_Scheduled
  601. } ResetStatusEnumType;
  602. /* SetMonitoringStatusEnumType */
  603. typedef enum {
  604. SetMonitoringStatusEnumType_Accepted,
  605. SetMonitoringStatusEnumType_UnknownComponent,
  606. SetMonitoringStatusEnumType_UnknownVariable,
  607. SetMonitoringStatusEnumType_UnsupportedMonitorType,
  608. SetMonitoringStatusEnumType_Rejected,
  609. SetMonitoringStatusEnumType_OutOfRange,
  610. SetMonitoringStatusEnumType_Duplicate
  611. } SetMonitoringStatusEnumType;
  612. /* SetNetworkProfileStatusEnumType */
  613. typedef enum {
  614. SetNetworkProfileStatusEnumType_Accepted,
  615. SetNetworkProfileStatusEnumType_Rejected,
  616. SetNetworkProfileStatusEnumType_Failed
  617. } SetNetworkProfileStatusEnumType;
  618. /* SetVariableStatusEnumType */
  619. typedef enum {
  620. SetVariableStatusEnumType_Accepted,
  621. SetVariableStatusEnumType_Rejected,
  622. SetVariableStatusEnumType_InvalidValue,
  623. SetVariableStatusEnumType_UnknownComponent,
  624. SetVariableStatusEnumType_UnknownVariable,
  625. SetVariableStatusEnumType_NotSupportedAttributeType,
  626. SetVariableStatusEnumType_OutOfRange,
  627. SetVariableStatusEnumType_RebootRequired
  628. } SetVariableStatusEnumType;
  629. /* TransactionEventEnumType */
  630. typedef enum {
  631. TransactionEventEnumType_Ended,
  632. TransactionEventEnumType_Started,
  633. TransactionEventEnumType_Updated
  634. } TransactionEventEnumType;
  635. /* TriggerMessageStatusEnumType */
  636. typedef enum {
  637. TriggerMessageStatusEnumType_Accepted,
  638. TriggerMessageStatusEnumType_Rejected,
  639. TriggerMessageStatusEnumType_NotImplemented
  640. } TriggerMessageStatusEnumType;
  641. /* TriggerReasonEnumType */
  642. typedef enum {
  643. TriggerReasonEnumType_Authorized,
  644. TriggerReasonEnumType_CablePluggedIn,
  645. TriggerReasonEnumType_ChargingRateChanged,
  646. TriggerReasonEnumType_ChargingStateChanged,
  647. TriggerReasonEnumType_Deauthorized,
  648. TriggerReasonEnumType_EnergyLimitReached,
  649. TriggerReasonEnumType_EVCommunicationLost,
  650. TriggerReasonEnumType_EVConnectTimeout,
  651. TriggerReasonEnumType_MeterValueClock,
  652. TriggerReasonEnumType_MeterValuePeriodic,
  653. TriggerReasonEnumType_TimeLimitReached,
  654. TriggerReasonEnumType_Trigger,
  655. TriggerReasonEnumType_UnlockCommand,
  656. TriggerReasonEnumType_StopAuthorized,
  657. TriggerReasonEnumType_EVDeparted,
  658. TriggerReasonEnumType_EVDetected,
  659. TriggerReasonEnumType_RemoteStop,
  660. TriggerReasonEnumType_RemoteStart,
  661. TriggerReasonEnumType_AbnormalCondition,
  662. TriggerReasonEnumType_SignedDataReceived,
  663. TriggerReasonEnumType_ResetCommand
  664. } TriggerReasonEnumType;
  665. /* UnlockStatusEnumType */
  666. typedef enum {
  667. UnlockStatusEnumType_Unlocked,
  668. UnlockStatusEnumType_UnlockFailed,
  669. UnlockStatusEnumType_OngoingAuthorizedTransaction,
  670. UnlockStatusEnumType_UnknownConnector
  671. } UnlockStatusEnumType;
  672. /* UnpublishFirmwareStatusEnumType */
  673. typedef enum {
  674. Unpublished_DownloadOngoing,
  675. Unpublished_NoFirmware,
  676. Unpublished_Unpublished
  677. } UnpublishFirmwareStatusEnumType;
  678. /* UpdateEnumType */
  679. typedef enum {
  680. UpdateEnumType_Differential,
  681. UpdateEnumType_Full
  682. } UpdateEnumType;
  683. /* UpdateFirmwareStatusEnumType */
  684. typedef enum {
  685. UpdateFirmwareStatusEnumType_Accepted,
  686. UpdateFirmwareStatusEnumType_Rejected,
  687. UpdateFirmwareStatusEnumType_AcceptedCanceled,
  688. UpdateFirmwareStatusEnumType_InvalidCertificate,
  689. UpdateFirmwareStatusEnumType_RevokedCertificate
  690. } UpdateFirmwareStatusEnumType;
  691. /* UpdateStatusEnumType */
  692. typedef enum {
  693. UpdateStatusEnumType_Accepted,
  694. UpdateStatusEnumType_Failed,
  695. UpdateStatusEnumType_VersionMismatch
  696. } UpdateStatusEnumType;
  697. /* UploadLogStatusEnumType */
  698. typedef enum {
  699. UploadLogStatusEnumType_BadMessage,
  700. UploadLogStatusEnumType_Idle,
  701. UploadLogStatusEnumType_NotSupportedOperation,
  702. UploadLogStatusEnumType_PermissionDenied,
  703. UploadLogStatusEnumType_Uploaded,
  704. UploadLogStatusEnumType_UploadFailure,
  705. UploadLogStatusEnumType_Uploading
  706. } UploadLogStatusEnumType;
  707. /* VPNEnumType */
  708. typedef enum {
  709. VPNEnumType_IKEv2,
  710. VPNEnumType_IPSec,
  711. VPNEnumType_L2TP,
  712. VPNEnumType_PPTP
  713. } VPNEnumType;
  714. struct StructPeriod
  715. {
  716. int StartPeriod;
  717. float Limit;//0.1;
  718. int NumberPhases;
  719. };
  720. struct StructProfile
  721. {
  722. int Duration;
  723. int TotalPeriod;
  724. struct StructPeriod Period[10];
  725. };
  726. //===============================================
  727. // Common routine
  728. //===============================================
  729. int initialConfigurationTable(void);
  730. void StoreConfigurationTable(void);
  731. void GetStartTransactionIdTag(int gun_index);
  732. //==========================================
  733. // send request routine
  734. //==========================================
  735. int sendAuthorizeRequest(int gun_index);
  736. int sendBootNotificationRequest(void);
  737. int sendClearedChargingLimitRequest(int gun_index);
  738. int sendDataTransferRequest(int gun_index);
  739. int sendFirmwareStatusNotificationRequest(char *status);
  740. int sendGet15118EVCertificateRequest();
  741. int sendGetCertificateStatusRequest();
  742. int sendHeartbeatRequest();
  743. int sendLogStatusNotificationRequest(char *status);
  744. int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType);
  745. int sendNotifyChargingLimitRequest(int gun_index);
  746. int sendNotifyCustomerInformationRequest();
  747. int sendNotifyDisplayMessagesRequest();
  748. int sendNotifyEVChargingNeedsRequest(int gun_index);
  749. int sendNotifyEVChargingScheduleRequest(int gun_index);
  750. int sendNotifyEventRequest();
  751. int sendNotifyMonitoringReportRequest();
  752. int sendNotifyReportRequest();
  753. int sendPublishFirmwareStatusNotificationRequest();
  754. int sendReportChargingProfilesRequest(int gun_index);
  755. int sendReservationStatusUpdateRequest(int gun_index);
  756. int sendSecurityEventNotificationRequest();
  757. int sendSignCertificateRequest();
  758. int sendStatusNotificationRequest(int gun_index);
  759. int sendTransactionEventRequest(int gun_index);
  760. //==========================================
  761. // send confirm routine
  762. //==========================================
  763. int sendCancelReservationConfirmation(char *uuid, unsigned char gun_index);
  764. int sendCertificateSignedConfirmation(char *uuid);
  765. int sendChangeAvailabilityConfirmation(char *uuid, unsigned char gun_index);
  766. int sendClearCacheConfirmation(char *uuid);
  767. int sendClearChargingProfileConfirmation(char *uuid,char *payload);
  768. int sendClearDisplayMessageConfirmation(char *uuid);
  769. int sendClearVariableMonitoringConfirmation(char *uuid, unsigned char variableQuantity);
  770. int sendCostUpdatedConfirmation(char *uuid);
  771. int sendCustomerInformationConfirmation(char *uuid);
  772. int sendDataTransferConfirmation(char *uuid, unsigned char gun_index);
  773. int sendDeleteCertificateConfirmation(char *uuid);
  774. int sendGetBaseReportConfirmation(char *uuid);
  775. int sendGetChargingProfilesConfirmation(char *uuid, unsigned char gun_index);
  776. int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connectorIdInt,int nPeriod);
  777. int sendGetDisplayMessagesConfirmation(char *uuid);
  778. int sendGetInstalledCertificateIdsConfirmation(char *uuid, unsigned char certQuantity);
  779. int sendGetLocalListVersionConfirmation(char *uuid);
  780. int sendGetLogConfirmation(char *uuid);
  781. int sendGetMonitoringReportConfirmation(char *uuid);
  782. int sendGetReportConfirmation(char *uuid);
  783. int sendGetTransactionStatusConfirmation(char *uuid, unsigned char gun_index);
  784. int sendGetVariablesConfirmation(char *uuid, unsigned char variableQuantity);
  785. int sendInstallCertificateConfirmation(char *uuid);
  786. int sendPublishFirmwareConfirmation(char *uuid);
  787. int sendRemoteStartTransactionConfirmation(char *uuid, unsigned char gun_index);
  788. int sendRemoteStopTransactionConfirmation(char *uuid, unsigned char gun_index);
  789. int sendReserveNowConfirmation(char *uuid, unsigned char gun_index);
  790. int sendResetConfirmation(char *uuid);
  791. int sendSendLocalListConfirmation(char *uuid);
  792. int sendSetChargingProfileConfirmation(char *uuid, unsigned char gun_index);
  793. int sendSetDisplayMessagesConfirmation(char *uuid);
  794. int sendSetMonitoringBaseConfirmation(char *uuid);
  795. int sendSetMonitoringLevelConfirmation(char *uuid);
  796. int sendSetNetworkProfileConfirmation(char *uuid);
  797. int sendSetVariableMonitoringConfirmation(char *uuid, unsigned char variableQuantity);
  798. int sendSetVariableConfirmation(char *uuid, unsigned char variableQuantity);
  799. int sendTriggerMessageConfirmation(char *uuid);
  800. int sendUnlockConnectorConfirmation(char *uuid, unsigned char gun_index);
  801. int sendUnpublishFirmwareConfirmation(char *uuid);
  802. int sendUpdateFirmwareConfirmation(char *uuid);
  803. int sendUnknownConfirmation(char *uuid);
  804. //==========================================
  805. // send CallError routine
  806. //==========================================
  807. void SendCallError(char *uniqueId, char *action, char *errorCode, char *errorDescription);
  808. //==========================================
  809. // Handle server request routine Start
  810. //==========================================
  811. int handleCancelReservationRequest(char *uuid, char *payload);
  812. int handleCertificateSignedRequest(char *uuid, char *payload);
  813. int handleChangeAvailabilityRequest(char *uuid, char *payload);
  814. int handleClearCacheRequest(char *uuid, char *payload);
  815. int handleClearChargingProfileRequest(char *uuid, char *payload);
  816. int handleClearDisplayMessageRequest(char *uuid, char *payload);
  817. int handleClearVariableMonitoringRequest(char *uuid, char *payload);
  818. int handleCostUpdatedRequest(char *uuid, char *payload);
  819. int handleCustomerInformationRequest(char *uuid, char *payload);
  820. int handleDataTransferRequest(char *uuid, char *payload);
  821. int handleDeleteCertificateRequest(char *uuid, char *payload);
  822. int handleGetBaseReportRequest(char *uuid, char *payload);
  823. int handleGetChargingProfilesRequest(char *uuid, char *payload);
  824. int handleGetCompositeScheduleRequest(char *uuid, char *payload);
  825. int handleGetDisplayMessagesRequest(char *uuid, char *payload);
  826. int handleGetInstalledCertificateIdsRequest(char *uuid, char *payload);
  827. int handleGetLocalListVersionRequest(char *uuid, char *payload);
  828. int handleGetLogRequest(char *uuid, char *payload);
  829. int handleGetMonitoringReportRequest(char *uuid, char *payload);
  830. int handleGetReportRequest(char *uuid, char *payload);
  831. int handleGetTransactionStatusRequest(char *uuid, char *payload);
  832. int handleGetVariablesRequest(char *uuid, char *payload);
  833. int handleInstallCertificateRequest(char *uuid, char *payload);
  834. int handlePublishFirmwareRequest(char *uuid, char *payload);
  835. int handleRemoteStartTransactionRequest(char *uuid, char *payload);
  836. int handleRemoteStopTransactionRequest(char *uuid, char *payload);
  837. int handleReserveNowRequest(char *uuid, char *payload);
  838. int handleResetRequest(char *uuid, char *payload);
  839. int handleSendLocalListRequest(char *uuid, char *payload);
  840. int handleSetChargingProfileRequest(char *uuid, char *payload);
  841. int handleSetDisplayMessagesRequest(char *uuid, char *payload);
  842. int handleSetMonitoringBaseRequest(char *uuid, char *payload);
  843. int handleSetMonitoringLevelRequest(char *uuid, char *payload);
  844. int handleSetNetworkProfileRequest(char *uuid, char *payload);
  845. int handleSetVariableMonitoringRequest(char *uuid, char *payload);
  846. int handleSetVariablesRequest(char *uuid, char *payload);
  847. int handleTriggerMessageRequest(char *uuid, char *payload);
  848. int handleUnlockConnectorRequest(char *uuid, char *payload);
  849. int handleUnpublishFirmwareRequest(char *uuid, char *payload);
  850. int handleUpdateFirmwareRequest(char *uuid, char *payload);
  851. int handleUnknownRequest(char *uuid, char *payload);
  852. void handleAuthorizeResponse(char *payload, int gun_index);
  853. void handleBootNotificationResponse(char *payload, int gun_index);
  854. void handleClearedChargingLimitResponse(char *payload, int gun_index);
  855. void handleDataTransferResponse(char *payload, int gun_index);
  856. void handleFirmwareStatusNotificationResponse(char *payload, int gun_index);
  857. void handleGet15118EVCertificateResponse(char *payload, int gun_index);
  858. void hanldeGetCertificateStatusResponse(char *payload, int gun_index);
  859. void handleHeartbeatResponse(char *payload, int gun_index);
  860. void hanldeLogStatusNotificationResponse(char *payload, int gun_index);
  861. void handleMeterValuesResponse(char *payload, int gun_index);
  862. void handleNotifyChargingLimitResponse(char *payload, int gun_index);
  863. void hanldeNotifyCustomerInformationResponse(char *payload, int gun_index);
  864. void hanldeNotifyDisplayMessagesResponse(char *payload, int gun_index);
  865. void hanldeNotifyEVChargingNeedsResponse(char *payload, int gun_index);
  866. void hanldeNotifyEVChargingScheduleResponse(char *payload, int gun_index);
  867. void hanldeNotifyEventResponse(char *payload, int gun_index);
  868. void hanldeNotifyMonitoringReportResponse(char *payload, int gun_index);
  869. void hanldeNotifyReportResponse(char *payload, int gun_index);
  870. void hanldePublishFirmwareStatusNotificationResponse(char *payload, int gun_index);
  871. void hanldeReportChargingProfilesResponse(char *payload, int gun_index);
  872. void hanldeReservationStatusUpdateResponse(char *payload, int gun_index);
  873. void hanldeSecurityEventNotificationResponse(char *payload, int gun_index);
  874. void hanldeSignCertificateResponse(char *payload, int gun_index);
  875. void handleStatusNotificationResponse(char *payload, int gun_index);
  876. void hanldeTransactionEvenResponse(char *payload, int gun_index);
  877. //==========================================
  878. // Handle Error routine
  879. //==========================================
  880. void handleError(char *id, char *errorCode, char *errorDescription,char *payload);
  881. //===============================================
  882. // Common routine
  883. //===============================================
  884. void getKeyValue(char *keyReq);
  885. int setKeyValue(char *key, char *value);
  886. int updateSetting(char *key, char *value);
  887. int httpDownLoadFile(char *location, char *path, char *filename,char *url);
  888. int ftpDownLoadFile(char *location, char *user, char *password, int port, char *path, char *filename,char *url);
  889. void *UpdateFirmwareProcess(void* data);
  890. void* GetDiagnosticsProcess(void* data);
  891. int httpUploadFile(char *location, char *path, char *filename,char *url);
  892. int ftpUploadFile(char *location, char *user, char *password, int port, char *path, char *fnamePlusPath,char *filename);
  893. int get_file_contents(const char* filename, char** outbuffer);
  894. void LWS_Send(char * str);
  895. void LWS_SendNow(char * str);
  896. extern int queue_operation(int type, char *frontUUID, char *frontData);
  897. int GetOcppServerURL();
  898. int GetOcppPath();
  899. int GetOcppPort();
  900. int GetTransactionId(int gunindex, unsigned char idTag[], uint8_t isStopTransaction);
  901. void SetTransactionIdZero(int transactionId);
  902. void GetChargingProfileRequest(int gunindex);
  903. void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart,int ReservationId,unsigned char Timestamp[]);
  904. void splitstring(char *src,const char *separator,char **dest,int *num);
  905. int GetWebSocketPingInterval(void);
  906. int GetInternetConn(void);
  907. int isConnectorInitMode(int gun_index);
  908. void refreshProcDogTimer();
  909. int GetServerSign(void);
  910. void SetServerSign(int value);
  911. int GetBootNotificationInterval(void);
  912. void InitialSystemValue(void);
  913. void checkTempStopTransaction(int gun_index);
  914. void storeTempStopTransaction(int gun_index);
  915. #endif