|
@@ -483,6 +483,26 @@ int meterValueBufferInsert(uint8_t gun_index, ReadingContext dataType, uint32_t
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+int meterValueBufferReplace(int bufferIdx, uint8_t gun_index, ReadingContext dataType, uint32_t transactionId, char *meterValue)
|
|
|
+{
|
|
|
+ int result = PASS;
|
|
|
+ char sqlCmd[8192];
|
|
|
+ char *errMsg = 0;
|
|
|
+
|
|
|
+ sprintf(sqlCmd, "replace into meterValuesBuffer(idx, occurDatetime, gun_index, transactionId, ReadingContext, meterValue) values('%d', CURRENT_TIMESTAMP, '%d', '%d','%d','%s')", bufferIdx
|
|
|
+ , gun_index
|
|
|
+ , transactionId
|
|
|
+ , (dataType==ReadingContext_Sample_Periodic?0:1)
|
|
|
+ , meterValue);
|
|
|
+ if (sqlite3_exec(db, sqlCmd, 0, 0, &errMsg) != SQLITE_OK)
|
|
|
+ {
|
|
|
+ result = FAIL;
|
|
|
+ DEBUG_WARN( "Insert meter value record error message: %s\n", errMsg);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
int meterValueBufferQuery(uint8_t gun_index, json_object *MeterValues)
|
|
|
{
|
|
|
int result = PASS;
|
|
@@ -8858,7 +8878,10 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
|
|
|
{
|
|
|
json_object_object_add(MeterValueBuffer, "timestamp", json_object_new_string((char*)ShmOCPP16Data->MeterValues[gun_index].MeterValue[idxMeter].TimeStamp));
|
|
|
json_object_object_add(MeterValueBuffer, "sampledValue", sampledValuesBuffer);
|
|
|
- if(meterValueBufferDataQuantity(gun_index, dataType) < 200) meterValueBufferInsert(gun_index, dataType, ShmOCPP16Data->MeterValues[gun_index].TransactionId, (char*)json_object_to_json_string_ext(MeterValueBuffer, JSON_C_TO_STRING_PLAIN));
|
|
|
+ if(meterValueBufferDataQuantity(gun_index, dataType) < 200)
|
|
|
+ meterValueBufferInsert(gun_index, dataType, ShmOCPP16Data->MeterValues[gun_index].TransactionId, (char*)json_object_to_json_string_ext(MeterValueBuffer, JSON_C_TO_STRING_PLAIN));
|
|
|
+ else
|
|
|
+ meterValueBufferReplace(200, gun_index, dataType, ShmOCPP16Data->MeterValues[gun_index].TransactionId, (char*)json_object_to_json_string_ext(MeterValueBuffer, JSON_C_TO_STRING_PLAIN));
|
|
|
json_object_put(MeterValueBuffer);
|
|
|
}
|
|
|
else
|
|
@@ -17539,7 +17562,7 @@ int initialConfigurationTable(void)
|
|
|
FILE *fp;
|
|
|
FILE *outfile;
|
|
|
char str[512]={0};
|
|
|
- int confVersion = 25;
|
|
|
+ int confVersion = 26;
|
|
|
|
|
|
DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
|
|
|
//start_t = clock();
|
|
@@ -18046,6 +18069,13 @@ int initialConfigurationTable(void)
|
|
|
|
|
|
fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizeTimeout", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData);
|
|
|
|
|
|
+ // Enable AC charger CCS function
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemName, "EnableAcCcs");
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData, "FALSE");
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","EnableAcCcs", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData);
|
|
|
+
|
|
|
//* Local Auth List Management Profile*/
|
|
|
#if 0
|
|
|
//For OCTT Test Case
|
|
@@ -18540,6 +18570,12 @@ int initialConfigurationTable(void)
|
|
|
sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData, "%s", valuestr);
|
|
|
}
|
|
|
|
|
|
+ if(strcmp(keystr, "EnableAcCcs") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData, "%s", valuestr);
|
|
|
+ }
|
|
|
+
|
|
|
if(strcmp(keystr, "LocalAuthListEnabled") == 0)
|
|
|
{
|
|
|
ShmOCPP16Data->ConfigurationTable.LocalAuthListManagementProfile[LocalAuthListEnabled].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
@@ -19210,6 +19246,16 @@ void StoreConfigurationTable(void)
|
|
|
|
|
|
fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizeTimeout", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData);
|
|
|
|
|
|
+ // EnableAcCcs
|
|
|
+ /*
|
|
|
+ ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemName, "EnableAcCcs");
|
|
|
+ strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData, "TRUE" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","EnableAcCcs", "false", (char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData);
|
|
|
+
|
|
|
+
|
|
|
//* Local Auth List Management Profile*/
|
|
|
//LocalAuthListEnabled
|
|
|
/*
|
|
@@ -20442,6 +20488,24 @@ void getKeyValue(char *keyReq)
|
|
|
isKnowKey = TRUE;
|
|
|
}
|
|
|
|
|
|
+ if(isEmpty || strcmp(keyReq, "EnableAcCcs") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.Key[GetConfiguration_EnableAcCcs].Item, "EnableAcCcs");
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EnableAcCcs].Key, "EnableAcCcs");
|
|
|
+
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EnableAcCcs].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EnableAcCcs].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetConfiguration.ResponseConfigurationKey[GetConfiguration_EnableAcCcs].Value, (const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData );
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
#if 1
|
|
|
if(isEmpty || strcmp(keyReq, "LocalAuthListEnabled") == 0 )
|
|
|
{
|
|
@@ -21871,7 +21935,7 @@ int setKeyValue(char *key, char *value)
|
|
|
if(ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthDownloadlinkCertificate].ItemAccessibility == 1)
|
|
|
{
|
|
|
strcpy(str, (const char*)value);
|
|
|
- sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthDownloadlinkCertificate].ItemData, "%s", str );
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[AuthDownloadlinkCertificate].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
|
|
|
isSuccess = ConfigurationStatus_Accepted;
|
|
|
}
|
|
|
else
|
|
@@ -21929,6 +21993,20 @@ int setKeyValue(char *key, char *value)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(strcmp(key, "EnableAcCcs") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ sprintf((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[EnableAcCcs].ItemData, "%s", (strcmp(str, "true")==0) ?"TRUE":"FALSE" );
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
#if 0
|
|
|
//For OCPP Test Case
|
|
|
if(strcmp(key, "LocalAuthorizationListEnabled") == 0)
|