|
@@ -3986,7 +3986,8 @@ int ProcessShareMemory()
|
|
|
if((ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') &&
|
|
|
((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
|
|
|
(ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
|
|
|
- (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O'))
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O') ||
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='L'))
|
|
|
) // 'D' means DC
|
|
|
{
|
|
|
// DO series
|
|
@@ -4382,7 +4383,7 @@ void CheckSystemValue(void)
|
|
|
//===============================
|
|
|
// send Heartbeat
|
|
|
//===============================
|
|
|
- if((server_sign == TRUE) && (getDiffSecNow(clientTime.Heartbeat) >= (HeartBeatWaitTime + HeartBeatWithNOResponse)))
|
|
|
+ if((server_sign == TRUE) && (HeartBeatWaitTime > 0) && (getDiffSecNow(clientTime.Heartbeat) >= (HeartBeatWaitTime + HeartBeatWithNOResponse)))
|
|
|
{
|
|
|
//parameter for test
|
|
|
sendHeartbeatRequest(0);
|
|
@@ -5335,22 +5336,26 @@ int sendBootNotificationRequest(void)
|
|
|
int sendDataTransferRequest(int gun_index)
|
|
|
{
|
|
|
mtrace();
|
|
|
- char message[1000]={0};
|
|
|
+ char message[10240]={0};
|
|
|
char guid[37]={0};
|
|
|
char tempdata[65]={0};
|
|
|
int result = FAIL;
|
|
|
|
|
|
+ json_object *DataTransfer = json_object_new_object();
|
|
|
+
|
|
|
+ json_object_object_add(DataTransfer, "vendorId", json_object_new_string((char*)ShmOCPP16DataPH->DataTransfer[gun_index].VendorId));
|
|
|
+ json_object_object_add(DataTransfer, "messageId", json_object_new_string((char*)ShmOCPP16DataPH->DataTransfer[gun_index].MessageId));
|
|
|
+ json_object_object_add(DataTransfer, "data", json_object_new_string((char*)ShmOCPP16DataPH->DataTransfer[gun_index].Data));
|
|
|
+
|
|
|
+
|
|
|
random_uuid(guid);
|
|
|
- sprintf(message,"[%d,\"%s\",\"DataTransfer\",{\"vendorId\":\"%s\",\"messageId\":\"%s\",\"data\":\"%s\"}]",
|
|
|
- MESSAGE_TYPE_CALL,
|
|
|
- guid,
|
|
|
- ShmOCPP16DataPH->DataTransfer[gun_index].VendorId,
|
|
|
- ShmOCPP16DataPH->DataTransfer[gun_index].MessageId,
|
|
|
- ShmOCPP16DataPH->DataTransfer[gun_index].Data);
|
|
|
+ sprintf(message,"[%d,\"%s\",\"DataTransfer\",%s]", MESSAGE_TYPE_CALL,
|
|
|
+ guid,
|
|
|
+ json_object_to_json_string_ext(DataTransfer, JSON_C_TO_STRING_PLAIN));
|
|
|
+ json_object_put(DataTransfer);
|
|
|
|
|
|
LWS_Send(message);
|
|
|
-
|
|
|
- sprintf(tempdata, "DataTransfer,%d", (gun_index + 1));
|
|
|
+ sprintf(tempdata, "DataTransfer,%d", gun_index);
|
|
|
if(hashmap_operation(HASH_OP_ADD, guid, tempdata) == 1)
|
|
|
{
|
|
|
result = PASS;
|
|
@@ -5363,7 +5368,7 @@ int sendDataTransferRequest(int gun_index)
|
|
|
int sendUnplugByDataTransferRequest(int gun_index)
|
|
|
{
|
|
|
mtrace();
|
|
|
- char message[1000]={0};
|
|
|
+ char message[10752]={0};
|
|
|
char guid[37]={0};
|
|
|
char tempdata[65]={0};
|
|
|
int result = FAIL;
|
|
@@ -9824,97 +9829,49 @@ int handleClearChargingProfileRequest(char *uuid, char *payload)
|
|
|
json_object_put(ClearChargingProfile);
|
|
|
|
|
|
|
|
|
- if(connectorIsNULL == FALSE)
|
|
|
+ if(connectorIdInt > 0)
|
|
|
{
|
|
|
- switch(connectorIdInt)
|
|
|
+ if(chargingProfilePurposeIsNULL == TRUE)
|
|
|
{
|
|
|
- case 0:
|
|
|
-
|
|
|
- if(chargingProfilePurposeIsNULL == TRUE)
|
|
|
- {
|
|
|
- int l = 0;
|
|
|
- strcpy(fname, ChargePointMaxProfile_JSON);
|
|
|
- if((access(fname,F_OK))!=-1)
|
|
|
- {
|
|
|
- strcpy(chargingProfiles[l], fname);
|
|
|
- l = l + 1;
|
|
|
- }
|
|
|
-
|
|
|
- strcpy(fname, TxDefaultProfile_0_JSON);
|
|
|
- if((access(fname,F_OK))!=-1)
|
|
|
- {
|
|
|
- strcpy(chargingProfiles[l], fname);
|
|
|
- l = l + 1;
|
|
|
- }
|
|
|
- ChargeProfileCount = l;
|
|
|
-
|
|
|
- }
|
|
|
- else if((chargingProfilePurposeIsNULL == FALSE)&&(strcmp(chargingProfilePurposeStr,"ChargePointMaxProfile")==0))
|
|
|
- {
|
|
|
- strcpy(fname, ChargePointMaxProfile_JSON);
|
|
|
- if((access(fname,F_OK))!=-1)
|
|
|
- {
|
|
|
- strcpy(chargingProfiles[0], fname);
|
|
|
- ChargeProfileCount = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- else if((chargingProfilePurposeIsNULL == FALSE)&&(strcmp(chargingProfilePurposeStr,"TxDefaultProfile")==0))
|
|
|
- {
|
|
|
- strcpy(fname, TxDefaultProfile_0_JSON);
|
|
|
- if((access(fname,F_OK))!=-1)
|
|
|
- {
|
|
|
- strcpy(chargingProfiles[0], fname);
|
|
|
- ChargeProfileCount = 1;
|
|
|
- }
|
|
|
- }
|
|
|
+ int m = 0;
|
|
|
+ memset(fname, 0, ARRAY_SIZE(fname));
|
|
|
+ sprintf(fname, "/Storage/OCPP_PH/TxDefaultProfile_%d.json", connectorIdInt);
|
|
|
+ if((access(fname,F_OK))!=-1)
|
|
|
+ {
|
|
|
+ strcpy(chargingProfiles[m], fname);
|
|
|
+ m = m + 1;
|
|
|
+ }
|
|
|
|
|
|
- break;
|
|
|
+ memset(fname, 0, ARRAY_SIZE(fname));
|
|
|
+ sprintf(fname, "/Storage/OCPP_PH/TxProfile_%d.json", connectorIdInt);
|
|
|
+ if((access(fname,F_OK))!=-1)
|
|
|
+ {
|
|
|
+ strcpy(chargingProfiles[m], fname);
|
|
|
+ m = m + 1;
|
|
|
+ }
|
|
|
|
|
|
- default:
|
|
|
- if(chargingProfilePurposeIsNULL == TRUE)
|
|
|
- {
|
|
|
- int m = 0;
|
|
|
- memset(fname, 0, ARRAY_SIZE(fname));
|
|
|
- sprintf(fname, "/Storage/OCPP_PH/TxDefaultProfile_%d.json", connectorIdInt);
|
|
|
- if((access(fname,F_OK))!=-1)
|
|
|
- {
|
|
|
- strcpy(chargingProfiles[m], fname);
|
|
|
- m = m + 1;
|
|
|
- }
|
|
|
-
|
|
|
- memset(fname, 0, ARRAY_SIZE(fname));
|
|
|
- sprintf(fname, "/Storage/OCPP_PH/TxProfile_%d.json", connectorIdInt);
|
|
|
- if((access(fname,F_OK))!=-1)
|
|
|
- {
|
|
|
- strcpy(chargingProfiles[m], fname);
|
|
|
- m = m + 1;
|
|
|
- }
|
|
|
-
|
|
|
- ChargeProfileCount = m;
|
|
|
- }
|
|
|
- else if((chargingProfilePurposeIsNULL == FALSE)&&(strcmp(chargingProfilePurposeStr,"TxDefaultProfile")==0))
|
|
|
- {
|
|
|
- //strcpy(fname, TxDefaultProfile_1_JSON);
|
|
|
- sprintf(fname, "/Storage/OCPP_PH/TxDefaultProfile_%d.json", connectorIdInt);
|
|
|
- if((access(fname,F_OK))!=-1)
|
|
|
- {
|
|
|
- strcpy(chargingProfiles[0], fname);
|
|
|
- ChargeProfileCount = 1;
|
|
|
- }
|
|
|
+ ChargeProfileCount = m;
|
|
|
+ }
|
|
|
+ else if((chargingProfilePurposeIsNULL == FALSE)&&(strcmp(chargingProfilePurposeStr,"TxDefaultProfile")==0))
|
|
|
+ {
|
|
|
+ //strcpy(fname, TxDefaultProfile_1_JSON);
|
|
|
+ sprintf(fname, "/Storage/OCPP_PH/TxDefaultProfile_%d.json", connectorIdInt);
|
|
|
+ if((access(fname,F_OK))!=-1)
|
|
|
+ {
|
|
|
+ strcpy(chargingProfiles[0], fname);
|
|
|
+ ChargeProfileCount = 1;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
- else if((chargingProfilePurposeIsNULL == FALSE)&&(strcmp(chargingProfilePurposeStr,"TxProfile")==0))
|
|
|
- {
|
|
|
- sprintf(fname, "/Storage/OCPP_PH/TxProfile_%d.json", connectorIdInt);
|
|
|
- if((access(fname,F_OK))!=-1)
|
|
|
- {
|
|
|
- strcpy(chargingProfiles[0], fname);
|
|
|
- ChargeProfileCount = 1;
|
|
|
- }
|
|
|
- //strcpy(fname, TxProfile_1_JSON);
|
|
|
- }
|
|
|
- //strcpy(fname, ChargePointMaxProfile_JSON );
|
|
|
- break;
|
|
|
+ }
|
|
|
+ else if((chargingProfilePurposeIsNULL == FALSE)&&(strcmp(chargingProfilePurposeStr,"TxProfile")==0))
|
|
|
+ {
|
|
|
+ sprintf(fname, "/Storage/OCPP_PH/TxProfile_%d.json", connectorIdInt);
|
|
|
+ if((access(fname,F_OK))!=-1)
|
|
|
+ {
|
|
|
+ strcpy(chargingProfiles[0], fname);
|
|
|
+ ChargeProfileCount = 1;
|
|
|
+ }
|
|
|
+ //strcpy(fname, TxProfile_1_JSON);
|
|
|
}
|
|
|
}
|
|
|
else // Check all Charging Profiles
|
|
@@ -11546,6 +11503,31 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
}
|
|
|
json_object_put(GetDiagnostics);
|
|
|
|
|
|
+ // Notify CSU to get log of dispensers.
|
|
|
+ if((ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D') &&
|
|
|
+ ((ShmSysConfigAndInfo->SysConfig.ModelName[1]=='B') ||
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='K') ||
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='O') ||
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.ModelName[1]=='L'))
|
|
|
+ )
|
|
|
+ {
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->GetDiagnostics.StartTime,"%s",startTimestr);
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->GetDiagnostics.StopTime,"%s",stopTimestr);
|
|
|
+
|
|
|
+ ShmOCPP16DataPH->MsMsg.bits.GetDiagnosticsReq = TRUE;
|
|
|
+
|
|
|
+ struct timespec timerGetDiagnostics;
|
|
|
+ refreshStartTimer(&timerGetDiagnostics);
|
|
|
+ while(ShmOCPP16DataPH->MsMsg.bits.GetDiagnosticsReq != FALSE)
|
|
|
+ {
|
|
|
+ if(getDiffSecNow(timerGetDiagnostics)>=180)
|
|
|
+ {
|
|
|
+ ShmOCPP16DataPH->MsMsg.bits.GetDiagnosticsReq = FALSE;
|
|
|
+ DEBUG_INFO("Waiting log of dispenser timeout.");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// Pack log to compress file
|
|
|
if((sscanf((char*)startTimestr, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStart.tm_year, &tmStart.tm_mon, &tmStart.tm_mday, &tmStart.tm_hour, &tmStart.tm_min, &tmStart.tm_sec) == 6) &&
|
|
|
(sscanf((char*)stopTimestr, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStop.tm_year, &tmStop.tm_mon, &tmStop.tm_mday, &tmStop.tm_hour, &tmStop.tm_min, &tmStop.tm_sec) == 6))
|
|
@@ -11575,6 +11557,9 @@ void* GetDiagnosticsProcess(void* data)
|
|
|
|
|
|
sprintf(cmdBuf, "%s /Storage/CCS*.zip", cmdBuf);
|
|
|
sprintf(cmdBuf, "%s /Storage/OCPP/*.db", cmdBuf);
|
|
|
+ sprintf(cmdBuf, "%s /Storage/OCPP/TransactionRelatedQueue", cmdBuf);
|
|
|
+ sprintf(cmdBuf, "%s /Storage/OCPP/QueueTransactionId", cmdBuf);
|
|
|
+ sprintf(cmdBuf, "%s /Storage/OCPP/OCPPConfiguration", cmdBuf);
|
|
|
system(cmdBuf);
|
|
|
|
|
|
// Pack charging & event log
|
|
@@ -19003,7 +18988,24 @@ int setKeyValue(char *key, char *value)
|
|
|
if((ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizationKey].ItemAccessibility == 1) && (strlen(value) <= 40))
|
|
|
{
|
|
|
strcpy(str, (const char*)value);
|
|
|
- sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "%s", str);
|
|
|
+ int strlength = strlen(str);
|
|
|
+ char capture[3];
|
|
|
+ char stackItem = 0;
|
|
|
+ char password[21] = {0};
|
|
|
+
|
|
|
+ printf("String length: %d\n", strlength);
|
|
|
+
|
|
|
+ for(int idx=0; idx<(strlength/2); idx++)
|
|
|
+ {
|
|
|
+ capture[0] = str[(idx*2)];
|
|
|
+ capture[1] = str[(idx*2)+1];
|
|
|
+ capture[2] = 0;
|
|
|
+ stackItem = (char)strtol(capture, NULL, 16); // number base 16
|
|
|
+
|
|
|
+ sprintf(password,"%s%c", password, stackItem);
|
|
|
+ }
|
|
|
+
|
|
|
+ sprintf((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData, "%s", password);
|
|
|
strcpy((char*)ShmSysConfigAndInfo->SysConfig.MaintainServerSecurityPassword, (char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[AuthorizationKey].ItemData);
|
|
|
isSuccess = ConfigurationStatus_Accepted;
|
|
|
}
|