|
@@ -9720,7 +9720,8 @@ int handleChangeConfigurationRequest(char *uuid, char *payload)
|
|
|
SetOcppConnStatus(FALSE);
|
|
|
}
|
|
|
|
|
|
- if(((strcmp(keystr,"FreeVend")==0) || (strcmp(keystr,"isEnableLocalPowerSharing")==0) || (strcmp(keystr,"PowerSharingServerIP")==0)) && (strcmp(comfirmstr,"Accepted")==0))
|
|
|
+ if(((strcmp(keystr,"FreeVend")==0) || (strcmp(keystr,"isEnableLocalPowerSharing")==0) || (strcmp(keystr,"PowerSharingServerIP")==0) || (strcmp(keystr,"RfidEndianType")==0) ||
|
|
|
+ (strcmp(keystr,"Enable15118")==0) || (strcmp(keystr,"WifiSsid")==0) || (strcmp(keystr,"WifiPassword")==0) || (strcmp(keystr,"StopChargingByButton")==0)) && (strcmp(comfirmstr,"Accepted")==0))
|
|
|
{
|
|
|
StoreUsrConfigData(&ShmSysConfigAndInfo->SysConfig);
|
|
|
}
|
|
@@ -11640,7 +11641,7 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
protocol, user, password, host, &port, path);
|
|
|
}
|
|
|
|
|
|
- if((strcmp(protocol,"ftp")!=0)&&(strcmp(protocol,"http")!=0)&&(strcmp(protocol,"https")!=0))
|
|
|
+ if((strcmp(protocol,"ftp")!=0)&&(strcmp(protocol,"sftp")!=0)&&(strcmp(protocol,"http")!=0)&&(strcmp(protocol,"https")!=0))
|
|
|
{
|
|
|
DEBUG_INFO("protocol is not ftp/http ! \n");
|
|
|
sprintf((char*)ShmOCPP16DataPH->DiagnosticsStatusNotification.Status, "%s", DiagnosticsStatusStr[DiagnosticsStatus_UploadFailed]);
|
|
@@ -11713,7 +11714,11 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
ShmOCPP16DataPH->SpMsg.bits.DiagnosticsStatusNotificationReq = 1;
|
|
|
sleep(3);
|
|
|
|
|
|
- isSuccess = ftpUploadFile(host1, user, password, port, ftppath, fnamePlusPath, fnamePWithNoPath);
|
|
|
+ if(strncmp(locationstr,"sftp", 4) == 0)
|
|
|
+ isSuccess = sftpUploadFile(host1, user, password, port, ftppath, fnamePlusPath, fnamePWithNoPath);
|
|
|
+ else
|
|
|
+ isSuccess = ftpUploadFile(host1, user, password, port, ftppath, fnamePlusPath, fnamePWithNoPath);
|
|
|
+
|
|
|
if(!isSuccess)
|
|
|
{
|
|
|
DEBUG_INFO("Diagnostics fail.\n");
|
|
@@ -14394,7 +14399,7 @@ void *UpdateFirmwareProcess(void *data)
|
|
|
pthread_detach(pthread_self());
|
|
|
mtrace();
|
|
|
int retriesInt =0, retryIntervalInt=0;
|
|
|
- char protocol[10], user[64],password[64],host[256], path[1024], ftppath[1024],host1[256],path1[1024];
|
|
|
+ char protocol[10], user[64],password[64],host[1280], path[1024], ftppath[1024],host1[256],path1[1024];
|
|
|
int port=0;
|
|
|
char locationstr[2048]={0}, retrieveDatestr[36]={0};
|
|
|
int isSuccess = 0;
|
|
@@ -14532,8 +14537,29 @@ void *UpdateFirmwareProcess(void *data)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- sscanf(temp,"%[^:]:%*2[/]%[^@]@%[^:]:%i/%199[^\n]",
|
|
|
- protocol, user, host, &port, path);
|
|
|
+ char loginInfo[128];
|
|
|
+ sscanf(temp,"%[^:]:%*2[/]%[^@]@", protocol, loginInfo);
|
|
|
+ // Check if it contains 'password'
|
|
|
+ if(strstr(loginInfo, ":") != NULL)
|
|
|
+ {
|
|
|
+ sscanf(loginInfo,"%[^:]:%s", user, password);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy(user,loginInfo);
|
|
|
+ strcpy(password,"");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strstr(pch,":") != NULL)
|
|
|
+ {
|
|
|
+ sscanf(pch,"@%[^:]:%i/%512[^\n]", host, &port, path);
|
|
|
+ sprintf(host,"%s/%s", host,path);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sscanf(pch,"@%s[^\n]", host);
|
|
|
+ }
|
|
|
+ //sscanf(temp,"%[^:]:%*2[/]%[^@]@%[^:]:%i/%199[^\n]", protocol, user, host, &port, path);
|
|
|
}
|
|
|
|
|
|
sscanf(host,"%[^/]%s",host1, path1);
|
|
@@ -14541,7 +14567,7 @@ void *UpdateFirmwareProcess(void *data)
|
|
|
|
|
|
if(port == 0)
|
|
|
{
|
|
|
- port = 21;
|
|
|
+ port = 22;
|
|
|
}
|
|
|
|
|
|
do
|
|
@@ -14551,7 +14577,7 @@ void *UpdateFirmwareProcess(void *data)
|
|
|
ShmOCPP16DataPH->SpMsg.bits.FirmwareStatusNotificationReq = 1;
|
|
|
sleep(1);
|
|
|
|
|
|
- isSuccess = sftpDownLoadFile(host1, user, port, ftppath, filenametemp, locationstr);
|
|
|
+ isSuccess = sftpDownLoadFile(host1, user, password, port, path1, filenametemp, locationstr);
|
|
|
if(!isSuccess)
|
|
|
{
|
|
|
//BulldogUtil.sleepMs(interval*1000);
|
|
@@ -15395,7 +15421,7 @@ int initialConfigurationTable(void)
|
|
|
FILE *fp;
|
|
|
FILE *outfile;
|
|
|
char str[512]={0};
|
|
|
- int confVersion = 19;
|
|
|
+ int confVersion = 20;
|
|
|
|
|
|
DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
|
|
|
//start_t = clock();
|
|
@@ -15846,6 +15872,48 @@ int initialConfigurationTable(void)
|
|
|
|
|
|
fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthDownloadlinkCertificate", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthDownloadlinkCertificate].ItemData);
|
|
|
|
|
|
+ // RFID endian type
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemName, "RfidEndianType");
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemData, ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian==1?"BIG":"LITTLE");
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","RfidEndianType", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemData);
|
|
|
+
|
|
|
+ // Authorization timeout
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemName, "AuthorizeTimeout");
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData, "15");
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizeTimeout", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData);
|
|
|
+
|
|
|
+ // Enable AC charger CCS function
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemName, "Enable15118");
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemData, ShmSysConfigAndInfo->SysConfig.isEnable15118==1?"TRUE":"FALSE");
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","Enable15118", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemData);
|
|
|
+
|
|
|
+ // Wifi SSID
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemName, "WifiSsid");
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemData, (char *)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","WifiSsid", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemData);
|
|
|
+
|
|
|
+ // Wifi password
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemName, "WifiPassword");
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemData, (char *)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","WifiPassword", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemData);
|
|
|
+
|
|
|
+ // Stop Charging By Button
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemName, "StopChargingByButton");
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemData, ShmSysConfigAndInfo->SysConfig.StopChargingByButton==1?"TRUE":"FALSE");
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StopChargingByButton", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemData);
|
|
|
+
|
|
|
//* Local Auth List Management Profile*/
|
|
|
#if 0
|
|
|
//For OCTT Test Case
|
|
@@ -16299,6 +16367,42 @@ int initialConfigurationTable(void)
|
|
|
sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthDownloadlinkCertificate].ItemData, "%s", valuestr);
|
|
|
}
|
|
|
|
|
|
+ if(strcmp(keystr, "RfidEndianType") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemData, ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian==1?"BIG":"LITTLE");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(keystr, "AuthorizeTimeout") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData, "%s", valuestr);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(keystr, "Enable15118") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemData, ShmSysConfigAndInfo->SysConfig.isEnable15118==1?"TRUE":"FALSE");
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(keystr, "WifiSsid") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemData, (char *)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(keystr, "WifiPassword") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemData, (char *)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(keystr, "StopChargingByButton") == 0)
|
|
|
+ {
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemData, ShmSysConfigAndInfo->SysConfig.StopChargingByButton==1?"TRUE":"FALSE");
|
|
|
+ }
|
|
|
+
|
|
|
if(strcmp(keystr, "LocalAuthListEnabled") == 0)
|
|
|
{
|
|
|
ShmOCPP16DataPH->ConfigurationTable.LocalAuthListManagementProfile[LocalAuthListEnabled].ItemAccessibility = (strcmp(readonlystr, "true")==0) ? 0 : 1;
|
|
@@ -16905,6 +17009,61 @@ void StoreConfigurationTable(void)
|
|
|
|
|
|
fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthDownloadlinkCertificate", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthDownloadlinkCertificate].ItemData);
|
|
|
|
|
|
+ // RfidEndianType
|
|
|
+ /*
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemName, "RfidEndianType");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemData, "BIG" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","RfidEndianType", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemData);
|
|
|
+
|
|
|
+ // AuthorizeTimeout
|
|
|
+ /*
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemName, "AuthorizeTimeout");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData, "60" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","AuthorizeTimeout", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData);
|
|
|
+
|
|
|
+ // Enable15118
|
|
|
+ /*
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemName, "Enable15118");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemData, "TRUE" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","Enable15118", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemData);
|
|
|
+
|
|
|
+ // WifiSsid
|
|
|
+ /*
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemName, "WifiSsid");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemData, "TRUE" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","WifiSsid", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemData);
|
|
|
+
|
|
|
+ // WifiPassword
|
|
|
+ /*
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemName, "WifiPassword");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemData, "TRUE" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","WifiPassword", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemData);
|
|
|
+
|
|
|
+ // StopChargingByButton
|
|
|
+ /*
|
|
|
+ ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemAccessibility = 1;
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemName, "StopChargingByButton");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemData, "TRUE" );
|
|
|
+ */
|
|
|
+
|
|
|
+ fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StopChargingByButton", "false", (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemData);
|
|
|
+
|
|
|
+
|
|
|
//* Local Auth List Management Profile*/
|
|
|
//LocalAuthListEnabled
|
|
|
/*
|
|
@@ -18010,6 +18169,114 @@ void getKeyValue(char *keyReq)
|
|
|
strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthDownloadlinkCertificate].Value, (const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthDownloadlinkCertificate].ItemData );
|
|
|
isKnowKey = TRUE;
|
|
|
}
|
|
|
+
|
|
|
+ if(isEmpty || strcmp(keyReq, "RfidEndianType") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_RfidEndianType].Item, "RfidEndianType");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_RfidEndianType].Key, "RfidEndianType");
|
|
|
+
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_RfidEndianType].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_RfidEndianType].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_RfidEndianType].Value, ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian==1?"BIG":"LITTLE");
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isEmpty || strcmp(keyReq, "AuthorizeTimeout") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_AuthorizeTimeout].Item, "AuthorizeTimeout");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthorizeTimeout].Key, "AuthorizeTimeout");
|
|
|
+
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthorizeTimeout].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthorizeTimeout].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_AuthorizeTimeout].Value, (const char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData);
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isEmpty || strcmp(keyReq, "Enable15118") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_Enable15118].Item, "Enable15118");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_Enable15118].Key, "Enable15118");
|
|
|
+
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_Enable15118].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_Enable15118].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_Enable15118].Value, ShmSysConfigAndInfo->SysConfig.isEnable15118==1?"TRUE":"FALSE");
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isEmpty || strcmp(keyReq, "WifiSsid") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_WifiSsid].Item, "WifiSsid");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_WifiSsid].Key, "WifiSsid");
|
|
|
+
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_WifiSsid].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_WifiSsid].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_WifiSsid].Value, (char *)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid);
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isEmpty || strcmp(keyReq, "WifiPassword") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_WifiPassword].Item, "WifiPassword");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_WifiPassword].Key, "WifiPassword");
|
|
|
+
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_WifiPassword].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_WifiPassword].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_WifiPassword].Value, (char *)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword);
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(isEmpty || strcmp(keyReq, "StopChargingByButton") == 0 )
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.Key[GetConfiguration_StopChargingByButton].Item, "StopChargingByButton");
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_StopChargingByButton].Key, "StopChargingByButton");
|
|
|
+
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_StopChargingByButton].ReadOnly, "0"/*"FALSE"*/);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_StopChargingByButton].ReadOnly, "1"/*"TRUE"*/);
|
|
|
+ }
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16DataPH->GetConfiguration.ResponseConfigurationKey[GetConfiguration_StopChargingByButton].Value, ShmSysConfigAndInfo->SysConfig.StopChargingByButton==1?"TRUE":"FALSE");
|
|
|
+ isKnowKey = TRUE;
|
|
|
+ }
|
|
|
#if 1
|
|
|
if(isEmpty || strcmp(keyReq, "LocalAuthListEnabled") == 0 )
|
|
|
{
|
|
@@ -18328,9 +18595,14 @@ int setKeyValue(char *key, char *value)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- //Charger.ConnectionTimeOut = Integer.parseInt(value)*1000;
|
|
|
- sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData, "%d", atoi(value));
|
|
|
- isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ if((atoi(value) >= 30) && (atoi(value) <= 3600))
|
|
|
+ {
|
|
|
+ //Charger.ConnectionTimeOut = Integer.parseInt(value)*1000;
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[ConnectionTimeOut].ItemData, "%d", atoi(value));
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -19370,6 +19642,139 @@ int setKeyValue(char *key, char *value)
|
|
|
isSuccess = ConfigurationStatus_Rejected;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if(strcmp(key, "RfidEndianType") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ for(int i = 0; str[i]; i++)
|
|
|
+ {
|
|
|
+ str[i] = tolower(str[i]);
|
|
|
+ }
|
|
|
+ if((strcmp(str, "big")==0) || (strcmp(str, "little")==0))
|
|
|
+ {
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[RfidEndianType].ItemData, "%s", str);
|
|
|
+ ShmSysConfigAndInfo->SysConfig.RfidCardNumEndian = (strcmp(str, "big")==0)?1:0;
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(key, "AuthorizeTimeout") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ check_ascii = value[0];
|
|
|
+ if((check_ascii < 48) || (check_ascii > 57))
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if((atoi(value) >= 10) && (atoi(value) <= 300))
|
|
|
+ {
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizeTimeout].ItemData, "%d", atoi(value));
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(key, "Enable15118") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ for(int i = 0; str[i]; i++)
|
|
|
+ {
|
|
|
+ str[i] = tolower(str[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if((strcmp(str, "true")==0) || (strcmp(str, "false")==0))
|
|
|
+ {
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[Enable15118].ItemData, "%s", (strcmp(str, "true")==0)?"TRUE":"FALSE");
|
|
|
+ ShmSysConfigAndInfo->SysConfig.isEnable15118 = (strcmp(str, "true")==0)?1:0;
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(key, "WifiSsid") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemData, str);
|
|
|
+ sprintf((char *)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiSsid, (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiSsid].ItemData);
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(key, "WifiPassword") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemData, str);
|
|
|
+ sprintf((char *)ShmSysConfigAndInfo->SysConfig.AthInterface.WifiPassword, (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[WifiPassword].ItemData);
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(strcmp(key, "StopChargingByButton") == 0)
|
|
|
+ {
|
|
|
+ if(ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemAccessibility == 1)
|
|
|
+ {
|
|
|
+ strcpy(str, (const char*)value);
|
|
|
+ for(int i = 0; str[i]; i++)
|
|
|
+ {
|
|
|
+ str[i] = tolower(str[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ if((strcmp(str, "true")==0) || (strcmp(str, "false")==0))
|
|
|
+ {
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[StopChargingByButton].ItemData, "%s", (strcmp(str, "true")==0)?"TRUE":"FALSE");
|
|
|
+ ShmSysConfigAndInfo->SysConfig.StopChargingByButton = (strcmp(str, "true")==0)?1:0;
|
|
|
+ isSuccess = ConfigurationStatus_Accepted;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isSuccess = ConfigurationStatus_Rejected;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
#if 0
|
|
|
//For OCPP Test Case
|
|
|
if(strcmp(key, "LocalAuthorizationListEnabled") == 0)
|
|
@@ -19695,7 +20100,7 @@ int httpDownLoadFile(char *location, char *path, char *filename,char *url)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-int sftpDownLoadFile(char *location, char *user, int port, char *path, char *filename,char *url)
|
|
|
+int sftpDownLoadFile(char *host, char *user, char *password, int port, char *path, char *filename,char *url)
|
|
|
{
|
|
|
int result = TRUE;
|
|
|
char rmFileCmd[300]={0};
|
|
@@ -19714,13 +20119,16 @@ int sftpDownLoadFile(char *location, char *user, int port, char *path, char *fil
|
|
|
}
|
|
|
|
|
|
memset(ftpbuf, 0, ARRAY_SIZE(ftpbuf));
|
|
|
- sprintf(ftpbuf,"timeout -t 360 scp -i /root/.ssh/id_rsa_bear -P %d %s@%s%s /mnt/%s", port, user, path, filename, filename);
|
|
|
+ if(strlen(password)>0)
|
|
|
+ sprintf(ftpbuf,"timeout -t 360 sshpass -p '%s' scp -P %d %s@%s:%s%s %s", password, port, user, host, path, filename, FilePath);
|
|
|
+ else
|
|
|
+ sprintf(ftpbuf,"timeout -t 360 sshpass scp -P %d %s@%s:%s%s %s", port, user, host, path, filename, FilePath);
|
|
|
DEBUG_INFO("Download command: %s\n",ftpbuf);
|
|
|
|
|
|
systemresult = system(ftpbuf);
|
|
|
if(systemresult != 0)
|
|
|
{
|
|
|
- DEBUG_WARN("scp error!\n");
|
|
|
+ DEBUG_WARN("sshpass scp error!\n");
|
|
|
result = FALSE;
|
|
|
}
|
|
|
system("pkill ping");
|
|
@@ -19889,6 +20297,32 @@ int ftpUploadFile(char *location, char *user, char *password, int port, char *pa
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+int sftpUploadFile(char *location, char *user, char *password, int port, char *path, char *fnamePlusPath,char *filename)
|
|
|
+{
|
|
|
+ int result = FALSE;
|
|
|
+ char ftpbuf[200];
|
|
|
+ int systemresult;
|
|
|
+
|
|
|
+ memset(ftpbuf, 0, ARRAY_SIZE(ftpbuf));
|
|
|
+
|
|
|
+ sprintf(ftpbuf, "sshpass -p %s scp %s -P %d %s@%s:%s%s", password, fnamePlusPath, port, user, location, path, filename);
|
|
|
+
|
|
|
+ DEBUG_INFO("sftp command: %s\n",ftpbuf);
|
|
|
+ systemresult = system(ftpbuf);
|
|
|
+
|
|
|
+ if(systemresult != 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("sshpass error!\n");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result = TRUE;
|
|
|
+ DEBUG_INFO("sshpass OK!\n");
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
int GetOcppServerURL()
|
|
|
{
|
|
|
int result = FALSE;
|