|
@@ -2108,7 +2108,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_OfflineThreshold].variable.name, "OfflineThreshold");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_OfflineThreshold].variableCharacteristics.unit, "Seconds");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_OfflineThreshold].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_integer]);
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_OfflineThreshold].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_OfflineThreshold].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Actual]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_OfflineThreshold].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_OfflineThreshold].variableAttribute[0].value, "30");
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_OfflineThreshold]);
|
|
@@ -2332,7 +2332,7 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableCharacteristics.maxLimit = 40;
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_WriteOnly]);
|
|
|
- sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableAttribute[0].value, "%s", ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword);
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword].variableAttribute[0].value, "%s", (strlen((char*)ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword)>0?(char*)ShmSysConfigAndInfo->SysConfig.OcppSecurityPassword:"00000000"));
|
|
|
DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_BasicAuthPassword]);
|
|
|
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SecurityCtrlr_Identity].component.name, "SecurityCtrlr");
|
|
@@ -7351,7 +7351,7 @@ void CheckSystemValue(void)
|
|
|
|
|
|
}
|
|
|
|
|
|
- if(isWebsocketSendable && (server_sign == TRUE) && (getDiffSecNow(clientTime.StatusNotification[gun_index]) >= 5) &&
|
|
|
+ if(isWebsocketSendable && (server_sign == TRUE) && (getDiffSecNow(clientTime.StatusNotification[gun_index]) >= 5) && (ShmOCPP20Data->MsMsg.bits.ResetConf != ON) &&
|
|
|
((cpinitateMsg.bits[gun_index].StatusNotificationReq == ON) || (cpinitateMsg.bits[gun_index].TriggerStatusNotificationReq == ON) ||
|
|
|
((strcmp((const char *)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_StatusNotificationPeriodically].variableAttribute[0].value, "TRUE") == 0) &&
|
|
|
(getDiffSecNow(clientTime.StatusNotification[gun_index]) >= atoi((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_StatusNotificationInterval].variableAttribute[0].value)))))
|
|
@@ -9606,8 +9606,9 @@ int sendNotifyReportRequest()
|
|
|
json_object_object_add(variableCharacteristics, "dataType", json_object_new_string((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableCharacteristics.dataType));
|
|
|
json_object_object_add(variableCharacteristics, "minLimit", json_object_new_double(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableCharacteristics.minLimit));
|
|
|
json_object_object_add(variableCharacteristics, "maxLimit", json_object_new_double(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableCharacteristics.maxLimit));
|
|
|
+ json_object_object_add(variableCharacteristics, "supportsMonitoring", json_object_new_boolean(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableCharacteristics.supportsMonitoring));
|
|
|
json_object_object_add(reportData, "variableCharacteristics",variableCharacteristics);
|
|
|
-
|
|
|
+ DEBUG_INFO("+++++++++++++++++++-->VariableName: %s\n", ShmOCPP20Data->NotifyReport.reportData[idxReport].variable.name);
|
|
|
for(int idxAttr=0;idxAttr<ARRAY_SIZE(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute);idxAttr++)
|
|
|
{
|
|
|
if(strlen((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].value) > 0)
|
|
@@ -9621,6 +9622,27 @@ int sendNotifyReportRequest()
|
|
|
|
|
|
json_object_array_add(variableAttributes, variableAttribute);
|
|
|
}
|
|
|
+ /*else
|
|
|
+ {
|
|
|
+ sprintf((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_WriteOnly]);
|
|
|
+ sprintf((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].value, "%s", "0");
|
|
|
+ json_object *variableAttribute = json_object_new_object();q1314qgrh
|
|
|
+ //if(strlen((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].type)==0)
|
|
|
+ DEBUG_INFO("AAAAAAAAAAAAAAAAA\n");
|
|
|
+ json_object_object_add(variableAttribute, "type", json_object_new_string((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].type));
|
|
|
+ DEBUG_INFO("BBBBBBBBBBBBBBBBBBB\n");
|
|
|
+ json_object_object_add(variableAttribute, "value", json_object_new_string((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].value));
|
|
|
+ DEBUG_INFO("CCCCCCCCCCCCCCCCCCCCC\n");
|
|
|
+ json_object_object_add(variableAttribute, "mutability", json_object_new_string((char*)ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].mutability));
|
|
|
+ DEBUG_INFO("DDDDDDDDDDDDDDDDDDDDDD\n");
|
|
|
+ json_object_object_add(variableAttribute, "persistent", json_object_new_boolean(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].persistent));
|
|
|
+ DEBUG_INFO("EEEEEEEEEEEEEEEEEEE\n");
|
|
|
+ json_object_object_add(variableAttribute, "constant", json_object_new_boolean(ShmOCPP20Data->NotifyReport.reportData[idxReport].variableAttribute[idxAttr].constant));
|
|
|
+ DEBUG_INFO("FFFFFFFFFFFFFFFFFFF\n");
|
|
|
+ json_object_array_add(variableAttributes, variableAttribute);
|
|
|
+ DEBUG_INFO("GGGGGGGGGGGGGGGGGGGGG\n");
|
|
|
+ }*/
|
|
|
}
|
|
|
json_object_object_add(reportData, "variableAttribute", variableAttributes);
|
|
|
|
|
@@ -14914,7 +14936,6 @@ int handleGetReportRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
ShmOCPP20Data->GetReport.requestId = json_object_get_int(json_object_object_get(GetReport, "requestId"));
|
|
|
}
|
|
|
-
|
|
|
// Optional data
|
|
|
if(json_object_object_get(GetReport, "componentCriteria") != NULL)
|
|
|
{
|
|
@@ -14941,7 +14962,7 @@ int handleGetReportRequest(char *uuid, char *payload)
|
|
|
|
|
|
if(json_object_object_get(json_object_object_get(json_object_array_get_idx(json_object_object_get(GetReport, "componentVariable"), idx), "component"), "evse") != NULL)
|
|
|
{
|
|
|
- if(json_object_object_get(json_object_object_get(json_object_object_get(json_object_array_get_idx(json_object_object_get(GetReport, "getVariableData"), idx), "component"), "evse"), "id") != NULL)
|
|
|
+ if(json_object_object_get(json_object_object_get(json_object_object_get(json_object_array_get_idx(json_object_object_get(GetReport, "componentVariable"), idx), "component"), "evse"), "id") != NULL)
|
|
|
{
|
|
|
ShmOCPP20Data->GetReport.componentVariable[idx].component.evse.id = json_object_get_int(json_object_object_get(json_object_object_get(json_object_object_get(json_object_array_get_idx(json_object_object_get(GetReport, "componentVariable"), idx), "component"), "evse"), "id"));
|
|
|
}
|
|
@@ -14971,7 +14992,6 @@ int handleGetReportRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
json_object_put(GetReport);
|
|
|
|
|
|
-
|
|
|
/*
|
|
|
* TODO:
|
|
|
* 1. Response result
|
|
@@ -15041,6 +15061,11 @@ int handleGetVariablesRequest(char *uuid, char *payload)
|
|
|
strcpy((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeType, (char*)ShmOCPP20Data->GetVariables.getVariableData[idx].attributeType);
|
|
|
}
|
|
|
|
|
|
+ /*if(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeType != NULL)
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeType, "Actual");
|
|
|
+ }*/
|
|
|
+
|
|
|
if(json_object_object_get(json_object_array_get_idx(json_object_object_get(GetVariables, "getVariableData"), idx), "component") != NULL)
|
|
|
{
|
|
|
if(json_object_object_get(json_object_object_get(json_object_array_get_idx(json_object_object_get(GetVariables, "getVariableData"), idx), "component"), "name") != NULL)
|
|
@@ -15116,6 +15141,7 @@ int handleGetVariablesRequest(char *uuid, char *payload)
|
|
|
else
|
|
|
{
|
|
|
strcpy((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeValue, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value);
|
|
|
+ strcpy((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeType, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].type);
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -15950,8 +15976,15 @@ int handleReserveNowRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_IDLE) //S_IDLE
|
|
|
{
|
|
|
- ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].ReserveNowReq = ON;
|
|
|
- strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Accepted]);
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn == 1) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].InProgress == 1))
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Occupied]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].ReserveNowReq = ON;
|
|
|
+ strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Accepted]);
|
|
|
+ }
|
|
|
}
|
|
|
else if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_MAINTAIN)||(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_UPDATE)) //S_TERMINATING //else if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == 11) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == '9'))
|
|
|
{
|
|
@@ -16006,8 +16039,15 @@ int handleReserveNowRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_IDLE) //S_IDLE
|
|
|
{
|
|
|
- ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].ReserveNowReq = ON;
|
|
|
- strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Accepted]);
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn == 1) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].InProgress == 1))
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Occupied]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].ReserveNowReq = ON;
|
|
|
+ strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Accepted]);
|
|
|
+ }
|
|
|
}
|
|
|
else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_MAINTAIN) ||(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_UPDATE)) //S_TERMINATING //else if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == '6') || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == '9'))
|
|
|
{
|
|
@@ -16061,8 +16101,15 @@ int handleReserveNowRequest(char *uuid, char *payload)
|
|
|
|
|
|
if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_IDLE) //S_IDLE
|
|
|
{
|
|
|
- ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].ReserveNowReq = ON;
|
|
|
- strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Accepted]);
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn == 1) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].InProgress == 1))
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Occupied]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].ReserveNowReq = ON;
|
|
|
+ strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Accepted]);
|
|
|
+ }
|
|
|
}
|
|
|
else if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_MAINTAIN) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_UPDATE)) //S_TERMINATING //else if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == '6') || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == '9'))
|
|
|
{
|
|
@@ -16109,8 +16156,15 @@ int handleReserveNowRequest(char *uuid, char *payload)
|
|
|
|
|
|
if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_IDLE) //S_IDLE
|
|
|
{
|
|
|
- ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].ReserveNowReq = ON;
|
|
|
- strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Accepted]);
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.ConnectorPlugIn == 1) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.InProgress == 1))
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Occupied]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ShmOCPP20Data->CsMsg.bits[connectorIdInt-1].ReserveNowReq = ON;
|
|
|
+ strcpy((char*)ShmOCPP20Data->ReserveNow[connectorIdInt-1].Response_status, ReserveNowStatusEnumTypeStr[ReserveNowStatusEnumType_Accepted]);
|
|
|
+ }
|
|
|
}
|
|
|
else if((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_MAINTAIN) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_DEBUG) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus == SYS_MODE_UPDATE)) //S_TERMINATING //else if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == '6') || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == '9'))
|
|
|
{
|
|
@@ -17622,6 +17676,11 @@ int handleSetVariableMonitoringRequest(char *uuid, char *payload)
|
|
|
strcpy((char*)ShmOCPP20Data->SetVariableMonitoring.Response_setMonitoringResult[idx].type, (char*)ShmOCPP20Data->SetVariableMonitoring.setMonitoringData[idx].type);
|
|
|
}
|
|
|
|
|
|
+ if(strlen((char*)ShmOCPP20Data->SetVariableMonitoring.Response_setMonitoringResult[idx].type) == 0)
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->SetVariableMonitoring.Response_setMonitoringResult[idx].type, "Actual");
|
|
|
+ }
|
|
|
+
|
|
|
if(json_object_object_get(json_object_array_get_idx(json_object_object_get(SetVariableMonitoring, "setMonitoringData"), idx), "severity") != NULL)
|
|
|
{
|
|
|
ShmOCPP20Data->SetVariableMonitoring.setMonitoringData[idx].severity = json_object_get_int(json_object_object_get(json_object_array_get_idx(json_object_object_get(SetVariableMonitoring, "setMonitoringData"), idx), "severity"));
|
|
@@ -17754,6 +17813,11 @@ int handleSetVariablesRequest(char *uuid, char *payload)
|
|
|
strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeType, (char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeType);
|
|
|
}
|
|
|
|
|
|
+ if(strlen((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeType) == 0)
|
|
|
+ {
|
|
|
+ strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeType, "Actual");
|
|
|
+ }
|
|
|
+
|
|
|
if(json_object_object_get(json_object_array_get_idx(json_object_object_get(SetVariables, "setVariableData"), idx), "attributeValue") != NULL)
|
|
|
{
|
|
|
sprintf((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue, "%s", json_object_get_string(json_object_object_get(json_object_array_get_idx(json_object_object_get(SetVariables, "setVariableData"), idx), "attributeValue")));
|
|
@@ -18642,6 +18706,7 @@ void handleBootNotificationResponse(char *payload, int gun_index)
|
|
|
server_sign = TRUE;
|
|
|
server_pending =FALSE;
|
|
|
DB_updateBootType(BootReasonEnumType_PowerUp);
|
|
|
+ sendSecurityEventNotificationRequest();
|
|
|
}
|
|
|
else if(strcmp(statusStr, RegistrationStatusEnumTypeStr[RegistrationStatusEnumType_Pending]) == 0)
|
|
|
{
|