|
@@ -1030,6 +1030,7 @@ int DB_Initial()
|
|
|
"variableAttributesType text, "
|
|
|
"variableAttributesTypeMutability text, "
|
|
|
"variableAttributesTypeValue text, "
|
|
|
+ "variableCharacteristicsMinLimit real,"
|
|
|
"unique(componentName, componentInstance,variableName, variableInstance) on conflict replace);";
|
|
|
|
|
|
char *sqlBootType = "create table if not exists ocpp20_boot_type (idx integer primary key,"
|
|
@@ -1409,7 +1410,7 @@ int DB_variableSaveToDb(struct ReportDataType *variable)
|
|
|
char sql[4096];
|
|
|
char* errMsg = NULL;
|
|
|
|
|
|
- sprintf(sql,"insert or replace into ocpp20_variable (componentName, componentInstance, variableName, variableInstance, variableCharacteristicsDataType, variableCharacteristicsUnit, variableCharacteristicsMaxLimit, variableAttributesType, variableAttributesTypeMutability, variableAttributesTypeValue) VALUES('%s', '%s', '%s', '%s', '%s', '%s', %f, '%s', '%s', '%s'); SELECT * from ocpp20_variable;",
|
|
|
+ sprintf(sql,"insert or replace into ocpp20_variable (componentName, componentInstance, variableName, variableInstance, variableCharacteristicsDataType, variableCharacteristicsUnit, variableCharacteristicsMaxLimit, variableAttributesType, variableAttributesTypeMutability, variableAttributesTypeValue, variableCharacteristicsMinLimit) VALUES('%s', '%s', '%s', '%s', '%s', '%s', %f, '%s', '%s', '%s', '%f'); SELECT * from ocpp20_variable;",
|
|
|
variable->component.name,
|
|
|
variable->component.instance,
|
|
|
variable->variable.name,
|
|
@@ -1419,7 +1420,8 @@ int DB_variableSaveToDb(struct ReportDataType *variable)
|
|
|
variable->variableCharacteristics.maxLimit,
|
|
|
variable->variableAttribute[0].type,
|
|
|
variable->variableAttribute[0].mutability,
|
|
|
- variable->variableAttribute[0].value);
|
|
|
+ variable->variableAttribute[0].value,
|
|
|
+ variable->variableCharacteristics.minLimit);
|
|
|
|
|
|
//* Execute SQL statement */
|
|
|
if(sqlite3_exec(db, sql, DB_cbVariableSaveToDb, 0, &errMsg) != SQLITE_OK)
|
|
@@ -3035,6 +3037,7 @@ int DB_cbVariableLoadFromDb(void *para, int columnCount, char **columnValue, cha
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variableAttribute[0].type, "%s", columnValue[8]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variableAttribute[0].mutability, "%s", columnValue[9]);
|
|
|
sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[idx].variableAttribute[0].value, "%s", columnValue[10]);
|
|
|
+ ShmOCPP20Data->ControllerComponentVariable[idx].variableCharacteristics.minLimit = strlen(columnValue[11])>=0?atoi(columnValue[11]):0;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -11631,7 +11634,7 @@ int sendSetVariableConfirmation(char *uuid, unsigned char variableQuantity)
|
|
|
|
|
|
json_object_object_add(evse, "id", json_object_new_int(ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.evse.id));
|
|
|
json_object_object_add(evse, "connectorId", json_object_new_int(ShmOCPP20Data->SetVariables.Response_setVariableResult[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->SetVariables.Response_setVariableResult[idx].component.name));
|
|
|
json_object_object_add(component, "instance", json_object_new_string((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].component.instance));
|
|
|
json_object_object_add(variableResult, "component", component);
|
|
@@ -14567,12 +14570,12 @@ int handleGetReportRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
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)
|
|
|
{
|
|
|
- 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"), "instance"), "id"));
|
|
|
+ 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"));
|
|
|
}
|
|
|
|
|
|
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"), "connectorId") != NULL)
|
|
|
{
|
|
|
- ShmOCPP20Data->GetReport.componentVariable[idx].component.evse.connectorId = 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"), "instance"), "connectorId"));
|
|
|
+ ShmOCPP20Data->GetReport.componentVariable[idx].component.evse.connectorId = 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"), "connectorId"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -16990,12 +16993,13 @@ int handleSetVariablesRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if(json_object_object_get(json_object_object_get(json_object_object_get(json_object_array_get_idx(json_object_object_get(SetVariables, "setVariableData"), idx), "component"), "evse"), "id") != NULL)
|
|
|
{
|
|
|
- ShmOCPP20Data->SetVariables.setVariableData[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(SetVariables, "setVariableData"), idx), "component"), "instance"), "id"));
|
|
|
+ ShmOCPP20Data->SetVariables.setVariableData[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(SetVariables, "setVariableData"), idx), "component"), "evse"), "id"));
|
|
|
}
|
|
|
|
|
|
if(json_object_object_get(json_object_object_get(json_object_object_get(json_object_array_get_idx(json_object_object_get(SetVariables, "setVariableData"), idx), "component"), "evse"), "connectorId") != NULL)
|
|
|
{
|
|
|
- ShmOCPP20Data->SetVariables.setVariableData[idx].component.evse.connectorId = 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(SetVariables, "setVariableData"), idx), "component"), "instance"), "connectorId"));
|
|
|
+ ShmOCPP20Data->SetVariables.setVariableData[idx].component.evse.connectorId = 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(SetVariables, "setVariableData"), idx), "component"), "evse"), "connectorId"));
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -17077,7 +17081,7 @@ int handleSetVariablesRequest(char *uuid, char *payload)
|
|
|
|
|
|
if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "SampledDataCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "TxUpdatedInterval") != NULL))
|
|
|
{
|
|
|
- if((0 < atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)) && (atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value) < (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) )
|
|
|
+ if((0 < atoi((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue)) && (atoi((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].attributeValue) < (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) )
|
|
|
{
|
|
|
strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_OutOfRange]);
|
|
|
}
|