|
@@ -1337,6 +1337,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variable.name, "Interval");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableCharacteristics.unit, "Seconds");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_integer]);
|
|
|
+ ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableCharacteristics.minLimit = 10;
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableAttribute[0].value, "0");
|
|
@@ -2074,9 +2075,10 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variable.name, "TxUpdatedInterval");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableCharacteristics.unit, "Seconds");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_integer]);
|
|
|
+ ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableCharacteristics.minLimit = 10;
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableAttribute[0].value, "0");
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableAttribute[0].value, "30");
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval]);
|
|
|
|
|
|
/* SecurityCtrlr Required item */
|
|
@@ -5282,7 +5284,7 @@ void CheckSystemValue(void)
|
|
|
|
|
|
if(isWebsocketSendable &&
|
|
|
(cpinitateMsg.bits[gun_index].StatusNotificationReq == ON) &&
|
|
|
- ((time((time_t*)NULL)-clientTime.StatusNotification[gun_index]) > 10) )
|
|
|
+ ((time((time_t*)NULL)-clientTime.StatusNotification[gun_index]) > 5) )
|
|
|
{
|
|
|
if(SystemInitial > 0)
|
|
|
SystemInitial -= 1;
|
|
@@ -5714,7 +5716,6 @@ int sendAuthorizeRequest(int gun_index)
|
|
|
strcpy((char *)ShmOCPP20Data->Authorize.idToken.idToken, (const char *)ShmSysConfigAndInfo->SysConfig.UserId);
|
|
|
strcpy((char *)ShmOCPP20Data->Authorize.idToken.type, IdTokenEnumTypeStr[IdTokenEnumType_ISO14443]);
|
|
|
|
|
|
-
|
|
|
json_object_object_add(idToken, "idToken", json_object_new_string((char*)ShmOCPP20Data->Authorize.idToken.idToken));
|
|
|
json_object_object_add(idToken, "type", json_object_new_string((char*)ShmOCPP20Data->Authorize.idToken.type));
|
|
|
json_object_object_add(Authorize, "idToken", idToken);
|
|
@@ -5745,6 +5746,8 @@ int sendBootNotificationRequest()
|
|
|
json_object *chargingStation = json_object_new_object();
|
|
|
json_object *modem = json_object_new_object();
|
|
|
|
|
|
+ DEBUG_INFO("sendBootNotificationRequest...\n");
|
|
|
+
|
|
|
// Fill BootNotification fields
|
|
|
DB_getBooType();
|
|
|
|
|
@@ -5795,6 +5798,8 @@ int sendClearedChargingLimitRequest(int gun_index)
|
|
|
char tempdata[128]={0};
|
|
|
json_object *ClearedChargingLimit = json_object_new_object();
|
|
|
|
|
|
+ DEBUG_INFO("sendClearedChargingLimitRequest...\n");
|
|
|
+
|
|
|
json_object_object_add(ClearedChargingLimit, "chargingLimitSource", json_object_new_string((char*)ShmOCPP20Data->ClearedChargingLimit[gun_index].chargingLimitSource));
|
|
|
json_object_object_add(ClearedChargingLimit, "evseId", json_object_new_int(ShmOCPP20Data->ClearedChargingLimit[gun_index].evseId));
|
|
|
|
|
@@ -5820,6 +5825,8 @@ int sendDataTransferRequest(int gun_index)
|
|
|
char tempdata[65]={0};
|
|
|
int result = FAIL;
|
|
|
|
|
|
+ DEBUG_INFO("sendDataTransferRequest...\n");
|
|
|
+
|
|
|
random_uuid(guid);
|
|
|
sprintf(message,"[%d,\"%s\",\"DataTransfer\",{\"vendorId\":\"%s\",\"messageId\":\"%s\",\"data\":\"%s\"}]",
|
|
|
MESSAGE_TYPE_CALL,
|
|
@@ -5847,8 +5854,8 @@ int sendFirmwareStatusNotificationRequest(char *status)
|
|
|
char guid[37]={0};
|
|
|
char tempdata[65]={0};
|
|
|
json_object *FirmwareStatusNotification = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendFirmwareStatusNotificationRequest...\n");
|
|
|
|
|
|
- DEBUG_INFO("sendFirmwareStatusNotificationRequest \n");
|
|
|
sprintf((char *)ShmOCPP20Data->FirmwareStatusNotification.status, "%s", (const char *)status);
|
|
|
ShmOCPP20Data->FirmwareStatusNotification.requestId = ShmOCPP20Data->UpdateFirmware.requestId;
|
|
|
|
|
@@ -5943,6 +5950,8 @@ int sendGet15118EVCertificateRequest()
|
|
|
char tempdata[128]={0};
|
|
|
json_object *Get15118EVCertificate = json_object_new_object();
|
|
|
|
|
|
+ DEBUG_INFO("sendGet15118EVCertificateRequest...\n");
|
|
|
+
|
|
|
json_object_object_add(Get15118EVCertificate, "iso15118SchemaVersion", json_object_new_string((char*)ShmOCPP20Data->Get15118EVCertificate.iso15118SchemaVersion));
|
|
|
json_object_object_add(Get15118EVCertificate, "action", json_object_new_string((char*)ShmOCPP20Data->Get15118EVCertificate.action));
|
|
|
json_object_object_add(Get15118EVCertificate, "exiRequest", json_object_new_string((char*)ShmOCPP20Data->Get15118EVCertificate.exiRequest));
|
|
@@ -5970,6 +5979,7 @@ int sendGetCertificateStatusRequest()
|
|
|
char tempdata[128]={0};
|
|
|
json_object *GetCertificateStatus = json_object_new_object();
|
|
|
json_object *ocspRequestData = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendGetCertificateStatusRequest...\n");
|
|
|
|
|
|
json_object_object_add(ocspRequestData, "hashAlgorithm", json_object_new_string((char*)ShmOCPP20Data->GetCertificateStatus.ocspRequestData.hashAlgorithm));
|
|
|
json_object_object_add(ocspRequestData, "issuerNameHash", json_object_new_string((char*)ShmOCPP20Data->GetCertificateStatus.ocspRequestData.issuerNameHash));
|
|
@@ -5999,6 +6009,7 @@ int sendHeartbeatRequest()
|
|
|
char message[40096]={0};
|
|
|
char guid[37]={0};
|
|
|
char tempdata[128]={0};
|
|
|
+ DEBUG_INFO("sendHeartbeatRequest...\n");
|
|
|
|
|
|
random_uuid(guid);
|
|
|
|
|
@@ -6027,7 +6038,7 @@ int sendLogStatusNotificationRequest(char *status)
|
|
|
char tempdata[128]={0};
|
|
|
json_object *LogStatusNotification = json_object_new_object();
|
|
|
|
|
|
- DEBUG_INFO("sendLogStatusNotificationRequest \n");
|
|
|
+ DEBUG_INFO("sendLogStatusNotificationRequest...\n");
|
|
|
ShmOCPP20Data->LogStatusNotification.requestId = ShmOCPP20Data->GetLog.requestId;
|
|
|
sprintf((char *)ShmOCPP20Data->LogStatusNotification.status,"%s",(const char *)status);
|
|
|
|
|
@@ -6091,12 +6102,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
int tempIndex = 0;
|
|
|
json_object *MeterValueReq = json_object_new_object();
|
|
|
json_object *meterValues = json_object_new_array();
|
|
|
- json_object *meterValue = json_object_new_object();
|
|
|
json_object *sampledValues = json_object_new_array();
|
|
|
- json_object *sampledValue = json_object_new_object();
|
|
|
- json_object *unitOfMeasure = json_object_new_object();
|
|
|
-
|
|
|
- DEBUG_INFO("sendMeterValuesRequest ...\n");
|
|
|
+ DEBUG_INFO("sendMeterValuesRequest...\n");
|
|
|
|
|
|
memset(queuedata, 0, ARRAY_SIZE(queuedata));
|
|
|
//set value
|
|
@@ -6855,13 +6862,16 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
// Message create ====================================================================================================
|
|
|
random_uuid(guid);
|
|
|
|
|
|
- uint8_t idxMeter = 0;
|
|
|
- while(strlen((char*)ShmOCPP20Data->MeterValues[gun_index].meterValue[idxMeter].timestamp) > 0)
|
|
|
+ for(uint8_t idxMeter=0;idxMeter<ARRAY_SIZE(ShmOCPP20Data->MeterValues[gun_index].meterValue);idxMeter++)
|
|
|
{
|
|
|
+ json_object *meterValue = json_object_new_object();
|
|
|
+
|
|
|
for(int idxSample=0;idxSample<ARRAY_SIZE(ShmOCPP20Data->MeterValues[gun_index].meterValue[idxMeter].sampledValue);idxSample++)
|
|
|
{
|
|
|
if(ShmOCPP20Data->MeterValues[gun_index].meterValue[idxMeter].sampledValue[idxSample].value > 0)
|
|
|
{
|
|
|
+ json_object *sampledValue = json_object_new_object();
|
|
|
+
|
|
|
json_object_object_add(sampledValue, "value", json_object_new_double(ShmOCPP20Data->MeterValues[gun_index].meterValue[idxMeter].sampledValue[idxSample].value));
|
|
|
|
|
|
if(strlen((char*)ShmOCPP20Data->MeterValues[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0)
|
|
@@ -6878,6 +6888,7 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
|
|
|
|
|
|
if(strlen((char*)ShmOCPP20Data->MeterValues[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint) > 0)
|
|
|
{
|
|
|
+ json_object *unitOfMeasure = json_object_new_object();
|
|
|
json_object_object_add(unitOfMeasure, "unit", json_object_new_string((char*)ShmOCPP20Data->MeterValues[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint));
|
|
|
json_object_object_add(unitOfMeasure, "multiplier", json_object_new_int(ShmOCPP20Data->MeterValues[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.multiplier));
|
|
|
json_object_object_add(sampledValue, "unitOfMeasure", unitOfMeasure);
|
|
@@ -6943,6 +6954,7 @@ int sendNotifyChargingLimitRequest(int gun_index)
|
|
|
char tempdata[128]={0};
|
|
|
json_object *NotifyChargingLimit = json_object_new_object();
|
|
|
json_object *chargingLimit = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendNotifyChargingLimitRequest...\n");
|
|
|
|
|
|
json_object_object_add(NotifyChargingLimit, "evseId", json_object_new_int(ShmOCPP20Data->NotifyChargingLimit[gun_index].evseId));
|
|
|
json_object_object_add(chargingLimit, "chargingLimitSource", json_object_new_string((char*)ShmOCPP20Data->NotifyChargingLimit[gun_index].chargingLimit.chargingLimitSource));
|
|
@@ -6970,6 +6982,7 @@ int sendNotifyCustomerInformationRequest()
|
|
|
char guid[37]={0};
|
|
|
char tempdata[128]={0};
|
|
|
json_object *NotifyCustomerInformation = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendNotifyCustomerInformationRequest...\n");
|
|
|
|
|
|
json_object_object_add(NotifyCustomerInformation, "data", json_object_new_string((char*)ShmOCPP20Data->NotifyCustomerInformation.data));
|
|
|
json_object_object_add(NotifyCustomerInformation, "tbc", json_object_new_boolean(ShmOCPP20Data->NotifyCustomerInformation.tbc));
|
|
@@ -6999,6 +7012,7 @@ int sendNotifyDisplayMessagesRequest()
|
|
|
char tempdata[128]={0};
|
|
|
json_object *NotifyDisplayMessages = json_object_new_object();
|
|
|
json_object *messageInfos = json_object_new_array();
|
|
|
+ DEBUG_INFO("sendNotifyDisplayMessagesRequest...\n");
|
|
|
|
|
|
json_object_object_add(NotifyDisplayMessages, "requestId", json_object_new_int(ShmOCPP20Data->NotifyDisplayMessages.requestId));
|
|
|
json_object_object_add(NotifyDisplayMessages, "tbc", json_object_new_boolean(ShmOCPP20Data->NotifyDisplayMessages.tbc));
|
|
@@ -7060,6 +7074,7 @@ int sendNotifyEVChargingNeedsRequest(int gun_index)
|
|
|
json_object *chargingNeeds = json_object_new_object();
|
|
|
json_object *acChargingParameters = json_object_new_object();
|
|
|
json_object *dcChargingParameters = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendNotifyEVChargingNeedsRequest...\n");
|
|
|
|
|
|
json_object_object_add(NotifyEVChargingNeeds, "maxScheduleTuples", json_object_new_int(ShmOCPP20Data->NotifyEVChargingNeeds[gun_index].maxScheduleTuples));
|
|
|
json_object_object_add(NotifyEVChargingNeeds, "evseId", json_object_new_int(ShmOCPP20Data->NotifyEVChargingNeeds[gun_index].evseId));
|
|
@@ -7108,6 +7123,7 @@ int sendNotifyEVChargingScheduleRequest(int gun_index)
|
|
|
json_object *NotifyEVChargingSchedule = json_object_new_object();
|
|
|
json_object *chargingSchedule = json_object_new_object();
|
|
|
json_object *periods = json_object_new_array();
|
|
|
+ DEBUG_INFO("sendNotifyEVChargingScheduleRequest...\n");
|
|
|
|
|
|
json_object_object_add(NotifyEVChargingSchedule, "timeBase", json_object_new_string((char*)ShmOCPP20Data->NotifyEVChargingSchedule[gun_index].timeBase));
|
|
|
json_object_object_add(NotifyEVChargingSchedule, "evseId", json_object_new_int(ShmOCPP20Data->NotifyEVChargingSchedule[gun_index].evseId));
|
|
@@ -7161,6 +7177,7 @@ int sendNotifyEventRequest()
|
|
|
char tempdata[128]={0};
|
|
|
json_object *NotifyEvent = json_object_new_object();
|
|
|
json_object *eventDatas = json_object_new_array();
|
|
|
+ DEBUG_INFO("sendNotifyEventRequest...\n");
|
|
|
|
|
|
json_object_object_add(NotifyEvent, "generatedAt", json_object_new_string((char*)ShmOCPP20Data->NotifyEvent.generatedAt));
|
|
|
json_object_object_add(NotifyEvent, "tbc", json_object_new_boolean(ShmOCPP20Data->NotifyEvent.tbc));
|
|
@@ -7225,6 +7242,7 @@ int sendNotifyMonitoringReportRequest()
|
|
|
char tempdata[128]={0};
|
|
|
json_object *NotifyMonitoringReport = json_object_new_object();
|
|
|
json_object *monitors = json_object_new_array();
|
|
|
+ DEBUG_INFO("sendNotifyMonitoringReportRequest...\n");
|
|
|
|
|
|
json_object_object_add(NotifyMonitoringReport, "requestId", json_object_new_int(ShmOCPP20Data->NotifyMonitoringReport.requestId));
|
|
|
json_object_object_add(NotifyMonitoringReport, "tbc", json_object_new_int(ShmOCPP20Data->NotifyMonitoringReport.tbc));
|
|
@@ -7296,6 +7314,7 @@ int sendNotifyReportRequest()
|
|
|
char tempdata[128]={0};
|
|
|
json_object *NotifyReport = json_object_new_object();
|
|
|
json_object *reportDatas = json_object_new_array();
|
|
|
+ DEBUG_INFO("sendNotifyReportRequest...\n");
|
|
|
|
|
|
json_object_object_add(NotifyReport, "requestId", json_object_new_int(ShmOCPP20Data->NotifyReport.requestId));
|
|
|
json_object_object_add(NotifyReport, "generatedAt", json_object_new_string((char*)ShmOCPP20Data->NotifyReport.generatedAt));
|
|
@@ -7373,6 +7392,7 @@ int sendPublishFirmwareStatusNotificationRequest()
|
|
|
char tempdata[128]={0};
|
|
|
json_object *PublishFirmwareStatusNotification = json_object_new_object();
|
|
|
json_object *locations = json_object_new_array();
|
|
|
+ DEBUG_INFO("sendPublishFirmwareStatusNotificationRequest...\n");
|
|
|
|
|
|
json_object_object_add(PublishFirmwareStatusNotification, "status", json_object_new_string((char*)ShmOCPP20Data->PublishFirmwareStatusNotificatio.status));
|
|
|
json_object_object_add(PublishFirmwareStatusNotification, "requestId", json_object_new_int(ShmOCPP20Data->PublishFirmwareStatusNotificatio.requestId));
|
|
@@ -7405,6 +7425,7 @@ int sendReportChargingProfilesRequest(int gun_index)
|
|
|
char tempdata[128]={0};
|
|
|
json_object *ReportChargingProfiles = json_object_new_object();
|
|
|
json_object *chargingProfiles = json_object_new_array();
|
|
|
+ DEBUG_INFO("sendReportChargingProfilesRequest...\n");
|
|
|
|
|
|
json_object_object_add(ReportChargingProfiles, "requestId", json_object_new_int(ShmOCPP20Data->ReportChargingProfiles[gun_index].requestId));
|
|
|
json_object_object_add(ReportChargingProfiles, "chargingLimitSource", json_object_new_string((char*)ShmOCPP20Data->ReportChargingProfiles[gun_index].chargingLimitSource));
|
|
@@ -7478,6 +7499,7 @@ int sendReservationStatusUpdateRequest(int gun_index)
|
|
|
char guid[37]={0};
|
|
|
char tempdata[128]={0};
|
|
|
json_object *ReservationStatusUpdate = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendReservationStatusUpdateRequest...\n");
|
|
|
|
|
|
json_object_object_add(ReservationStatusUpdate, "reservationId", json_object_new_int(ShmOCPP20Data->ReservationStatusUpdate[gun_index].reservationId));
|
|
|
json_object_object_add(ReservationStatusUpdate, "reservationUpdateStatus", json_object_new_string((char*)ShmOCPP20Data->ReservationStatusUpdate[gun_index].reservationUpdateStatus));
|
|
@@ -7503,6 +7525,7 @@ int sendSecurityEventNotificationRequest()
|
|
|
char guid[37]={0};
|
|
|
char tempdata[128]={0};
|
|
|
json_object *SecurityEventNotification = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendSecurityEventNotificationRequest...\n");
|
|
|
|
|
|
json_object_object_add(SecurityEventNotification, "type", json_object_new_string((char*)ShmOCPP20Data->SecurityEventNotification.type));
|
|
|
json_object_object_add(SecurityEventNotification, "timestamp", json_object_new_string((char*)ShmOCPP20Data->SecurityEventNotification.timestamp));
|
|
@@ -7529,6 +7552,7 @@ int sendSignCertificateRequest()
|
|
|
char guid[37]={0};
|
|
|
char tempdata[128]={0};
|
|
|
json_object *SignCertificate = json_object_new_object();
|
|
|
+ DEBUG_INFO("sendSignCertificateRequest...\n");
|
|
|
|
|
|
json_object_object_add(SignCertificate, "csr", json_object_new_string((char*)ShmOCPP20Data->SignCertificate.csr));
|
|
|
json_object_object_add(SignCertificate, "certificateType", json_object_new_string((char*)ShmOCPP20Data->SignCertificate.certificateType));
|
|
@@ -7559,6 +7583,7 @@ int sendStatusNotificationRequest(int gun_index)
|
|
|
char buf[28];//, usec_buf[6];
|
|
|
char tempdata[65]={0};
|
|
|
int tempIndex = 0;
|
|
|
+ DEBUG_INFO("sendStatusNotificationRequest...\n");
|
|
|
|
|
|
gettimeofday(&tmnow, NULL);
|
|
|
|
|
@@ -7628,6 +7653,7 @@ S_FAULT =12
|
|
|
currentStatus = ConnectorStatusEnumType_Available; //OCPP Status: Available
|
|
|
}
|
|
|
|
|
|
+ memset(&ShmOCPP20Data->TransactionEvent[index].eventType[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[index].eventType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].transactionInfo, 0x00, sizeof(struct TransactionType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].idToken, 0x00, sizeof(struct IdTokenType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].meterValue, 0x00, sizeof(struct MeterValueType));
|
|
@@ -7694,6 +7720,7 @@ S_FAULT =12
|
|
|
currentStatus = ConnectorStatusEnumType_Available; //OCPP Status: Available
|
|
|
}
|
|
|
|
|
|
+ memset(&ShmOCPP20Data->TransactionEvent[index].eventType[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[index].eventType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].transactionInfo, 0x00, sizeof(struct TransactionType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].idToken, 0x00, sizeof(struct IdTokenType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].meterValue, 0x00, sizeof(struct MeterValueType));
|
|
@@ -7759,6 +7786,7 @@ S_FAULT =12
|
|
|
currentStatus = ConnectorStatusEnumType_Available; //OCPP Status: Available
|
|
|
}
|
|
|
|
|
|
+ memset(&ShmOCPP20Data->TransactionEvent[index].eventType[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[index].eventType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].transactionInfo, 0x00, sizeof(struct TransactionType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].idToken, 0x00, sizeof(struct IdTokenType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].meterValue, 0x00, sizeof(struct MeterValueType));
|
|
@@ -7816,6 +7844,7 @@ S_FAULT =12
|
|
|
currentStatus = ConnectorStatusEnumType_Available; //OCPP Status: Available
|
|
|
}
|
|
|
|
|
|
+ memset(&ShmOCPP20Data->TransactionEvent[index].eventType[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[index].eventType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].transactionInfo, 0x00, sizeof(struct TransactionType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].idToken, 0x00, sizeof(struct IdTokenType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].meterValue, 0x00, sizeof(struct MeterValueType));
|
|
@@ -7879,6 +7908,7 @@ S_FAULT =12
|
|
|
currentStatus = ConnectorStatusEnumType_Available; //OCPP Status: Available
|
|
|
}
|
|
|
|
|
|
+ memset(&ShmOCPP20Data->TransactionEvent[index].eventType[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[index].eventType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].transactionInfo, 0x00, sizeof(struct TransactionType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].idToken, 0x00, sizeof(struct IdTokenType));
|
|
|
memset(&ShmOCPP20Data->TransactionEvent[index].meterValue, 0x00, sizeof(struct MeterValueType));
|
|
@@ -7959,6 +7989,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
json_object *idToken = json_object_new_object();
|
|
|
json_object *evse = json_object_new_object();
|
|
|
json_object *meterValues = json_object_new_array();
|
|
|
+ DEBUG_INFO("sendTransactionEventRequest...\n");
|
|
|
|
|
|
if(gunType[gun_index] == 'J')
|
|
|
{
|
|
@@ -7984,7 +8015,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
ShmOCPP20Data->TransactionEvent[index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
|
|
|
- ShmOCPP20Data->TransactionEvent[index].evse.id = 0;
|
|
|
+ ShmOCPP20Data->TransactionEvent[index].evse.id = (gun_index + 1);
|
|
|
ShmOCPP20Data->TransactionEvent[index].evse.connectorId = (gun_index + 1);
|
|
|
|
|
|
if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_IDLE)//S_IDLE
|
|
@@ -8016,16 +8047,21 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
) //S_PRECHARGE
|
|
|
{
|
|
|
if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
|
|
|
+ {
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].StartUserId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.type, "%s", ShmOCPP20Data->Authorize.idToken.type);
|
|
|
+ }
|
|
|
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ if(ShmOCPP20Data->TransactionEvent[index].eventType[0] == '\0')
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ else
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_EVConnected]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].StartUserId);
|
|
|
-
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -8089,7 +8125,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
ShmOCPP20Data->TransactionEvent[index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
|
|
|
- ShmOCPP20Data->TransactionEvent[index].evse.id = 0;
|
|
|
+ ShmOCPP20Data->TransactionEvent[index].evse.id = (gun_index + 1);
|
|
|
ShmOCPP20Data->TransactionEvent[index].evse.connectorId = (gun_index + 1);
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_IDLE) //S_IDLE
|
|
@@ -8121,16 +8157,21 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
) //S_PRECHARGE
|
|
|
{
|
|
|
if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
|
|
|
+ {
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].StartUserId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.type, "%s", ShmOCPP20Data->Authorize.idToken.type);
|
|
|
+ }
|
|
|
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ if(ShmOCPP20Data->TransactionEvent[index].eventType[0] == '\0')
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ else
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_EVConnected]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].StartUserId);
|
|
|
-
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -8193,7 +8234,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
ShmOCPP20Data->TransactionEvent[index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
|
|
|
- ShmOCPP20Data->TransactionEvent[index].evse.id = 0;
|
|
|
+ ShmOCPP20Data->TransactionEvent[index].evse.id = (gun_index + 1);
|
|
|
ShmOCPP20Data->TransactionEvent[index].evse.connectorId = (gun_index + 1);
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_IDLE) //S_IDLE
|
|
@@ -8225,16 +8266,21 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
) //S_PRECHARGE
|
|
|
{
|
|
|
if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
|
|
|
+ {
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.GbChargingData[index].StartUserId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.type, "%s", ShmOCPP20Data->Authorize.idToken.type);
|
|
|
+ }
|
|
|
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ if(ShmOCPP20Data->TransactionEvent[index].eventType[0] == '\0')
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ else
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_EVConnected]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.GbChargingData[index].StartUserId);
|
|
|
-
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -8290,7 +8336,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
ShmOCPP20Data->TransactionEvent[index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
|
|
|
- ShmOCPP20Data->TransactionEvent[index].evse.id = 0;
|
|
|
+ ShmOCPP20Data->TransactionEvent[index].evse.id = (gun_index + 1);
|
|
|
ShmOCPP20Data->TransactionEvent[index].evse.connectorId = (gun_index + 1);
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_IDLE) //S_IDLE
|
|
@@ -8322,16 +8368,21 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
) //S_PRECHARGE
|
|
|
{
|
|
|
if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
|
|
|
+ {
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.StartUserId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.type, "%s", ShmOCPP20Data->Authorize.idToken.type);
|
|
|
+ }
|
|
|
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ if(ShmOCPP20Data->TransactionEvent[index].eventType[0] == '\0')
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ else
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_EVConnected]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.StartUserId);
|
|
|
-
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -8393,7 +8444,7 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
ShmOCPP20Data->TransactionEvent[index].offline = (!ShmOCPP20Data->OcppConnStatus?TRUE:FALSE);
|
|
|
|
|
|
- ShmOCPP20Data->TransactionEvent[index].evse.id = 0;
|
|
|
+ ShmOCPP20Data->TransactionEvent[index].evse.id = (gun_index + 1);
|
|
|
ShmOCPP20Data->TransactionEvent[index].evse.connectorId = (gun_index + 1);
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_IDLE) //SYS_MODE_IDLE
|
|
@@ -8425,16 +8476,21 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
) //S_PRECHARGE
|
|
|
{
|
|
|
if(strlen((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId) == 0)
|
|
|
+ {
|
|
|
random_uuid((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.transactionId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.AcChargingData[index].StartUserId);
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.type, "%s", ShmOCPP20Data->Authorize.idToken.type);
|
|
|
+ }
|
|
|
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ if(ShmOCPP20Data->TransactionEvent[index].eventType[0] == '\0')
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Started]);
|
|
|
+ else
|
|
|
+ sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_EVConnected]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
|
}
|
|
|
else if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING) //S_CHARGING
|
|
|
{
|
|
|
- sprintf((char*)ShmOCPP20Data->TransactionEvent[index].idToken.idToken, "%s", ShmSysConfigAndInfo->SysInfo.AcChargingData[index].StartUserId);
|
|
|
-
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].eventType, "%s", TransactionEventEnumTypeStr[TransactionEventEnumType_Updated]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].transactionInfo.chargingState, "%s", ChargingStateEnumTypeStr[ChargingStateEnumType_Charging]);
|
|
|
sprintf((char*)ShmOCPP20Data->TransactionEvent[index].triggerReason, "%s", TriggerReasonEnumTypeStr[TriggerReasonEnumType_ChargingStateChanged]);
|
|
@@ -8528,20 +8584,33 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
|
|
|
for(int idxSample=0;idxSample<ARRAY_SIZE(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue);idxSample++)
|
|
|
{
|
|
|
- if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0)
|
|
|
+ if((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0) &&
|
|
|
+ ((strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0) || (strcmp((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) == 0)))
|
|
|
{
|
|
|
json_object *sampledValue = json_object_new_object();
|
|
|
- json_object *unitOfMeasure = json_object_new_object();
|
|
|
|
|
|
json_object_object_add(sampledValue, "value", json_object_new_double(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].value));
|
|
|
- json_object_object_add(sampledValue, "context", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context));
|
|
|
- json_object_object_add(sampledValue, "measurand", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand));
|
|
|
- json_object_object_add(sampledValue, "phase", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase));
|
|
|
- json_object_object_add(sampledValue, "location", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location));
|
|
|
|
|
|
- json_object_object_add(unitOfMeasure, "unit", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint));
|
|
|
- json_object_object_add(unitOfMeasure, "multiplier", json_object_new_int(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.multiplier));
|
|
|
- json_object_object_add(sampledValue, "unitOfMeasure", unitOfMeasure);
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context) > 0)
|
|
|
+ json_object_object_add(sampledValue, "context", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].context));
|
|
|
+
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand) > 0)
|
|
|
+ json_object_object_add(sampledValue, "measurand", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].measurand));
|
|
|
+
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase) > 0)
|
|
|
+ json_object_object_add(sampledValue, "phase", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].phase));
|
|
|
+
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location) > 0)
|
|
|
+ json_object_object_add(sampledValue, "location", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].location));
|
|
|
+
|
|
|
+ if(strlen((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint) > 0)
|
|
|
+ {
|
|
|
+ json_object *unitOfMeasure = json_object_new_object();
|
|
|
+
|
|
|
+ json_object_object_add(unitOfMeasure, "unit", json_object_new_string((char*)ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.uint));
|
|
|
+ json_object_object_add(unitOfMeasure, "multiplier", json_object_new_int(ShmOCPP20Data->TransactionEvent[gun_index].meterValue[idxMeter].sampledValue[idxSample].unitOfMeasure.multiplier));
|
|
|
+ json_object_object_add(sampledValue, "unitOfMeasure", unitOfMeasure);
|
|
|
+ }
|
|
|
|
|
|
json_object_array_add(sampledValues, sampledValue);
|
|
|
}
|
|
@@ -8556,13 +8625,15 @@ int sendTransactionEventRequest(int gun_index)
|
|
|
random_uuid(guid);
|
|
|
sprintf(message,"[%d,\"%s\",\"%s\",%s]",MESSAGE_TYPE_CALL, guid, "TransactionEvent", json_object_to_json_string_ext(TransactionEvent, JSON_C_TO_STRING_PLAIN));
|
|
|
json_object_put(TransactionEvent);
|
|
|
- LWS_Send(message);
|
|
|
|
|
|
sprintf(tempdata, "TransactionEvent,%d", gun_index);
|
|
|
if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
|
|
|
{
|
|
|
result = PASS;
|
|
|
}
|
|
|
+
|
|
|
+ queue_operation(QUEUE_OPERATION_ADD, guid, message);
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -9153,7 +9224,7 @@ int sendGetVariablesConfirmation(char *uuid, unsigned char variableQuantity)
|
|
|
|
|
|
json_object_array_add(getVariableResults, variableResult);
|
|
|
}
|
|
|
- json_object_object_add(GetVariables , "setVariableResult", getVariableResults);
|
|
|
+ json_object_object_add(GetVariables , "getVariableResult", getVariableResults);
|
|
|
|
|
|
sprintf(message,"[%d,\"%s\",%s]"
|
|
|
,MESSAGE_TYPE_CALLRESULT
|