MessageHandler.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. #ifndef MessageHandler_H
  2. #define MessageHandler_H
  3. //===================================
  4. // Define CP State constant
  5. //===================================
  6. #define CP_STATE_UNKNOWN 0
  7. #define CP_STATE_A 1
  8. #define CP_STATE_B 2
  9. #define CP_STATE_C 3
  10. #define CP_STATE_D 4
  11. #define CP_STATE_E 5
  12. #define CP_STATE_F 6
  13. //==========================================
  14. // Init all Enumeration & Mapping String
  15. //==========================================
  16. #define MACROSTR(k) #k
  17. /*ChargePointErrorCode*/
  18. typedef enum {
  19. ConnectorLockFailure,
  20. EVCommunicationError,
  21. GroundFailure,
  22. HighTemperature,
  23. InternalError,
  24. LocalListConflict,
  25. NoError,
  26. OtherError,
  27. OverCurrentFailure,
  28. OverVoltage,
  29. PowerMeterFailure,
  30. PowerSwitchFailure,
  31. ReaderFailure,
  32. ResetFailure,
  33. UnderVoltage,
  34. WeakSignal
  35. } ChargePointErrorCode;
  36. /*ChargePointStatus*/
  37. typedef enum {
  38. Available =0,
  39. Preparing,
  40. Charging,
  41. SuspendedEVSE,
  42. SuspendedEV,
  43. Finishing,
  44. Reserved,
  45. Unavailable,
  46. Faulted
  47. } ChargePointStatus;
  48. /*AvailabilityType*/
  49. typedef enum {
  50. RegistrationStatus_Accepted,
  51. RegistrationStatus_Pending,
  52. RegistrationStatus_Rejected
  53. } RegistrationStatus;
  54. /*AvailabilityType*/
  55. typedef enum {
  56. Inoperative,
  57. Operative
  58. } AvailabilityType;
  59. /*AvailabilityStatus*/
  60. typedef enum {
  61. Accepted,
  62. Rejected,
  63. Scheduled
  64. } AvailabilityStatus;
  65. /*ConfigurationStatus*/
  66. typedef enum {
  67. ConfigurationStatus_Accepted,
  68. ConfigurationStatus_Rejected,
  69. RebootRequired,
  70. NotSupported
  71. } ConfigurationStatus;
  72. /*ClearCacheStatus*/
  73. typedef enum {
  74. ClearCacheStatus_Accepted,
  75. ClearCacheStatus_Rejected
  76. } ClearCacheStatus;
  77. /*ChargingProfilePurposeType*/
  78. typedef enum {
  79. ChargePointMaxProfile,
  80. TxDefaultProfile,
  81. TxProfile
  82. } ChargingProfilePurposeType;
  83. /*ChargingProfileStatus*/
  84. typedef enum {
  85. ChargingProfileStatus_Accepted,
  86. ChargingProfileStatus_Rejected,
  87. ChargingProfileStatus_NotSupported
  88. } ChargingProfileStatus;
  89. /*ClearChargingProfileStatus*/
  90. typedef enum {
  91. ClearChargingProfileStatus_Accepted,
  92. ClearChargingProfileStatus_Unknown
  93. } ClearChargingProfileStatus;
  94. /*GetCompositeScheduleStatus*/
  95. typedef enum {
  96. GetCompositeScheduleStatus_Accepted,
  97. GetCompositeScheduleStatus_Rejected
  98. } GetCompositeScheduleStatus;
  99. /*ChargingRateUnitType*/
  100. typedef enum {
  101. ChargingRateUnitType_W,
  102. ChargingRateUnitType_A
  103. } ChargingRateUnitType;
  104. /*AuthorizationStatus*/
  105. typedef enum {
  106. AuthorizationStatus_Accepted ,
  107. AuthorizationStatus_Blocked ,
  108. AuthorizationStatus_Expired ,
  109. AuthorizationStatus_Invalid ,
  110. AuthorizationStatus_ConcurrentTx
  111. } AuthorizationStatus;
  112. /*UpdateType*/
  113. typedef enum {
  114. Differential ,
  115. Full
  116. } UpdateType;
  117. /*UpdateStatus*/
  118. typedef enum {
  119. UpdateStatus_Accepted ,
  120. UpdateStatus_Failed ,
  121. UpdateStatus_NotSupported ,
  122. UpdateStatus_VersionMismatch
  123. } UpdateStatus;
  124. /*RemoteStartStopStatus*/
  125. typedef enum {
  126. RemoteStartStopStatus_Accepted,
  127. RemoteStartStopStatus_Rejected
  128. } RemoteStartStopStatus;
  129. /*ReservationStatus*/
  130. typedef enum {
  131. ReservationStatus_Accepted,
  132. ReservationStatus_Faulted,
  133. ReservationStatus_Occupied,
  134. ReservationStatus_Rejected,
  135. ReservationStatus_Unavailable
  136. } ReservationStatus;
  137. /*ResetType*/
  138. typedef enum {
  139. Hard,
  140. Soft
  141. } ResetType;
  142. /*ResetStatus*/
  143. typedef enum {
  144. ResetStatus_Accepted,
  145. ResetStatus_Rejected
  146. } ResetStatus;
  147. /*DiagnosticsStatus*/
  148. typedef enum {
  149. DiagnosticsStatus_Idle,
  150. DiagnosticsStatus_Uploaded,
  151. DiagnosticsStatus_UploadFailed,
  152. DiagnosticsStatus_Uploading
  153. } DiagnosticsStatus;
  154. /*FirmwareStatus*/
  155. typedef enum {
  156. FirmwareStatus_Downloaded,
  157. FirmwareStatus_DownloadFailed,
  158. FirmwareStatus_Downloading,
  159. FirmwareStatus_Idle,
  160. FirmwareStatus_InstallationFailed,
  161. FirmwareStatus_Installing,
  162. FirmwareStatus_Installed
  163. } FirmwareStatus;
  164. /*MessageTrigger*/
  165. typedef enum {
  166. BootNotification,
  167. DiagnosticsStatusNotification,
  168. FirmwareStatusNotification,
  169. Heartbeat,
  170. MeterValues,
  171. StatusNotification
  172. } MessageTrigger;
  173. /*TriggerMessageStatus*/
  174. typedef enum {
  175. TriggerMessageStatus_Accepted ,
  176. TriggerMessageStatus_Rejected ,
  177. TriggerMessageStatus_NotImplemented
  178. } TriggerMessageStatus;
  179. /*UnlockStatus*/
  180. typedef enum {
  181. Unlocked,
  182. UnlockFailed,
  183. UnlockStatus_NotSupported
  184. } UnlockStatus;
  185. /*StopTransactionReason*/
  186. typedef enum {
  187. EmergencyStop,
  188. EVDisconnected,
  189. HardReset,
  190. Local,
  191. Other,
  192. PowerLoss,
  193. Reboot,
  194. Remote,
  195. SoftReset,
  196. UnlockCommand,
  197. DeAuthorized
  198. } StopTransactionReason;
  199. /*CancelReservationStatus*/
  200. typedef enum {
  201. CancelReservationStatus_Accepted,
  202. CancelReservationStatus_Rejected
  203. } CancelReservationStatus;
  204. /*ReadingContext*/
  205. typedef enum {
  206. ReadingContext_Interruption_Begin,
  207. ReadingContext_Interruption_End,
  208. ReadingContext_Other,
  209. ReadingContext_Sample_Clock,
  210. ReadingContext_Sample_Periodic ,
  211. ReadingContext_Transaction_Begin ,
  212. ReadingContext_Transaction_End,
  213. ReadingContext_Trigger
  214. } ReadingContext;
  215. /*ValueFormat*/
  216. typedef enum {
  217. Raw,
  218. SignedData
  219. } ValueFormat;
  220. /*Measurand*/
  221. typedef enum {
  222. Current_Export ,
  223. Current_Import,
  224. Current_Offered,
  225. Energy_Active_Export_Register,
  226. Energy_Active_Import_Register,
  227. Energy_Reactive_Export_Register,
  228. Energy_Reactive_Import_Register,
  229. Energy_Active_Export_Interval,
  230. Energy_Active_Import_Interval,
  231. Energy_Reactive_Export_Interval,
  232. Energy_Reactive_Import_Interval,
  233. Frequency,
  234. Power_Active_Export ,
  235. Power_Active_Import,
  236. Power_Factor,
  237. Power_Offered,
  238. Power_Reactive_Export,
  239. Power_Reactive_Import,
  240. RPM,
  241. SoC,
  242. Temperature ,
  243. Voltage
  244. } Measurand;
  245. /*Location*/
  246. typedef enum {
  247. Location_Body,
  248. Location_Cable,
  249. Location_EV,
  250. Location_Inlet ,
  251. Location_Outlet
  252. } Location;
  253. /*Phase*/
  254. typedef enum {
  255. L1,
  256. L2,
  257. L3,
  258. N,
  259. L1_N,
  260. L2_N,
  261. L3_N,
  262. L1_L2,
  263. L2_L3,
  264. L3_L1
  265. } Phase;
  266. /*UnitOfMeasure*/
  267. typedef enum {
  268. UnitOfMeasure_Wh,
  269. UnitOfMeasure_kWh ,
  270. UnitOfMeasure_varh ,
  271. UnitOfMeasure_kvarh ,
  272. UnitOfMeasure_W ,
  273. UnitOfMeasure_kW ,
  274. UnitOfMeasure_VA ,
  275. UnitOfMeasure_kVA ,
  276. UnitOfMeasure_var ,
  277. UnitOfMeasure_kvar ,
  278. UnitOfMeasure_A ,
  279. UnitOfMeasure_V ,
  280. UnitOfMeasure_Celsius ,
  281. UnitOfMeasure_Fahrenheit ,
  282. UnitOfMeasure_K ,
  283. UnitOfMeasure_Percent
  284. } UnitOfMeasure;
  285. /*Configuration enum*/
  286. enum LocalAuthListManagementProfile{
  287. LocalAuthListEnabled=0,
  288. LocalAuthListMaxLength,
  289. SendLocalListMaxLength,
  290. _LocalAuthListManagementProfile_CNT
  291. };
  292. enum ReservationProfile{
  293. ReserveConnectorZeroSupported
  294. };
  295. enum SmartChargingProfile{
  296. ChargeProfileMaxStackLevel,
  297. ChargingScheduleAllowedChargingRateUnit,
  298. ChargingScheduleMaxPeriods,
  299. ConnectorSwitch3to1PhaseSupported,
  300. MaxChargingProfilesInstalled
  301. };
  302. enum ChargerSystemStatus{
  303. ChargerSystemStatus_Booting,
  304. ChargerSystemStatus_Idle,
  305. ChargerSystemStatus_Authorizing,
  306. ChargerSystemStatus_Preparing,
  307. ChargerSystemStatus_Charging,
  308. ChargerSystemStatus_Terminating,
  309. ChargerSystemStatus_Alarm,
  310. ChargerSystemStatus_Fault
  311. };
  312. enum GetConfigurationKey {
  313. GetConfiguration_AllowOfflineTxForUnknownId=0,
  314. GetConfiguration_AuthorizationCacheEnabled,
  315. GetConfiguration_AuthorizeRemoteTxRequests,
  316. GetConfiguration_BlinkRepeat,
  317. GetConfiguration_ClockAlignedDataInterval,
  318. GetConfiguration_ConnectionTimeOut,
  319. GetConfiguration_GetConfigurationMaxKeys,
  320. GetConfiguration_HeartbeatInterval,
  321. GetConfiguration_LightIntensity,
  322. GetConfiguration_LocalAuthorizeOffline,
  323. GetConfiguration_LocalPreAuthorize,
  324. GetConfiguration_MaxEnergyOnInvalidId,
  325. GetConfiguration_MeterValuesAlignedData,
  326. GetConfiguration_MeterValuesAlignedDataMaxLength,
  327. GetConfiguration_MeterValuesSampledData,
  328. GetConfiguration_MeterValuesSampledDataMaxLength,
  329. GetConfiguration_MeterValueSampleInterval,
  330. GetConfiguration_MinimumStatusDuration,
  331. GetConfiguration_NumberOfConnectors,
  332. GetConfiguration_ResetRetries,
  333. GetConfiguration_ConnectorPhaseRotation,
  334. GetConfiguration_ConnectorPhaseRotationMaxLength,
  335. GetConfiguration_StopTransactionOnEVSideDisconnect,
  336. GetConfiguration_StopTransactionOnInvalidId,
  337. GetConfiguration_StopTxnAlignedData,
  338. GetConfiguration_StopTxnAlignedDataMaxLength,
  339. GetConfiguration_StopTxnSampledData,
  340. GetConfiguration_StopTxnSampledDataMaxLength,
  341. GetConfiguration_SupportedFeatureProfiles,
  342. GetConfiguration_SupportedFeatureProfilesMaxLength,
  343. GetConfiguration_TransactionMessageAttempts,
  344. GetConfiguration_TransactionMessageRetryInterval,
  345. GetConfiguration_UnlockConnectorOnEVSideDisconnect,
  346. GetConfiguration_WebSocketPingInterval,
  347. GetConfiguration_QueueOffLineMeterValues,
  348. GetConfiguration_AuthorizationKey,
  349. GetConfiguration_SecurityProfile,
  350. GetConfiguration_DefaultPrice,
  351. GetConfiguration_CustomDisplayCostAndPrice,
  352. GetConfiguration_CustomIdleFeeAfterStop,
  353. GetConfiguration_TimeOffset,
  354. GetConfiguration_NextTimeOffsetTransitionDateTime,
  355. GetConfiguration_TimeOffsetNextTransition,
  356. GetConfiguration_SystemUptimeSec,
  357. GetConfiguration_FreeVend,
  358. GetConfiguration_FreeVendIdtag,
  359. GetConfiguration_OcppServer,
  360. GetConfiguration_MaintainServer,
  361. GetConfiguration_StatusNotificationPeriodically,
  362. GetConfiguration_StatusNotificationInterval,
  363. GetConfiguration_PreAuthAmount,
  364. GetConfiguration_isEnableLocalPowerSharing,
  365. GetConfiguration_PowerSharingServerIP,
  366. GetConfiguration_EVCCID_PREFIX,
  367. GetConfiguration_OffLineMaxChargingPower,
  368. GetConfiguration_LocalAuthListEnabled,
  369. GetConfiguration_LocalAuthListMaxLength,
  370. GetConfiguration_SendLocalListMaxLength,
  371. GetConfiguration_ReserveConnectorZeroSupported,
  372. GetConfiguration_ChargeProfileMaxStackLevel,
  373. GetConfiguration_ChargingScheduleAllowedChargingRateUnit,
  374. GetConfiguration_ChargingScheduleMaxPeriods,
  375. GetConfiguration_ConnectorSwitch3to1PhaseSupported,
  376. GetConfiguration_MaxChargingProfilesInstalled,
  377. GetConfiguration_ConfigurationVersion,
  378. GetConfiguration_CharingProfileRefreshInterval,
  379. GetConfiguration_CpoName,
  380. GetConfiguration_OcppSoftwareVersion,
  381. GetConfiguration_AuthDownloadlinkCertificate,
  382. GetConfiguration_RfidEndianType,
  383. GetConfiguration_AuthorizeTimeout,
  384. GetConfiguration_Enable15118,
  385. GetConfiguration_WifiSsid,
  386. GetConfiguration_WifiPassword,
  387. GetConfiguration_StopChargingByButton,
  388. _GetConfiguration_CNT
  389. };
  390. enum FIRMWARE_NOTIFICATION_STATUS
  391. {
  392. FIRMWARE_STATUS_DOWNLOADED = 0,
  393. FIRMWARE_STATUS_DOWNLOAD_FAILED = 1,
  394. FIRMWARE_STATUS_DOWNLOADING = 2,
  395. FIRMWARE_STATUS_IDLE = 3,
  396. FIRMWARE_STATUS_INSTALLATION_FAILED =4,
  397. FIRMWARE_STATUS_INSTALLING = 5,
  398. FIRMWARE_STATUS_INSTALLED = 6
  399. };
  400. enum DIAGNOSTIC_NOTIFICATION_STATUS
  401. {
  402. DIAGNOSTIC_STATUS_IDLE = 0,
  403. DIAGNOSTIC_STATUS_UPLOADED = 1,
  404. DIAGNOSTIC_STATUS_UPLOAD_FAIL = 2,
  405. DIAGNOSTIC_STATUS_UPLOADING =3
  406. };
  407. enum CERTIFICATE_PARSE_TYPE
  408. {
  409. CERT_PARSE_HashAlgorithm = 0,
  410. CERT_PARSE_SerialNumber = 1,
  411. CERT_PARSE_IssuerNameHash = 2,
  412. CERT_PARSE_IssuerKeyHash = 3,
  413. CERT_PARSE_OcspUrl = 4
  414. };
  415. struct StructPeriod
  416. {
  417. int StartPeriod;
  418. float Limit;//0.1;
  419. int NumberPhases;
  420. };
  421. struct StructProfile
  422. {
  423. int Duration;
  424. int TotalPeriod;
  425. struct StructPeriod Period[10];
  426. };
  427. //===============================================
  428. // Common routine
  429. //===============================================
  430. int initialConfigurationTable(void);
  431. void StoreConfigurationTable(void);
  432. void GetStartTransactionIdTag(int gun_index);
  433. //==========================================
  434. // send request routine
  435. //==========================================
  436. int sendAuthorizeRequest(int gun_index);
  437. int sendBootNotificationRequest(void);
  438. int sendDataTransferRequest(int gun_index);
  439. int sendUnplugByDataTransferRequest(int gun_index);
  440. int sendOcmfByDataTransferRequest(int gun_index);
  441. int sendFirmwareVersionByDataTransfer(void);
  442. int sendDiagnosticsStatusNotificationRequest(char *status);
  443. int sendFirmwareStatusNotificationRequest(char *status);
  444. int sendHeartbeatRequest(int gun_index);
  445. int sendConnector0StatusNotificationRequest();
  446. int sendStartTransactionRequest(int gun_index);
  447. int sendStatusNotificationRequest(int gun_index);
  448. int sendStopTransactionRequest(int gun_index);
  449. int sendMeterValuesRequest(int gun_index, ReadingContext dataType);
  450. int sendLogStatusNotificationRequest(char *status);
  451. int sendSecurityEventNotificationRequest();
  452. int sendSignCertificateRequest();
  453. int sendSignedFirmwareStatusNotificationRequest(char *status);
  454. //==========================================
  455. // send confirm routine
  456. //==========================================
  457. int sendCancelReservationConfirmation(char *uuid,char *payload);
  458. int sendChangeAvailabilityConfirmation(char *uuid,char *payload);
  459. int sendChangeConfigurationConfirmation(char *uuid,char *payload);
  460. int sendClearCacheConfirmation(char *uuid,char *payload);
  461. int sendClearChargingProfileConfirmation(char *uuid,char *payload);
  462. int sendDataTransferConfirmation(char *uuid,char *payload);
  463. int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connectorIdInt,int nPeriod);
  464. int sendGetConfigurationConfirmation(char *uuid);
  465. int sendGetDiagnosticsConfirmation(char *uuid,char *payload);
  466. int sendGetLocalListVersionConfirmation(char *uuid,char *payload);
  467. int sendRemoteStartConfirmation(char *uuid,char *payload);
  468. int sendRemoteStopTransactionConfirmation(char *uuid,char *payload);
  469. int sendReserveNowTransactionConfirmation(char *uuid,char *payload);
  470. int sendResetConfirmation(char *uuid,char *payload);
  471. int sendSendLocalListConfirmation(char *uuid,char *payload);
  472. int sendSetChargingProfileConfirmation(char *uuid,char *payload);
  473. int sendTriggerMessageConfirmation(char *uuid,char *payload);
  474. int sendUnlockConnectorConfirmation(char *uuid,char *payload);
  475. int sendUpdateFirmwareConfirmation(char *uuid);
  476. int sendCertificateSignedConfirmation(char *uuid);
  477. int sendDeleteCertificateConfirmation(char *uuid);
  478. int sendExtendedTriggerMessageConfirmation(char *uuid);
  479. int sendGetInstalledCertificateIdsConfirmation(char *uuid);
  480. int sendGetLogConfirmation(char *uuid);
  481. int sendInstallCertificateConfirmation(char *uuid);
  482. int sendSignedUpdateFirmwareConfirmation(char *uuid);
  483. int sendUnknownConfirmation(char *uuid);
  484. //==========================================
  485. // send CallError routine
  486. //==========================================
  487. void SendCallError(char *uniqueId, char *action, char *errorCode, char *errorDescription);
  488. //==========================================
  489. // Handle server request routine Start
  490. //==========================================
  491. int handleCancelReservationRequest(char *uuid, char *payload);
  492. int handleChangeAvailabilityRequest(char *uuid, char *payload);
  493. int handleChangeConfigurationRequest(char *uuid, char *payload);
  494. int handleClearCacheRequest(char *uuid, char *payload);
  495. int handleClearChargingProfileRequest(char *uuid, char *payload);
  496. int handleDataTransferRequest(char *uuid, char *payload);
  497. int handleGetCompositeScheduleRequest(char *uuid, char *payload);
  498. int handleGetConfigurationRequest(char *uuid, char *payload);
  499. int handleGetDiagnosticsRequest(char *uuid, char *payload);
  500. int handleGetLocalListVersionRequest(char *uuid, char *payload);
  501. int handleRemoteStartRequest(char *uuid, char *payload);
  502. int handleRemoteStopTransactionRequest(char *uuid, char *payload);
  503. int handleReserveNowTransactionRequest(char *uuid, char *payload);
  504. int handleResetRequest(char *uuid, char *payload);
  505. int handleSendLocalListRequest(char *uuid, char *payload);
  506. int handleSetChargingProfileRequest(char *uuid, char *payload);
  507. int handleTriggerMessageRequest(char *uuid, char *payload);
  508. int handleUnlockConnectorRequest(char *uuid, char *payload);
  509. int handleUpdateFirmwareRequest(char *uuid, char *payload);
  510. int handleCertificateSignedRequest(char *uuid, char *payload);
  511. int handleDeleteCertificateRequest(char *uuid, char *payload);
  512. int handleExtendedTriggerMessageRequest(char *uuid, char *payload);
  513. int handleGetInstalledCertificateIdsRequest(char *uuid, char *payload);
  514. int handleGetLogRequest(char *uuid, char *payload);
  515. int handleInstallCertificateRequest(char *uuid, char *payload);
  516. int handleSignedUpdateFirmwareRequest(char *uuid, char *payload);
  517. int handleUnknownRequest(char *uuid, char *payload);
  518. void handleAuthorizeResponse(char *payload, int gun_index);
  519. void handleBootNotificationResponse(char *payload, int gun_index);
  520. void handleDataTransferResponse(char *payload, int gun_index);
  521. void handleDiagnosticsStatusNotificationResponse(char *payload, int gun_index);
  522. void handleFirmwareStatusNotificationResponse(char *payload, int gun_index);
  523. void handleHeartbeatResponse(char *payload, int gun_index);
  524. void handleMeterValuesResponse(char *payload, int gun_index);
  525. void handleStartTransactionResponse(char *payload, int gun_index);
  526. void handleStatusNotificationResponse(char *payload, int gun_index);
  527. void handleStopTransactionnResponse(char *payload, int gun_index);
  528. void handleLogStatusNotificationResponse(char *payload, int gun_index);
  529. void handleSecurityEventNotificationResponse(char *payload, int gun_index);
  530. void handleSignCertificateResponse(char *payload, int gun_index);
  531. void handleSignedFirmwareStatusNotificationResponse(char *payload, int gun_index);
  532. //==========================================
  533. // Handle Error routine
  534. //==========================================
  535. void handleError(char *id, char *errorCode, char *errorDescription,char *payload);
  536. //===============================================
  537. // Common routine
  538. //===============================================
  539. void getKeyValue(char *keyReq);
  540. int setKeyValue(char *key, char *value);
  541. int updateSetting(char *key, char *value);
  542. int httpDownLoadFile(char *location, char *path, char *filename,char *url);
  543. int ftpDownLoadFile(char *location, char *user, char *password, int port, char *path, char *filename,char *url);
  544. void *UpdateFirmwareProcess(void* data);
  545. void* GetDiagnosticsProcess(void* data);
  546. int httpUploadFile(char *location, char *path, char *filename,char *url);
  547. int sftpDownLoadFile(char *location, char *user, char *password, int port, char *path, char *filename,char *url);
  548. int ftpUploadFile(char *location, char *user, char *password, int port, char *path, char *fnamePlusPath,char *filename);
  549. int sftpUploadFile(char *location, char *user, char *password, int port, char *path, char *fnamePlusPath,char *filename);
  550. void LWS_Send(char * str);
  551. void LWS_SendNow(char * str);
  552. extern int queue_operation(int type, char *frontUUID, char *frontData);
  553. int GetOcppServerURL();
  554. int GetOcppPath();
  555. int GetOcppPort();
  556. int GetTransactionId(int gunindex, unsigned char idTag[], uint8_t isStopTransaction);
  557. int GetStartTransactionId(int gun_index);
  558. void SetTransactionIdZero(int transactionId);
  559. void GetChargingProfileRequest(int gunindex);
  560. void FillStartTransaction(int ConnectorId, unsigned char IdTag[], int MeterStart,int ReservationId,unsigned char Timestamp[]);
  561. void splitstring(char *src,const char *separator,char **dest,int *num);
  562. int GetWebSocketPingInterval(void);
  563. int GetInternetConn(void);
  564. int GetBackendConnectionTimeout(void);
  565. int isConnectorInitMode(int gun_index);
  566. void refreshProcDogTimer();
  567. int GetServerSign(void);
  568. void SetServerSign(int value);
  569. int GetBootNotificationInterval(void);
  570. void InitialSystemValue(void);
  571. void checkTempStopTransaction(int gun_index);
  572. void storeTempStopTransaction(int gun_index);
  573. //===============================================
  574. // sqlite related routine
  575. //===============================================
  576. int SettingChargingRecord(int target, int transactionId);
  577. int addBuff(int gun_idx, int user_id, int cmd_sn);
  578. int OCPP_cleanLocalCache();
  579. int OCPP_addLocalCache(char *idTag, char *parentTage, char *expiryDate, char *status);
  580. void OCPP_getIdTagFromLocalCache(char idTag[]);
  581. void OCPP_getListVerion();
  582. int OCPP_cleanLocalList();
  583. int OCPP_addLocalList(int version, char *idTag, char *parentTage, char *expiryDate, char *status);
  584. void OCPP_getIdTagFromLocalList(char idTag[]);
  585. void OCPP_deleteIdTagFromLocalList(char idTag[]);
  586. #endif