|
@@ -44,7 +44,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
#define PASS 1
|
|
#define PASS 1
|
|
#define FAIL -1
|
|
#define FAIL -1
|
|
|
|
|
|
@@ -1171,8 +1170,11 @@ void CheckSystemValue(void)
|
|
//===============================
|
|
//===============================
|
|
// send Heartbeat
|
|
// send Heartbeat
|
|
//===============================
|
|
//===============================
|
|
|
|
+ //printf("server_sign=%d\n",server_sign);
|
|
|
|
+ //printf("HeartBeatWaitTime=%d\n",HeartBeatWaitTime);
|
|
if((server_sign == TRUE) && (difftime(time((time_t*)NULL), clientTime.Heartbeat) >= HeartBeatWaitTime)/*((time((time_t*)NULL)-clientTime.Heartbeat)>= ShmOCPP16Data->BootNotification.ResponseHeartbeatInterval)*/)
|
|
if((server_sign == TRUE) && (difftime(time((time_t*)NULL), clientTime.Heartbeat) >= HeartBeatWaitTime)/*((time((time_t*)NULL)-clientTime.Heartbeat)>= ShmOCPP16Data->BootNotification.ResponseHeartbeatInterval)*/)
|
|
{
|
|
{
|
|
|
|
+ printf("Heartbeat !!!\n");
|
|
//parameter for test
|
|
//parameter for test
|
|
sendHeartbeatRequest(0);
|
|
sendHeartbeatRequest(0);
|
|
//==============================================
|
|
//==============================================
|
|
@@ -1994,14 +1996,6 @@ int sendStartTransactionRequest(int gun_index)
|
|
sprintf(usec_buf,"%dZ",(int)tmnow.tv_usec);
|
|
sprintf(usec_buf,"%dZ",(int)tmnow.tv_usec);
|
|
strcat(buf,usec_buf);
|
|
strcat(buf,usec_buf);
|
|
#endif
|
|
#endif
|
|
- //printf("Start Charging Time :%s",buf);
|
|
|
|
-
|
|
|
|
- // set value
|
|
|
|
- //if(ShmOCPP16Data->OcppConnStatus == 1 )
|
|
|
|
- //{
|
|
|
|
- //memset(&ShmOCPP16Data->StartTransaction[gun_index], 0, sizeof(ShmOCPP16Data->StartTransaction[gun_index])); // Clear StartTransaction Value
|
|
|
|
-
|
|
|
|
- //}
|
|
|
|
|
|
|
|
ShmOCPP16Data->StartTransaction[gun_index].ConnectorId = gun_index +1 ; // gun start from 1~
|
|
ShmOCPP16Data->StartTransaction[gun_index].ConnectorId = gun_index +1 ; // gun start from 1~
|
|
strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].Timestamp, buf);
|
|
strcpy((char *)ShmOCPP16Data->StartTransaction[gun_index].Timestamp, buf);
|
|
@@ -6304,8 +6298,8 @@ int handleGetDiagnosticsRequest(char *uuid, char *payload)
|
|
mtrace();
|
|
mtrace();
|
|
int result = FAIL;
|
|
int result = FAIL;
|
|
//void *ret; //
|
|
//void *ret; //
|
|
- char fnamePlusPath[50]="";
|
|
|
|
- char fname[16]="";
|
|
|
|
|
|
+ char fnamePlusPath[100]="";
|
|
|
|
+ char fname[40]="";
|
|
pthread_t t; // pthread 變數
|
|
pthread_t t; // pthread 變數
|
|
time_t rawtime;
|
|
time_t rawtime;
|
|
struct tm * timeinfo;
|
|
struct tm * timeinfo;
|
|
@@ -6322,7 +6316,7 @@ int handleGetDiagnosticsRequest(char *uuid, char *payload)
|
|
if((access(fnamePlusPath,F_OK))!=-1)
|
|
if((access(fnamePlusPath,F_OK))!=-1)
|
|
{
|
|
{
|
|
DEBUG_INFO("fnamePlusPath exist.\n");
|
|
DEBUG_INFO("fnamePlusPath exist.\n");
|
|
- strftime (fname,sizeof(fname),"%4Y-%2m.zip",timeinfo);
|
|
|
|
|
|
+ strftime (fname,sizeof(fname),"%4Y-%2m-%d-%H-%M-%S.zip",timeinfo);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
@@ -6349,8 +6343,8 @@ void* GetDiagnosticsProcess(void* data)
|
|
int retriesIsNULL,retryIntervalIsNULL, startTimeIsNULL, stopTimeIsNULL;
|
|
int retriesIsNULL,retryIntervalIsNULL, startTimeIsNULL, stopTimeIsNULL;
|
|
char protocol[10]={0}, user[50]={0},password[50]={0},host[50]={0}, path[50]={0}, ftppath[60]={0},host1[50]={0},path1[50]={0};
|
|
char protocol[10]={0}, user[50]={0},password[50]={0},host[50]={0}, path[50]={0}, ftppath[60]={0},host1[50]={0},path1[50]={0};
|
|
int port=0;
|
|
int port=0;
|
|
- char fnamePlusPath[50]="";//="00000_2019-06-09_160902_CSULog.zip";
|
|
|
|
- char fname[16]="";
|
|
|
|
|
|
+ char fnamePlusPath[100]="";//="00000_2019-06-09_160902_CSULog.zip";
|
|
|
|
+ char fname[40]="";
|
|
char sstr[260]={ 0 };//sstr[200]={ 0 };
|
|
char sstr[260]={ 0 };//sstr[200]={ 0 };
|
|
int c = 0;
|
|
int c = 0;
|
|
char *loc;
|
|
char *loc;
|
|
@@ -6366,7 +6360,7 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
|
|
|
retriesIsNULL = retryIntervalIsNULL = startTimeIsNULL = stopTimeIsNULL = FALSE;
|
|
retriesIsNULL = retryIntervalIsNULL = startTimeIsNULL = stopTimeIsNULL = FALSE;
|
|
|
|
|
|
- DEBUG_INFO("sendDiagnosticsStatusNotificationRequest 1\n");
|
|
|
|
|
|
+ DEBUG_INFO("GetDiagnosticsProcess\n");
|
|
sendDiagnosticsStatusNotificationRequest(DiagnosticsStatusStr[DiagnosticsStatus_Uploading]);
|
|
sendDiagnosticsStatusNotificationRequest(DiagnosticsStatusStr[DiagnosticsStatus_Uploading]);
|
|
|
|
|
|
//****************location*******************/
|
|
//****************location*******************/
|
|
@@ -6488,7 +6482,7 @@ void* GetDiagnosticsProcess(void* data)
|
|
//printf("%ld\n", rawtime);
|
|
//printf("%ld\n", rawtime);
|
|
timeinfo = localtime (&rawtime);
|
|
timeinfo = localtime (&rawtime);
|
|
strftime (fnamePlusPath,sizeof(fnamePlusPath),"../mnt/%4Y-%2m.zip",timeinfo);
|
|
strftime (fnamePlusPath,sizeof(fnamePlusPath),"../mnt/%4Y-%2m.zip",timeinfo);
|
|
- strftime (fname,sizeof(fname),"%4Y-%2m.zip",timeinfo);
|
|
|
|
|
|
+ strftime (fname,sizeof(fname),"%4Y-%2m-%d-%H-%M-%S.zip",timeinfo);
|
|
DEBUG_INFO("fnamePlusPath =%s\n",fnamePlusPath);
|
|
DEBUG_INFO("fnamePlusPath =%s\n",fnamePlusPath);
|
|
if((access(fnamePlusPath,F_OK))!=-1)
|
|
if((access(fnamePlusPath,F_OK))!=-1)
|
|
{
|
|
{
|
|
@@ -10105,6 +10099,7 @@ void handleBootNotificationResponse(char *payload, int gun_index)
|
|
|
|
|
|
BootNotificationInterval = ShmOCPP16Data->BootNotification.ResponseHeartbeatInterval = intervalInt;
|
|
BootNotificationInterval = ShmOCPP16Data->BootNotification.ResponseHeartbeatInterval = intervalInt;
|
|
HeartBeatWaitTime = BootNotificationInterval;
|
|
HeartBeatWaitTime = BootNotificationInterval;
|
|
|
|
+ clientTime.Heartbeat=time((time_t*)NULL);
|
|
|
|
|
|
|
|
|
|
//#ifdef SystemLogMessage
|
|
//#ifdef SystemLogMessage
|
|
@@ -13691,6 +13686,7 @@ int ftpFile(char *location, char *user, char *password, int port, char *path, ch
|
|
|
|
|
|
memset(ftpbuf, 0, sizeof(ftpbuf));
|
|
memset(ftpbuf, 0, sizeof(ftpbuf));
|
|
|
|
|
|
|
|
+ /* format : ftpput -u phihong -p y42j%2f4cj84 112.91.88.35 -P 21 /2020-02.zip ../mnt/2020-02.zip*/
|
|
/* format : ftpput -u username -p passwd IP target source*/
|
|
/* format : ftpput -u username -p passwd IP target source*/
|
|
sprintf(ftpbuf, "ftpput -u %s -p %s %s -P %d %s%s %s",user,password,IPbuffer,port/*21*/,path,filename,fnamePlusPath);
|
|
sprintf(ftpbuf, "ftpput -u %s -p %s %s -P %d %s%s %s",user,password,IPbuffer,port/*21*/,path,filename,fnamePlusPath);
|
|
DEBUG_INFO("ftpbuf=%s\n",ftpbuf);
|
|
DEBUG_INFO("ftpbuf=%s\n",ftpbuf);
|