#ifndef MessageHandler_H #define MessageHandler_H #if 0 typedef enum _DiagnosticsStatus { Idle, Uploaded, UploadFailed, Uploading }DiagnosticsStatus; typedef enum _FirmwareStatus { Downloaded, DownloadFailed, Downloading, FirmwareStatusIdle, InstallationFailed, Installing, Installed }FirmwareStatus; #endif //=============================================== // Common routine //=============================================== int initialConfigurationTable(void); //========================================== // send request routine //========================================== int sendAuthorizeRequest(int gun_index); int sendBootNotificationRequest(void); int sendDataTransferRequest(int gun_index); int sendDiagnosticsStatusNotificationRequest(char *status); int sendFirmwareStatusNotificationRequest(char *status); int sendHeartbeatRequest(int gun_index); int sendStartTransactionRequest(int gun_index); int sendStatusNotificationRequest(int gun_index); int sendStopTransactionRequest(int gun_index); int sendMeterValuesRequest(int gun_index); //========================================== // send confirm routine //========================================== int sendCancelReservationConfirmation(char *uuid,char *payload); int sendChangeAvailabilityConfirmation(char *uuid,char *payload); int sendChangeConfigurationConfirmation(char *uuid,char *payload); int sendClearCacheConfirmation(char *uuid,char *payload); int sendClearChargingProfileConfirmation(char *uuid,char *payload); int sendDataTransferConfirmation(char *uuid,char *payload); int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connectorIdInt,int nPeriod); int sendGetConfigurationConfirmation(char *uuid); int sendGetDiagnosticsConfirmation(char *uuid,char *payload); int sendGetLocalListVersionConfirmation(char *uuid,char *payload); int sendRemoteStartConfirmation(char *uuid,char *payload); int sendRemoteStopTransactionConfirmation(char *uuid,char *payload); int sendReserveNowTransactionConfirmation(char *uuid,char *payload); int sendResetConfirmation(char *uuid,char *payload); int sendSendLocalListConfirmation(char *uuid,char *payload); int sendSetChargingProfileConfirmation(char *uuid,char *payload); int sendTriggerMessageConfirmation(char *uuid,char *payload); int sendUnlockConnectorConfirmation(char *uuid,char *payload); int sendUpdateFirmwareConfirmation(char *uuid); //========================================== // send CallError routine //========================================== void SendCallError(char *uniqueId, char *action, char *errorCode, char *errorDescription); //========================================== // Handle server request routine Start //========================================== int handleCancelReservationRequest(char *uuid, char *payload); int handleChangeAvailabilityRequest(char *uuid, char *payload); int handleChangeConfigurationRequest(char *uuid, char *payload); int handleClearCacheRequest(char *uuid, char *payload); int handleClearChargingProfileRequest(char *uuid, char *payload); int handleDataTransferRequest(char *uuid, char *payload); long long diff_tm(struct tm *a, struct tm *b); int handleGetCompositeScheduleRequest(char *uuid, char *payload); int handleGetConfigurationRequest(char *uuid, char *payload); int handleGetDiagnosticsRequest(char *uuid, char *payload); int handleGetLocalListVersionRequest(char *uuid, char *payload); int handleRemoteStartRequest(char *uuid, char *payload); int handleRemoteStopTransactionRequest(char *uuid, char *payload); int handleReserveNowTransactionRequest(char *uuid, char *payload); int handleResetRequest(char *uuid, char *payload); int handleSendLocalListRequest(char *uuid, char *payload); int handleSetChargingProfileRequest(char *uuid, char *payload); int handleTriggerMessageRequest(char *uuid, char *payload); int handleUnlockConnectorRequest(char *uuid, char *payload); int handleUpdateFirmwareRequest(char *uuid, char *payload); void handleAuthorizeResponse(char *payload, int gun_index); void handleBootNotificationResponse(char *payload, int gun_index); void handleDataTransferResponse(char *payload, int gun_index); void handleDiagnosticsStatusNotificationResponse(char *payload, int gun_index); void handleFirmwareStatusNotificationResponse(char *payload, int gun_index); void handleHeartbeatResponse(char *payload, int gun_index); void handleMeterValuesResponse(char *payload, int gun_index); void handleStartTransactionResponse(char *payload, int gun_index); void handleStatusNotificationResponse(char *payload, int gun_index); void handleStopTransactionnResponse(char *payload, int gun_index); //========================================== // Handle Error routine //========================================== void handleError(char *id, char *errorCode, char *errorDescription,char *payload); //=============================================== // Common routine //=============================================== void getKeyValue(char *keyReq); int setKeyValue(char *key, char *value); int updateSetting(char *key, char *value); json_object * getJSONfromFile(char *filename); int httpDownLoadFile(char *location, char *path, char *filename,char *url); int ftpDownLoadFile(char *location, char *user, char *password, int port, char *path, char *filename); void UpdateFirmwareProcess(void* data); void* GetDiagnosticsProcess(void* data); int ftpFile(char *location, char *user, char *password, int port, char *path, char *filename); int get_file_contents(const char* filename, char** outbuffer); static int ftp_recv_respond(int m_socket_cmd, char *resp, int len); void Send(struct json_object *message); void LWS_Send(char * str); extern int queue_operation(int type, char *frontUUID, char *frontData); char *GetOcppServerURL(); char *GetOcppPath(); int GetOcppPort(); //=============================================== // sqlite related routine //=============================================== int SettingChargingRecord(int target, int transactionId); int addBuff(int gun_idx, int user_id, int cmd_sn); void OCPP_getListVerion(); int OCPP_cleanLocalList(); int OCPP_addLocalList(int version, char *idTag, char *parentTage, char *expiryDate, char *status); int OCPP_addLocalList_1(int version, char *idTag, char *parentTage, char *expiryDate, char *status); void OCPP_getIdTag(char *idTag); void OCPP_deleteIdTag(char *idTag); #endif