|
@@ -8122,7 +8122,7 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
retriesInt = 3; // If this field is not present, it is left to Charge Point to decide how many times it wants to retry.
|
|
|
|
|
|
if(json_object_object_get(GetDiagnostics, "retryInterval") != NULL)
|
|
|
- retriesInt = json_object_get_int(json_object_object_get(GetDiagnostics, "retryInterval"));
|
|
|
+ retryIntervalInt = json_object_get_int(json_object_object_get(GetDiagnostics, "retryInterval"));
|
|
|
else
|
|
|
retryIntervalInt = 30;
|
|
|
|
|
@@ -8279,7 +8279,8 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
DEBUG_INFO("sendDiagnosticsStatusNotificationRequest Uploaded\n");
|
|
|
sendDiagnosticsStatusNotificationRequest(DiagnosticsStatusStr[DiagnosticsStatus_Uploaded]);
|
|
|
}
|
|
|
- }while((isSuccess == 0)&&(retriesInt > 0 && retriesInt --));
|
|
|
+ retriesInt--;
|
|
|
+ }while((isSuccess == 0)&&(retriesInt >= 0));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -8328,7 +8329,8 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
DEBUG_INFO("sendDiagnosticsStatusNotificationRequest Uploaded\n");
|
|
|
sendDiagnosticsStatusNotificationRequest(DiagnosticsStatusStr[DiagnosticsStatus_Uploaded]);
|
|
|
}
|
|
|
- }while((!isSuccess)&&(retriesInt > 0 && retriesInt --));
|
|
|
+ retriesInt--;
|
|
|
+ }while((!isSuccess)&&(retriesInt >= 0));
|
|
|
}
|
|
|
|
|
|
end:
|
|
@@ -15030,8 +15032,8 @@ int httpUploadFile(char *location, char *path, char *filename,char *url)
|
|
|
{
|
|
|
char rmFileCmd[100]={0};
|
|
|
char FilePath[100]={0};
|
|
|
- char ftpbuf[200];
|
|
|
- int systemresult;
|
|
|
+ char buf[512];
|
|
|
+ int systemresult = 0;
|
|
|
|
|
|
//DEBUG_INFO("filename=%s\n",filename);
|
|
|
//DEBUG_INFO("url=%s\n",url);
|
|
@@ -15045,7 +15047,6 @@ int httpUploadFile(char *location, char *path, char *filename,char *url)
|
|
|
}
|
|
|
|
|
|
FILE *fp = fopen("/mnt/upload_file.txt", "w+");
|
|
|
-
|
|
|
if(fp == NULL)
|
|
|
{
|
|
|
DEBUG_INFO("log is NULL\n");
|
|
@@ -15058,14 +15059,28 @@ int httpUploadFile(char *location, char *path, char *filename,char *url)
|
|
|
fclose(fp);
|
|
|
}
|
|
|
|
|
|
- memset(ftpbuf, 0, ARRAY_SIZE(ftpbuf));
|
|
|
- sprintf(ftpbuf, "%s","/bin/php-cgi /var/www/ocpp_upload.php");
|
|
|
- systemresult = system(ftpbuf);
|
|
|
+ FILE *phpFP = popen("/bin/php-cgi /var/www/ocpp_upload.php", "r");
|
|
|
+ if(phpFP == NULL)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("PHP upload fail.\n");
|
|
|
+ return FALSE;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ while(fgets(buf, sizeof(buf), phpFP) != NULL)
|
|
|
+ {
|
|
|
+ if(strstr(buf, "result") != NULL)
|
|
|
+ {
|
|
|
+ sscanf(buf, "result: %d", &systemresult);
|
|
|
+ DEBUG_INFO("PHP HTTP upload result: %d\n", systemresult);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ pclose(phpFP);
|
|
|
+ }
|
|
|
|
|
|
- DEBUG_INFO("systemresult = %d\n",systemresult);
|
|
|
- if(systemresult != 0)
|
|
|
+ if(systemresult != 1)
|
|
|
{
|
|
|
- DEBUG_INFO("http upload error!\n");
|
|
|
+ DEBUG_INFO("HTTP upload error!\n");
|
|
|
return FALSE;
|
|
|
}
|
|
|
|