|
@@ -2466,6 +2466,10 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[Connector_SupplyPhases].component.name, "Connector");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[Connector_SupplyPhases].variable.name, "SupplyPhases");
|
|
|
|
|
|
+ /* CustomizationCtrlr Required item */
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[CustomizationCtrlr_CustomImplementationEnabled].component.name, "CustomizationCtrlr");
|
|
|
+ sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[CustomizationCtrlr_CustomImplementationEnabled].variable.name, "CustomImplementationEnabled");
|
|
|
+
|
|
|
/* DeviceDataCtrlr Required item */
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[DeviceDataCtrlr_GetReport_ItemsPerMessage].component.name, "DeviceDataCtrlr");
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[DeviceDataCtrlr_GetReport_ItemsPerMessage].variable.instance, "GetReport");
|
|
@@ -2780,10 +2784,10 @@ int DB_cbVariableLoadFromDb(void *para, int columnCount, char **columnValue, cha
|
|
|
{
|
|
|
for(int idx=0;idx<CtrlrVariable_CNT;idx++)
|
|
|
{
|
|
|
- if((strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx].component.name, columnValue[1]) != NULL) &&
|
|
|
- (strlen(columnValue[2])>0?(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx].component.instance, columnValue[2]) != NULL):TRUE) &&
|
|
|
- (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variable.name, columnValue[3]) != NULL) &&
|
|
|
- (strlen(columnValue[4])>0?(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variable.instance, columnValue[4]) != NULL):TRUE))
|
|
|
+ if((strcmp((char*)ShmOCPP20Data->ControllerComponentVariable[idx].component.name, columnValue[1]) == 0) &&
|
|
|
+ (strcmp((char*)ShmOCPP20Data->ControllerComponentVariable[idx].component.instance, columnValue[2]) == 0) &&
|
|
|
+ (strcmp((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variable.name, columnValue[3]) == 0) &&
|
|
|
+ (strcmp((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variable.instance, columnValue[4]) == 0))
|
|
|
{
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variableCharacteristics.dataType, "%s", columnValue[5]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variableCharacteristics.unit, "%s", columnValue[6]);
|
|
@@ -2802,7 +2806,7 @@ void DB_variableLoadFromDb()
|
|
|
char sql[512];
|
|
|
char* errMsg = NULL;
|
|
|
|
|
|
- sprintf(sql,"select * from ocpp20_variable;");
|
|
|
+ sprintf(sql,"select * from ocpp20_variable order by idx;");
|
|
|
|
|
|
/* Execute SQL statement */
|
|
|
if(sqlite3_exec(db, sql, DB_cbVariableLoadFromDb, 0, &errMsg) != SQLITE_OK )
|
|
@@ -4936,29 +4940,80 @@ void CheckSystemValue(void)
|
|
|
(server_sign == TRUE) &&
|
|
|
(ShmOCPP20Data->GetBaseReport.requestId > 0))
|
|
|
{
|
|
|
+ uint8_t reportIdx = 0;
|
|
|
+
|
|
|
+ ShmOCPP20Data->NotifyReport.requestId = ShmOCPP20Data->GetBaseReport.requestId;
|
|
|
+
|
|
|
if(strcmp((char*)ShmOCPP20Data->GetBaseReport.reportBase, ReportBaseEnumTypeStr[ReportBaseEnumType_ConfigurationInventory]) == 0)
|
|
|
{
|
|
|
- /*
|
|
|
- * TODO:
|
|
|
- * 1. Fill out configuration to response message
|
|
|
- */
|
|
|
+ for(uint8_t idx_var=0;idx_var<CtrlrVariable_CNT;idx_var++)
|
|
|
+ {
|
|
|
+ if(reportIdx < ARRAY_SIZE(ShmOCPP20Data->NotifyReport.reportData))
|
|
|
+ {
|
|
|
+ if((strcmp((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].mutability, MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]) == 0) || (strcmp((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].mutability, MutabilityEnumTypeStr[MutabilityEnumType_WriteOnly]) == 0))
|
|
|
+ {
|
|
|
+ memcpy(&ShmOCPP20Data->NotifyReport.reportData[reportIdx], &ShmOCPP20Data->ControllerComponentVariable[idx_var], sizeof(struct ReportDataType));
|
|
|
+ reportIdx++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ getNowDatetime(ShmOCPP20Data->NotifyReport.generatedAt);
|
|
|
+ if(ShmOCPP20Data->NotifyReport.seqNo < INT_MAX)
|
|
|
+ ShmOCPP20Data->NotifyReport.seqNo += 1;
|
|
|
+ else
|
|
|
+ ShmOCPP20Data->NotifyReport.seqNo = 0;
|
|
|
+
|
|
|
+ sendNotifyReportRequest();
|
|
|
+ memset(&ShmOCPP20Data->NotifyReport.reportData[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->NotifyReport.reportData)*sizeof(struct ReportDataType));
|
|
|
+ reportIdx = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else if(strcmp((char*)ShmOCPP20Data->GetBaseReport.reportBase, ReportBaseEnumTypeStr[ReportBaseEnumType_FullInventory]) == 0)
|
|
|
{
|
|
|
- /*
|
|
|
- * TODO:
|
|
|
- * 1. Fill out full inventory to response message
|
|
|
- */
|
|
|
+ for(uint8_t idx_var=0;idx_var<CtrlrVariable_CNT;idx_var++)
|
|
|
+ {
|
|
|
+ if(reportIdx < ARRAY_SIZE(ShmOCPP20Data->NotifyReport.reportData))
|
|
|
+ {
|
|
|
+ memcpy(&ShmOCPP20Data->NotifyReport.reportData[reportIdx], &ShmOCPP20Data->ControllerComponentVariable[idx_var], sizeof(struct ReportDataType));
|
|
|
+ reportIdx++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ getNowDatetime(ShmOCPP20Data->NotifyReport.generatedAt);
|
|
|
+ if(ShmOCPP20Data->NotifyReport.seqNo < INT_MAX)
|
|
|
+ ShmOCPP20Data->NotifyReport.seqNo += 1;
|
|
|
+ else
|
|
|
+ ShmOCPP20Data->NotifyReport.seqNo = 0;
|
|
|
+
|
|
|
+ sendNotifyReportRequest();
|
|
|
+ memset(&ShmOCPP20Data->NotifyReport.reportData[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->NotifyReport.reportData)*sizeof(struct ReportDataType));
|
|
|
+ reportIdx = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
/*
|
|
|
* TODO:
|
|
|
- * 1. Fill out summary inventory to response message
|
|
|
+ * 1. Fill out summary inventory to response message, currently not support
|
|
|
*/
|
|
|
}
|
|
|
|
|
|
- sendNotifyReportRequest();
|
|
|
+ if(reportIdx > 0)
|
|
|
+ {
|
|
|
+ getNowDatetime(ShmOCPP20Data->NotifyReport.generatedAt);
|
|
|
+ if(ShmOCPP20Data->NotifyReport.seqNo < INT_MAX)
|
|
|
+ ShmOCPP20Data->NotifyReport.seqNo += 1;
|
|
|
+ else
|
|
|
+ ShmOCPP20Data->NotifyReport.seqNo = 0;
|
|
|
+
|
|
|
+ sendNotifyReportRequest();
|
|
|
+ memset(&ShmOCPP20Data->NotifyReport.reportData[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->NotifyReport.reportData)*sizeof(struct ReportDataType));
|
|
|
+ reportIdx = 0;
|
|
|
+ }
|
|
|
+
|
|
|
ShmOCPP20Data->GetBaseReport.requestId = 0;
|
|
|
}
|
|
|
|
|
@@ -4966,24 +5021,18 @@ void CheckSystemValue(void)
|
|
|
(server_sign == TRUE) &&
|
|
|
ShmOCPP20Data->SpMsg.bits.NotifyEventReq)
|
|
|
{
|
|
|
- /*
|
|
|
- * TODO:
|
|
|
- * 1. Fill out NotifyEvent message data
|
|
|
- */
|
|
|
-
|
|
|
getNowDatetime(ShmOCPP20Data->NotifyEvent.generatedAt);
|
|
|
ShmOCPP20Data->NotifyEvent.tbc = FALSE;
|
|
|
- if(ShmOCPP20Data->NotifyEvent.seqNo < 2147483647)
|
|
|
+ if(ShmOCPP20Data->NotifyEvent.seqNo < INT_MAX)
|
|
|
ShmOCPP20Data->NotifyEvent.seqNo += 1;
|
|
|
else
|
|
|
ShmOCPP20Data->NotifyEvent.seqNo = 0;
|
|
|
|
|
|
-
|
|
|
sendNotifyEventRequest();
|
|
|
+ memset(&ShmOCPP20Data->NotifyEvent.eventData[0], 0x00, ARRAY_SIZE(ShmOCPP20Data->NotifyEvent.eventData)* sizeof(struct EventDataType ));
|
|
|
ShmOCPP20Data->SpMsg.bits.NotifyEventReq = OFF;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//===============================
|
|
|
// Each connector operation check
|
|
|
//===============================
|
|
@@ -7373,7 +7422,7 @@ int sendNotifyReportRequest()
|
|
|
random_uuid(guid);
|
|
|
sprintf(message,"[%d,\"%s\",\"%s\",%s]",MESSAGE_TYPE_CALL, guid, "NotifyReport", json_object_to_json_string_ext(NotifyReport, JSON_C_TO_STRING_PLAIN));
|
|
|
json_object_put(NotifyReport);
|
|
|
- LWS_Send(message);
|
|
|
+ LWS_SendNow(message);
|
|
|
|
|
|
sprintf(tempdata, "NotifyReport,0");
|
|
|
if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == PASS)
|
|
@@ -9209,11 +9258,11 @@ int sendGetVariablesConfirmation(char *uuid, unsigned char variableQuantity)
|
|
|
|
|
|
json_object_object_add(variableResult, "attributeType", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeType));
|
|
|
json_object_object_add(variableResult, "attributeStatus", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeStatus));
|
|
|
- json_object_object_add(variableResult, "attributeValue", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeStatus));
|
|
|
+ json_object_object_add(variableResult, "attributeValue", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeValue));
|
|
|
|
|
|
json_object_object_add(evse, "id", json_object_new_int(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.evse.id));
|
|
|
json_object_object_add(evse, "connectorId", json_object_new_int(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.evse.connectorId));
|
|
|
- json_object_object_add(component, "component", evse);
|
|
|
+ json_object_object_add(component, "evse", evse);
|
|
|
json_object_object_add(component, "name", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.name));
|
|
|
json_object_object_add(component, "instance", json_object_new_string((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].component.instance));
|
|
|
json_object_object_add(variableResult, "component", component);
|
|
@@ -11349,7 +11398,10 @@ int handleGetBaseReportRequest(char *uuid, char *payload)
|
|
|
sprintf((char*)ShmOCPP20Data->GetBaseReport.reportBase, "%s", json_object_get_string(json_object_object_get(GetBaseRepor, "reportBase")));
|
|
|
}
|
|
|
|
|
|
- strcpy((char*)ShmOCPP20Data->GetBaseReport.Response_status, GenericDeviceModelStatusEnumTypeStr[GenericDeviceModelStatusEnumType_Accepted]);
|
|
|
+ if(strcmp((char*)ShmOCPP20Data->GetBaseReport.reportBase, ReportBaseEnumTypeStr[ReportBaseEnumType_SummaryInventory]) == 0)
|
|
|
+ strcpy((char*)ShmOCPP20Data->GetBaseReport.Response_status, GenericDeviceModelStatusEnumTypeStr[GenericDeviceModelStatusEnumType_NotSupported]);
|
|
|
+ else
|
|
|
+ strcpy((char*)ShmOCPP20Data->GetBaseReport.Response_status, GenericDeviceModelStatusEnumTypeStr[GenericDeviceModelStatusEnumType_Accepted]);
|
|
|
}
|
|
|
else
|
|
|
strcpy((char*)ShmOCPP20Data->GetBaseReport.Response_status, GenericDeviceModelStatusEnumTypeStr[GenericDeviceModelStatusEnumType_NotSupported]);
|
|
@@ -12166,19 +12218,19 @@ int handleGetVariablesRequest(char *uuid, char *payload)
|
|
|
|
|
|
for(uint8_t idx_var=0;idx_var<CtrlrVariable_CNT;idx_var++)
|
|
|
{
|
|
|
- if((strstr((char*)ShmOCPP20Data->GetVariables.getVariableData[idx].component.name, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].component.name) != NULL) &&
|
|
|
- (strlen((char*)ShmOCPP20Data->GetVariables.getVariableData[idx].component.instance)>0?(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].component.instance, (char*)ShmOCPP20Data->GetVariables.getVariableData[idx].component.instance) != NULL):TRUE) &&
|
|
|
- (strstr((char*)ShmOCPP20Data->GetVariables.getVariableData[idx].variable.name, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.name) != NULL) &&
|
|
|
- (strlen((char*)ShmOCPP20Data->GetVariables.getVariableData[idx].variable.instance)>0?(strstr((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.instance, (char*)ShmOCPP20Data->GetVariables.getVariableData[idx].variable.instance) != NULL):TRUE))
|
|
|
+ if((strcmp((char*)ShmOCPP20Data->GetVariables.getVariableData[idx].component.name, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].component.name) == 0) &&
|
|
|
+ (strcmp((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].component.instance, (char*)ShmOCPP20Data->GetVariables.getVariableData[idx].component.instance) == 0) &&
|
|
|
+ (strcmp((char*)ShmOCPP20Data->GetVariables.getVariableData[idx].variable.name, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.name) == 0) &&
|
|
|
+ (strcmp((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variable.instance, (char*)ShmOCPP20Data->GetVariables.getVariableData[idx].variable.instance) == 0))
|
|
|
{
|
|
|
strcpy((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeStatus, GetVariableStatusEnumTypeStr[GetVariableStatusEnumType_Accepted]);
|
|
|
- strcpy((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeType, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].type);
|
|
|
strcpy((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeValue, (char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value);
|
|
|
+
|
|
|
+ break;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
strcpy((char*)ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeStatus, GetVariableStatusEnumTypeStr[GetVariableStatusEnumType_UnknownComponent]);
|
|
|
- memset(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeType, 0x00, ARRAY_SIZE(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeType));
|
|
|
memset(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeValue, 0x00, ARRAY_SIZE(ShmOCPP20Data->GetVariables.Response_getVariableResult[idx].attributeValue));
|
|
|
}
|
|
|
}
|