MessageHandler.h 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  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 sendGetGetDisplayMessagesConfirmation(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 sendSetDisplayMessageConfirmation(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. //==========================================
  804. // send CallError routine
  805. //==========================================
  806. void SendCallError(char *uniqueId, char *action, char *errorCode, char *errorDescription);
  807. //==========================================
  808. // Handle server request routine Start
  809. //==========================================
  810. int handleCancelReservationRequest(char *uuid, char *payload);
  811. int handleCertificateSignedRequest(char *uuid, char *payload);
  812. int handleChangeAvailabilityRequest(char *uuid, char *payload);
  813. int handleClearCacheRequest(char *uuid, char *payload);
  814. int handleClearChargingProfileRequest(char *uuid, char *payload);
  815. int handleClearDisplayMessageRequest(char *uuid, char *payload);
  816. int handleClearVariableMonitoringRequest(char *uuid, char *payload);
  817. int handleCostUpdatedRequest(char *uuid, char *payload);
  818. int handleCustomerInformationRequest(char *uuid, char *payload);
  819. int handleDataTransferRequest(char *uuid, char *payload);
  820. int handleDeleteCertificateRequest(char *uuid, char *payload);
  821. int handleGetBaseReportRequest(char *uuid, char *payload);
  822. int handleGetChargingProfilesRequest(char *uuid, char *payload);
  823. int handleGetCompositeScheduleRequest(char *uuid, char *payload);
  824. int handleGetDisplayMessagesRequest(char *uuid, char *payload);
  825. int handleGetInstalledCertificateIdsRequest(char *uuid, char *payload);
  826. int handleGetLocalListVersionRequest(char *uuid, char *payload);
  827. int handleGetLogRequest(char *uuid, char *payload);
  828. int handleGetMonitoringReportRequest(char *uuid, char *payload);
  829. int handleGetReportRequest(char *uuid, char *payload);
  830. int handleGetTransactionStatusRequest(char *uuid, char *payload);
  831. int handleGetVariablesRequest(char *uuid, char *payload);
  832. int handleInstallCertificateRequest(char *uuid, char *payload);
  833. int handlePublishFirmwareRequest(char *uuid, char *payload);
  834. int handleRemoteStartTransactionRequest(char *uuid, char *payload);
  835. int handleRemoteStopTransactionRequest(char *uuid, char *payload);
  836. int handleReserveNowTransactionRequest(char *uuid, char *payload);
  837. int handleResetRequest(char *uuid, char *payload);
  838. int handleSendLocalListRequest(char *uuid, char *payload);
  839. int handleSetChargingProfileRequest(char *uuid, char *payload);
  840. int handleSetDisplayMessageRequest(char *uuid, char *payload);
  841. int handleSetMonitoringBaseRequest(char *uuid, char *payload);
  842. int handleSetMonitoringLevelRequest(char *uuid, char *payload);
  843. int handleSetNetworkProfileRequest(char *uuid, char *payload);
  844. int handleSetVariableMonitoringRequest(char *uuid, char *payload);
  845. int handleSetVariablesRequest(char *uuid, char *payload);
  846. int handleTriggerMessageRequest(char *uuid, char *payload);
  847. int handleUnlockConnectorRequest(char *uuid, char *payload);
  848. int handleUnpublishFirmwareRequest(char *uuid, char *payload);
  849. int handleUpdateFirmwareRequest(char *uuid, char *payload);
  850. void handleAuthorizeResponse(char *payload, int gun_index);
  851. void handleBootNotificationResponse(char *payload, int gun_index);
  852. void handleClearedChargingLimitResponse(char *payload, int gun_index);
  853. void handleDataTransferResponse(char *payload, int gun_index);
  854. void handleFirmwareStatusNotificationResponse(char *payload, int gun_index);
  855. void handleGet15118EVCertificateResponse(char *payload, int gun_index);
  856. void hanldeGetCertificateStatusResponse(char *payload, int gun_index);
  857. void handleHeartbeatResponse(char *payload, int gun_index);
  858. void hanldeLogStatusNotificationResponse(char *payload, int gun_index);
  859. void handleMeterValuesResponse(char *payload, int gun_index);
  860. void handleNotifyChargingLimitResponse(char *payload, int gun_index);
  861. void hanldeNotifyCustomerInformationResponse(char *payload, int gun_index);
  862. void hanldeNotifyDisplayMessagesResponse(char *payload, int gun_index);
  863. void hanldeNotifyEVChargingNeedsResponse(char *payload, int gun_index);
  864. void hanldeNotifyEVChargingScheduleResponse(char *payload, int gun_index);
  865. void hanldeNotifyEventResponse(char *payload, int gun_index);
  866. void hanldeNotifyMonitoringReportResponse(char *payload, int gun_index);
  867. void hanldeNotifyReportResponse(char *payload, int gun_index);
  868. void hanldePublishFirmwareStatusNotificationResponse(char *payload, int gun_index);
  869. void hanldeReportChargingProfilesResponse(char *payload, int gun_index);
  870. void hanldeReservationStatusUpdateResponse(char *payload, int gun_index);
  871. void hanldeSecurityEventNotificationResponse(char *payload, int gun_index);
  872. void hanldeSignCertificateResponse(char *payload, int gun_index);
  873. void handleStatusNotificationResponse(char *payload, int gun_index);
  874. void hanldeTransactionEvenResponse(char *payload, int gun_index);
  875. //==========================================
  876. // Handle Error routine
  877. //==========================================
  878. void handleError(char *id, char *errorCode, char *errorDescription,char *payload);
  879. //===============================================
  880. // Common routine
  881. //===============================================
  882. void getKeyValue(char *keyReq);
  883. int setKeyValue(char *key, char *value);
  884. int updateSetting(char *key, char *value);
  885. int httpDownLoadFile(char *location, char *path, char *filename,char *url);
  886. int ftpDownLoadFile(char *location, char *user, char *password, int port, char *path, char *filename,char *url);
  887. void *UpdateFirmwareProcess(void* data);
  888. void* GetDiagnosticsProcess(void* data);
  889. int httpUploadFile(char *location, char *path, char *filename,char *url);
  890. int ftpFile(char *location, char *user, char *password, int port, char *path, char *fnamePlusPath,char *filename);
  891. int get_file_contents(const char* filename, char** outbuffer);
  892. void LWS_Send(char * str);
  893. void LWS_SendNow(char * str);
  894. extern int queue_operation(int type, char *frontUUID, char *frontData);
  895. int GetOcppServerURL();
  896. int GetOcppPath();
  897. int GetOcppPort();
  898. int GetTransactionId(int gunindex, unsigned char idTag[], uint8_t isStopTransaction);
  899. void SetTransactionIdZero(int transactionId);
  900. void GetChargingProfileRequest(int gunindex);
  901. void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart,int ReservationId,unsigned char Timestamp[]);
  902. void splitstring(char *src,const char *separator,char **dest,int *num);
  903. int GetWebSocketPingInterval(void);
  904. int GetInternetConn(void);
  905. int GetServerSign(void);
  906. void SetServerSign(int value);
  907. int GetBootNotificationInterval(void);
  908. void InitialSystemValue(void);
  909. void checkTempStopTransaction(int gun_index);
  910. void storeTempStopTransaction(int gun_index);
  911. #endif