|
@@ -1,6 +1,420 @@
|
|
|
#ifndef MessageHandler_H
|
|
|
#define MessageHandler_H
|
|
|
|
|
|
+//===================================
|
|
|
+// Define CP State constant
|
|
|
+//===================================
|
|
|
+#define CP_STATE_UNKNOWN 0
|
|
|
+#define CP_STATE_A 1
|
|
|
+#define CP_STATE_B 2
|
|
|
+#define CP_STATE_C 3
|
|
|
+#define CP_STATE_D 4
|
|
|
+#define CP_STATE_E 5
|
|
|
+#define CP_STATE_F 6
|
|
|
+
|
|
|
+//==========================================
|
|
|
+// Init all Enumeration & Mapping String
|
|
|
+//==========================================
|
|
|
+#define MACROSTR(k) #k
|
|
|
+
|
|
|
+/*ChargePointErrorCode*/
|
|
|
+typedef enum {
|
|
|
+ ConnectorLockFailure,
|
|
|
+ EVCommunicationError,
|
|
|
+ GroundFailure,
|
|
|
+ HighTemperature,
|
|
|
+ InternalError,
|
|
|
+ LocalListConflict,
|
|
|
+ NoError,
|
|
|
+ OtherError,
|
|
|
+ OverCurrentFailure,
|
|
|
+ OverVoltage,
|
|
|
+ PowerMeterFailure,
|
|
|
+ PowerSwitchFailure,
|
|
|
+ ReaderFailure,
|
|
|
+ ResetFailure,
|
|
|
+ UnderVoltage,
|
|
|
+ WeakSignal
|
|
|
+} ChargePointErrorCode;
|
|
|
+
|
|
|
+/*ChargePointStatus*/
|
|
|
+typedef enum {
|
|
|
+ Available =0,
|
|
|
+ Preparing,
|
|
|
+ Charging,
|
|
|
+ SuspendedEVSE,
|
|
|
+ SuspendedEV,
|
|
|
+ Finishing,
|
|
|
+ Reserved,
|
|
|
+ Unavailable,
|
|
|
+ Faulted
|
|
|
+} ChargePointStatus;
|
|
|
+
|
|
|
+/*AvailabilityType*/
|
|
|
+typedef enum {
|
|
|
+ RegistrationStatus_Accepted,
|
|
|
+ RegistrationStatus_Pending,
|
|
|
+ RegistrationStatus_Rejected
|
|
|
+} RegistrationStatus;
|
|
|
+
|
|
|
+/*AvailabilityType*/
|
|
|
+typedef enum {
|
|
|
+ Inoperative,
|
|
|
+ Operative
|
|
|
+} AvailabilityType;
|
|
|
+
|
|
|
+/*AvailabilityStatus*/
|
|
|
+typedef enum {
|
|
|
+ Accepted,
|
|
|
+ Rejected,
|
|
|
+ Scheduled
|
|
|
+} AvailabilityStatus;
|
|
|
+
|
|
|
+/*ConfigurationStatus*/
|
|
|
+typedef enum {
|
|
|
+ ConfigurationStatus_Accepted,
|
|
|
+ ConfigurationStatus_Rejected,
|
|
|
+ RebootRequired,
|
|
|
+ NotSupported
|
|
|
+} ConfigurationStatus;
|
|
|
+
|
|
|
+/*ClearCacheStatus*/
|
|
|
+typedef enum {
|
|
|
+ ClearCacheStatus_Accepted,
|
|
|
+ ClearCacheStatus_Rejected
|
|
|
+} ClearCacheStatus;
|
|
|
+
|
|
|
+/*ChargingProfilePurposeType*/
|
|
|
+typedef enum {
|
|
|
+ ChargePointMaxProfile,
|
|
|
+ TxDefaultProfile,
|
|
|
+ TxProfile
|
|
|
+} ChargingProfilePurposeType;
|
|
|
+
|
|
|
+/*ChargingProfileStatus*/
|
|
|
+typedef enum {
|
|
|
+ ChargingProfileStatus_Accepted,
|
|
|
+ ChargingProfileStatus_Rejected,
|
|
|
+ ChargingProfileStatus_NotSupported
|
|
|
+} ChargingProfileStatus;
|
|
|
+
|
|
|
+/*ClearChargingProfileStatus*/
|
|
|
+typedef enum {
|
|
|
+ ClearChargingProfileStatus_Accepted,
|
|
|
+ ClearChargingProfileStatus_Unknown
|
|
|
+} ClearChargingProfileStatus;
|
|
|
+
|
|
|
+/*GetCompositeScheduleStatus*/
|
|
|
+typedef enum {
|
|
|
+ GetCompositeScheduleStatus_Accepted,
|
|
|
+ GetCompositeScheduleStatus_Rejected
|
|
|
+} GetCompositeScheduleStatus;
|
|
|
+
|
|
|
+/*ChargingRateUnitType*/
|
|
|
+typedef enum {
|
|
|
+ ChargingRateUnitType_W,
|
|
|
+ ChargingRateUnitType_A
|
|
|
+} ChargingRateUnitType;
|
|
|
+
|
|
|
+/*AuthorizationStatus*/
|
|
|
+typedef enum {
|
|
|
+ AuthorizationStatus_Accepted ,
|
|
|
+ AuthorizationStatus_Blocked ,
|
|
|
+ AuthorizationStatus_Expired ,
|
|
|
+ AuthorizationStatus_Invalid ,
|
|
|
+ AuthorizationStatus_ConcurrentTx
|
|
|
+} AuthorizationStatus;
|
|
|
+
|
|
|
+/*UpdateType*/
|
|
|
+typedef enum {
|
|
|
+ Differential ,
|
|
|
+ Full
|
|
|
+} UpdateType;
|
|
|
+
|
|
|
+/*UpdateStatus*/
|
|
|
+typedef enum {
|
|
|
+ UpdateStatus_Accepted ,
|
|
|
+ UpdateStatus_Failed ,
|
|
|
+ UpdateStatus_NotSupported ,
|
|
|
+ UpdateStatus_VersionMismatch
|
|
|
+} UpdateStatus;
|
|
|
+
|
|
|
+/*RemoteStartStopStatus*/
|
|
|
+typedef enum {
|
|
|
+ RemoteStartStopStatus_Accepted,
|
|
|
+ RemoteStartStopStatus_Rejected
|
|
|
+
|
|
|
+} RemoteStartStopStatus;
|
|
|
+
|
|
|
+/*ReservationStatus*/
|
|
|
+typedef enum {
|
|
|
+ ReservationStatus_Accepted,
|
|
|
+ ReservationStatus_Faulted,
|
|
|
+ ReservationStatus_Occupied,
|
|
|
+ ReservationStatus_Rejected,
|
|
|
+ ReservationStatus_Unavailable
|
|
|
+
|
|
|
+} ReservationStatus;
|
|
|
+
|
|
|
+/*ResetType*/
|
|
|
+typedef enum {
|
|
|
+ Hard,
|
|
|
+ Soft
|
|
|
+} ResetType;
|
|
|
+
|
|
|
+/*ResetStatus*/
|
|
|
+typedef enum {
|
|
|
+ ResetStatus_Accepted,
|
|
|
+ ResetStatus_Rejected
|
|
|
+} ResetStatus;
|
|
|
+
|
|
|
+/*DiagnosticsStatus*/
|
|
|
+typedef enum {
|
|
|
+ DiagnosticsStatus_Idle,
|
|
|
+ DiagnosticsStatus_Uploaded,
|
|
|
+ DiagnosticsStatus_UploadFailed,
|
|
|
+ DiagnosticsStatus_Uploading
|
|
|
+} DiagnosticsStatus;
|
|
|
+
|
|
|
+/*FirmwareStatus*/
|
|
|
+typedef enum {
|
|
|
+ FirmwareStatus_Downloaded,
|
|
|
+ FirmwareStatus_DownloadFailed,
|
|
|
+ FirmwareStatus_Downloading,
|
|
|
+ FirmwareStatus_Idle,
|
|
|
+ FirmwareStatus_InstallationFailed,
|
|
|
+ FirmwareStatus_Installing,
|
|
|
+ FirmwareStatus_Installed
|
|
|
+} FirmwareStatus;
|
|
|
+
|
|
|
+/*MessageTrigger*/
|
|
|
+typedef enum {
|
|
|
+ BootNotification,
|
|
|
+ DiagnosticsStatusNotification,
|
|
|
+ FirmwareStatusNotification,
|
|
|
+ Heartbeat,
|
|
|
+ MeterValues,
|
|
|
+ StatusNotification
|
|
|
+} MessageTrigger;
|
|
|
+
|
|
|
+/*TriggerMessageStatus*/
|
|
|
+typedef enum {
|
|
|
+ TriggerMessageStatus_Accepted ,
|
|
|
+ TriggerMessageStatus_Rejected ,
|
|
|
+ TriggerMessageStatus_NotImplemented
|
|
|
+} TriggerMessageStatus;
|
|
|
+
|
|
|
+/*UnlockStatus*/
|
|
|
+typedef enum {
|
|
|
+ Unlocked,
|
|
|
+ UnlockFailed,
|
|
|
+ UnlockStatus_NotSupported
|
|
|
+} UnlockStatus;
|
|
|
+
|
|
|
+/*StopTransactionReason*/
|
|
|
+typedef enum {
|
|
|
+ EmergencyStop,
|
|
|
+ EVDisconnected,
|
|
|
+ HardReset,
|
|
|
+ Local,
|
|
|
+ Other,
|
|
|
+ PowerLoss,
|
|
|
+ Reboot,
|
|
|
+ Remote,
|
|
|
+ SoftReset,
|
|
|
+ UnlockCommand,
|
|
|
+ DeAuthorized
|
|
|
+} StopTransactionReason;
|
|
|
+
|
|
|
+/*CancelReservationStatus*/
|
|
|
+typedef enum {
|
|
|
+ CancelReservationStatus_Accepted,
|
|
|
+ CancelReservationStatus_Rejected
|
|
|
+} CancelReservationStatus;
|
|
|
+
|
|
|
+/*ReadingContext*/
|
|
|
+typedef enum {
|
|
|
+ ReadingContext_Interruption_Begin,
|
|
|
+ ReadingContext_Interruption_End,
|
|
|
+ ReadingContext_Other,
|
|
|
+ ReadingContext_Sample_Clock,
|
|
|
+ ReadingContext_Sample_Periodic ,
|
|
|
+ ReadingContext_Transaction_Begin ,
|
|
|
+ ReadingContext_Transaction_End,
|
|
|
+ ReadingContext_Trigger
|
|
|
+} ReadingContext;
|
|
|
+
|
|
|
+/*ValueFormat*/
|
|
|
+typedef enum {
|
|
|
+ Raw,
|
|
|
+ SignedData
|
|
|
+} ValueFormat;
|
|
|
+
|
|
|
+/*Measurand*/
|
|
|
+typedef enum {
|
|
|
+ Current_Export ,
|
|
|
+ Current_Import,
|
|
|
+ Current_Offered,
|
|
|
+ Energy_Active_Export_Register,
|
|
|
+ Energy_Active_Import_Register,
|
|
|
+ Energy_Reactive_Export_Register,
|
|
|
+ Energy_Reactive_Import_Register,
|
|
|
+ Energy_Active_Export_Interval,
|
|
|
+ Energy_Active_Import_Interval,
|
|
|
+ Energy_Reactive_Export_Interval,
|
|
|
+ Energy_Reactive_Import_Interval,
|
|
|
+ Frequency,
|
|
|
+ Power_Active_Export ,
|
|
|
+ Power_Active_Import,
|
|
|
+ Power_Factor,
|
|
|
+ Power_Offered,
|
|
|
+ Power_Reactive_Export,
|
|
|
+ Power_Reactive_Import,
|
|
|
+ RPM,
|
|
|
+ SoC,
|
|
|
+ Temperature ,
|
|
|
+ Voltage
|
|
|
+} Measurand;
|
|
|
+
|
|
|
+/*Location*/
|
|
|
+typedef enum {
|
|
|
+ Location_Body,
|
|
|
+ Location_Cable,
|
|
|
+ Location_EV,
|
|
|
+ Location_Inlet ,
|
|
|
+ Location_Outlet
|
|
|
+} Location;
|
|
|
+
|
|
|
+/*Phase*/
|
|
|
+typedef enum {
|
|
|
+ L1,
|
|
|
+ L2,
|
|
|
+ L3,
|
|
|
+ N,
|
|
|
+ L1_N,
|
|
|
+ L2_N,
|
|
|
+ L3_N,
|
|
|
+ L1_L2,
|
|
|
+ L2_L3,
|
|
|
+ L3_L1
|
|
|
+} Phase;
|
|
|
+
|
|
|
+/*UnitOfMeasure*/
|
|
|
+typedef enum {
|
|
|
+ UnitOfMeasure_Wh,
|
|
|
+ UnitOfMeasure_kWh ,
|
|
|
+ UnitOfMeasure_varh ,
|
|
|
+ UnitOfMeasure_kvarh ,
|
|
|
+ UnitOfMeasure_W ,
|
|
|
+ UnitOfMeasure_kW ,
|
|
|
+ UnitOfMeasure_VA ,
|
|
|
+ UnitOfMeasure_kVA ,
|
|
|
+ UnitOfMeasure_var ,
|
|
|
+ UnitOfMeasure_kvar ,
|
|
|
+ UnitOfMeasure_A ,
|
|
|
+ UnitOfMeasure_V ,
|
|
|
+ UnitOfMeasure_Celsius ,
|
|
|
+ UnitOfMeasure_Fahrenheit ,
|
|
|
+ UnitOfMeasure_K ,
|
|
|
+ UnitOfMeasure_Percent
|
|
|
+
|
|
|
+} UnitOfMeasure;
|
|
|
+
|
|
|
+enum LocalAuthListManagementProfile{
|
|
|
+ LocalAuthListEnabled=0,
|
|
|
+ LocalAuthListMaxLength,
|
|
|
+ SendLocalListMaxLength,
|
|
|
+ _LocalAuthListManagementProfile_CNT
|
|
|
+};
|
|
|
+
|
|
|
+enum ReservationProfile{
|
|
|
+ ReserveConnectorZeroSupported
|
|
|
+};
|
|
|
+
|
|
|
+enum SmartChargingProfile{
|
|
|
+ ChargeProfileMaxStackLevel,
|
|
|
+ ChargingScheduleAllowedChargingRateUnit,
|
|
|
+ ChargingScheduleMaxPeriods,
|
|
|
+ ConnectorSwitch3to1PhaseSupported,
|
|
|
+ MaxChargingProfilesInstalled
|
|
|
+};
|
|
|
+
|
|
|
+enum ChargerSystemStatus{
|
|
|
+ ChargerSystemStatus_Booting,
|
|
|
+ ChargerSystemStatus_Idle,
|
|
|
+ ChargerSystemStatus_Authorizing,
|
|
|
+ ChargerSystemStatus_Preparing,
|
|
|
+ ChargerSystemStatus_Charging,
|
|
|
+ ChargerSystemStatus_Terminating,
|
|
|
+ ChargerSystemStatus_Alarm,
|
|
|
+ ChargerSystemStatus_Fault
|
|
|
+};
|
|
|
+
|
|
|
+enum GetConfigurationKey {
|
|
|
+ GetConfiguration_AllowOfflineTxForUnknownId=0,
|
|
|
+ GetConfiguration_AuthorizationCacheEnabled,
|
|
|
+ GetConfiguration_AuthorizeRemoteTxRequests,
|
|
|
+ GetConfiguration_BlinkRepeat,
|
|
|
+ GetConfiguration_ClockAlignedDataInterval,
|
|
|
+ GetConfiguration_ConnectionTimeOut,
|
|
|
+ GetConfiguration_GetConfigurationMaxKeys,
|
|
|
+ GetConfiguration_HeartbeatInterval,
|
|
|
+ GetConfiguration_LightIntensity,
|
|
|
+ GetConfiguration_LocalAuthorizeOffline,
|
|
|
+ GetConfiguration_LocalPreAuthorize,
|
|
|
+ GetConfiguration_MaxEnergyOnInvalidId,
|
|
|
+ GetConfiguration_MeterValuesAlignedData,
|
|
|
+ GetConfiguration_MeterValuesAlignedDataMaxLength,
|
|
|
+ GetConfiguration_MeterValuesSampledData,
|
|
|
+ GetConfiguration_MeterValuesSampledDataMaxLength,
|
|
|
+ GetConfiguration_MeterValueSampleInterval,
|
|
|
+ GetConfiguration_MinimumStatusDuration,
|
|
|
+ GetConfiguration_NumberOfConnectors,
|
|
|
+ GetConfiguration_ResetRetries,
|
|
|
+ GetConfiguration_ConnectorPhaseRotation,
|
|
|
+ GetConfiguration_ConnectorPhaseRotationMaxLength,
|
|
|
+ GetConfiguration_StopTransactionOnEVSideDisconnect,
|
|
|
+ GetConfiguration_StopTransactionOnInvalidId,
|
|
|
+ GetConfiguration_StopTxnAlignedData,
|
|
|
+ GetConfiguration_StopTxnAlignedDataMaxLength,
|
|
|
+ GetConfiguration_StopTxnSampledData,
|
|
|
+ GetConfiguration_StopTxnSampledDataMaxLength,
|
|
|
+ GetConfiguration_SupportedFeatureProfiles,
|
|
|
+ GetConfiguration_SupportedFeatureProfilesMaxLength,
|
|
|
+ GetConfiguration_TransactionMessageAttempts,
|
|
|
+ GetConfiguration_TransactionMessageRetryInterval,
|
|
|
+ GetConfiguration_UnlockConnectorOnEVSideDisconnect,
|
|
|
+ GetConfiguration_WebSocketPingInterval,
|
|
|
+ GetConfiguration_LocalAuthListEnabled,
|
|
|
+ GetConfiguration_LocalAuthListMaxLength,
|
|
|
+ GetConfiguration_SendLocalListMaxLength,
|
|
|
+ GetConfiguration_ReserveConnectorZeroSupported,
|
|
|
+ GetConfiguration_ChargeProfileMaxStackLevel,
|
|
|
+ GetConfiguration_ChargingScheduleAllowedChargingRateUnit,
|
|
|
+ GetConfiguration_ChargingScheduleMaxPeriods,
|
|
|
+ GetConfiguration_ConnectorSwitch3to1PhaseSupported,
|
|
|
+ GetConfiguration_MaxChargingProfilesInstalled,
|
|
|
+};
|
|
|
+
|
|
|
+enum FIRMWARE_NOTIFICATION_STATUS
|
|
|
+{
|
|
|
+ FIRMWARE_STATUS_DOWNLOADED = 0,
|
|
|
+ FIRMWARE_STATUS_DOWNLOAD_DAILED = 1,
|
|
|
+ FIRMWARE_STATUS_DOWNLOADING = 2,
|
|
|
+ FIRMWARE_STATUS_IDLE = 3,
|
|
|
+ FIRMWARE_STATUS_INSTALLATION_FAILED =4,
|
|
|
+ FIRMWARE_STATUS_INSTALLING = 5,
|
|
|
+ FIRMWARE_STATUS_INSTALLED = 6
|
|
|
+};
|
|
|
+
|
|
|
+enum DIAGNOSTIC_NOTIFICATION_STATUS
|
|
|
+{
|
|
|
+ DIAGNOSTIC_STATUS_IDLE = 0,
|
|
|
+ DIAGNOSTIC_STATUS_UPLOADED = 1,
|
|
|
+ DIAGNOSTIC_STATUS_UPLOAD_FAIL = 2,
|
|
|
+ DIAGNOSTIC_STATUS_UPLOADING =3
|
|
|
+};
|
|
|
+
|
|
|
struct StructPeriod
|
|
|
{
|
|
|
int StartPeriod;
|
|
@@ -15,7 +429,6 @@ struct StructProfile
|
|
|
struct StructPeriod Period[10];
|
|
|
};
|
|
|
|
|
|
-
|
|
|
//===============================================
|
|
|
// Common routine
|
|
|
//===============================================
|
|
@@ -36,7 +449,7 @@ 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);
|
|
|
+int sendMeterValuesRequest(int gun_index, ReadingContext dataType);
|
|
|
|
|
|
//==========================================
|
|
|
// send confirm routine
|
|
@@ -136,37 +549,17 @@ void InitialSystemValue(void);
|
|
|
void checkTempStopTransaction(int gun_index);
|
|
|
void storeTempStopTransaction(int gun_index);
|
|
|
|
|
|
- //===============================================
|
|
|
- // 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[]);
|
|
|
-
|
|
|
-
|
|
|
-enum FIRMWARE_NOTIFICATION_STATUS
|
|
|
-{
|
|
|
- FIRMWARE_STATUS_DOWNLOADED = 0,
|
|
|
- FIRMWARE_STATUS_DOWNLOAD_DAILED = 1,
|
|
|
- FIRMWARE_STATUS_DOWNLOADING = 2,
|
|
|
- FIRMWARE_STATUS_IDLE = 3,
|
|
|
- FIRMWARE_STATUS_INSTALLATION_FAILED =4,
|
|
|
- FIRMWARE_STATUS_INSTALLING = 5,
|
|
|
- FIRMWARE_STATUS_INSTALLED = 6
|
|
|
-};
|
|
|
-
|
|
|
-enum DIAGNOSTIC_NOTIFICATION_STATUS
|
|
|
-{
|
|
|
- DIAGNOSTIC_STATUS_IDLE = 0,
|
|
|
- DIAGNOSTIC_STATUS_UPLOADED = 1,
|
|
|
- DIAGNOSTIC_STATUS_UPLOAD_FAIL = 2,
|
|
|
- DIAGNOSTIC_STATUS_UPLOADING =3
|
|
|
-};
|
|
|
+//===============================================
|
|
|
+// 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
|