|
@@ -38,6 +38,7 @@
|
|
|
#include "TransactionQueue.h"
|
|
|
|
|
|
|
|
|
+
|
|
|
#define PASS 1
|
|
|
#define FAIL -1
|
|
|
|
|
@@ -1740,8 +1741,6 @@ int sendBootNotificationRequest(void)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
|
|
|
strcpy((char *)ShmOCPP16Data->BootNotification.CbSN,(const char *)ShmOCPP16Data->ChargeBoxId);
|
|
|
strcpy((char *)ShmOCPP16Data->BootNotification.CpModel,(const char *)ShmSysConfigAndInfo->SysConfig.ModelName);
|
|
@@ -5333,7 +5332,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "limit");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("limit")+2+c] != ',')
|
|
|
+ while ((loc[strlen("limit")+2+c] != ',')&&(loc[strlen("limit")+2+c] != '}'))
|
|
|
{
|
|
|
sstr[c] = loc[strlen("limit")+2+c];
|
|
|
|
|
@@ -5346,14 +5345,24 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
{
|
|
|
- sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
-
|
|
|
- c++;
|
|
|
+ while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
+
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempNumberPhasesInt = atoi(sstr);
|
|
|
+
|
|
|
}
|
|
|
- sstr[c] = '\0';
|
|
|
- tempNumberPhasesInt = atoi(sstr);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempNumberPhasesInt = 0;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
ChargePointMaxProfile.Duration = durationInt;
|
|
|
ChargePointMaxProfile.TotalPeriod = n_SchedulePeriods;
|
|
@@ -5550,7 +5559,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "limit");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("limit")+2+c] != ',')
|
|
|
+ while ((loc[strlen("limit")+2+c] != ',')&&(loc[strlen("limit")+2+c] != '}'))
|
|
|
{
|
|
|
sstr[c] = loc[strlen("limit")+2+c];
|
|
|
|
|
@@ -5563,14 +5572,23 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
{
|
|
|
- sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
-
|
|
|
- c++;
|
|
|
+ while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
+
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempNumberPhasesInt = atoi(sstr);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempNumberPhasesInt = 0;
|
|
|
}
|
|
|
- sstr[c] = '\0';
|
|
|
- tempNumberPhasesInt = atoi(sstr);
|
|
|
|
|
|
TxDefaultProfile.Duration = durationInt;
|
|
|
TxDefaultProfile.TotalPeriod = n_SchedulePeriods;
|
|
@@ -5712,6 +5730,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
strcpy(fname, ChargePointMaxProfile_JSON);
|
|
|
ChargePointMaxProfileIsNull=TRUE;
|
|
|
+
|
|
|
if((access(ChargePointMaxProfile_JSON,F_OK))!=-1)
|
|
|
{
|
|
|
fptr1 = fopen(fname, "r");
|
|
@@ -5759,6 +5778,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
sstr[c] = '\0';
|
|
|
tempconnectorIdInt = atoi(sstr);
|
|
|
#endif
|
|
|
+
|
|
|
|
|
|
c = 0;
|
|
|
loc = strstr(sLineWord, "validFrom");
|
|
@@ -5884,7 +5904,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "limit");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("limit")+2+c] != ',')
|
|
|
+ while ((loc[strlen("limit")+2+c] != ',')&&(loc[strlen("limit")+2+c] != '}'))
|
|
|
{
|
|
|
sstr[c] = loc[strlen("limit")+2+c];
|
|
|
|
|
@@ -5897,14 +5917,22 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
{
|
|
|
- sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
-
|
|
|
- c++;
|
|
|
+ while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
+
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempNumberPhasesInt = atoi(sstr);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempNumberPhasesInt = 0;
|
|
|
}
|
|
|
- sstr[c] = '\0';
|
|
|
- tempNumberPhasesInt = atoi(sstr);
|
|
|
|
|
|
if(j == 0)
|
|
|
{
|
|
@@ -5937,27 +5965,8 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
-#if 0
|
|
|
- switch(connectorIdInt)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- break;
|
|
|
-
|
|
|
- case 1:
|
|
|
- strcpy(fname, TxDefaultProfile_1_JSON );
|
|
|
- break;
|
|
|
|
|
|
- case 2:
|
|
|
- strcpy(fname, TxDefaultProfile_2_JSON );
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- strcpy(fname, TxDefaultProfile_1_JSON );
|
|
|
- break;
|
|
|
- }
|
|
|
-#endif
|
|
|
memset(fname, 0, sizeof fname);
|
|
|
sprintf(fname, "/Storage/OCPP/TxDefaultProfile_%d.json", connectorIdInt);
|
|
|
|
|
@@ -6137,7 +6146,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "limit");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("limit")+2+c] != ',')
|
|
|
+ while ((loc[strlen("limit")+2+c] != ',')&&(loc[strlen("limit")+2+c] != '}'))
|
|
|
{
|
|
|
sstr[c] = loc[strlen("limit")+2+c];
|
|
|
|
|
@@ -6150,14 +6159,22 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
{
|
|
|
- sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
-
|
|
|
- c++;
|
|
|
+ while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
+
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempNumberPhasesInt = atoi(sstr);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempNumberPhasesInt = 0;
|
|
|
}
|
|
|
- sstr[c] = '\0';
|
|
|
- tempNumberPhasesInt = atoi(sstr);
|
|
|
|
|
|
if(j == 0)
|
|
|
{
|
|
@@ -6241,25 +6258,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
|
|
|
-#if 0
|
|
|
- switch(connectorIdInt)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- break;
|
|
|
-
|
|
|
- case 1:
|
|
|
- strcpy(fname, TxProfile_1_JSON );
|
|
|
- break;
|
|
|
|
|
|
- case 2:
|
|
|
- strcpy(fname, TxProfile_2_JSON );
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- strcpy(fname, TxProfile_1_JSON );
|
|
|
- break;
|
|
|
- }
|
|
|
-#endif
|
|
|
memset(fname, 0, sizeof fname);
|
|
|
sprintf(fname, "/Storage/OCPP/TxProfile_%d.json", connectorIdInt);
|
|
|
|
|
@@ -6416,7 +6415,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "limit");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("limit")+2+c] != ',')
|
|
|
+ while ((loc[strlen("limit")+2+c] != ',')&&(loc[strlen("limit")+2+c] != '}'))
|
|
|
{
|
|
|
sstr[c] = loc[strlen("limit")+2+c];
|
|
|
|
|
@@ -6429,15 +6428,23 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
{
|
|
|
- sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
-
|
|
|
- c++;
|
|
|
- }
|
|
|
- sstr[c] = '\0';
|
|
|
- tempNumberPhasesInt = atoi(sstr);
|
|
|
+ while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
+
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempNumberPhasesInt = atoi(sstr);
|
|
|
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempNumberPhasesInt = 0;
|
|
|
+ }
|
|
|
|
|
|
TxProfile.Duration = durationInt;
|
|
|
TxProfile.TotalPeriod = n_SchedulePeriods;
|
|
@@ -6660,8 +6667,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
confirmPeriods = period;
|
|
|
-
|
|
|
-
|
|
|
+ DEBUG_INFO("confirmPeriods=%d\n",confirmPeriods);
|
|
|
|
|
|
struct tm *gtime;
|
|
|
time_t now;
|
|
@@ -6689,6 +6695,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
end:
|
|
|
+
|
|
|
sendGetCompositeScheduleConfirmation(uuid,comfirmstr, connectorIdInt, confirmPeriods);
|
|
|
|
|
|
return result;
|
|
@@ -9474,26 +9481,6 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
|
-#if 0
|
|
|
- switch(connectorIdInt)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- strcpy(filename, TxDefaultProfile_0_JSON );
|
|
|
- break;
|
|
|
-
|
|
|
- case 1:
|
|
|
- strcpy(filename, TxDefaultProfile_1_JSON );
|
|
|
- break;
|
|
|
-
|
|
|
- case 2:
|
|
|
- strcpy(filename, TxDefaultProfile_2_JSON );
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- strcpy(filename, TxDefaultProfile_0_JSON );
|
|
|
- break;
|
|
|
- }
|
|
|
-#endif
|
|
|
memset(filename, 0, sizeof filename);
|
|
|
sprintf(filename, "/Storage/OCPP/TxDefaultProfile_%d.json", connectorIdInt);
|
|
|
|
|
@@ -9576,6 +9563,23 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ for (int index = 0; index < AC_QUANTITY; index++)
|
|
|
+ {
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == (connectorIdInt -1))
|
|
|
+ {
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_CHARGING)
|
|
|
+ {
|
|
|
+ if(transactionIdInt == ShmOCPP16Data->StartTransaction[connectorIdInt -1].ResponseTransactionId)
|
|
|
+ {
|
|
|
+ meet = TRUE;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if(meet == FALSE)
|
|
|
{
|
|
|
sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
@@ -9588,25 +9592,6 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
|
-#if 0
|
|
|
- switch(connectorIdInt)
|
|
|
- {
|
|
|
- case 0:
|
|
|
- break;
|
|
|
-
|
|
|
- case 1:
|
|
|
- strcpy(filename, TxProfile_1_JSON);
|
|
|
- break;
|
|
|
-
|
|
|
- case 2:
|
|
|
- strcpy(filename, TxProfile_2_JSON);
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- strcpy(filename, TxProfile_1_JSON);
|
|
|
- break;
|
|
|
- }
|
|
|
-#endif
|
|
|
sprintf(filename, "/Storage/OCPP/TxProfile_%d.json", connectorIdInt);
|
|
|
|
|
|
fptr1 = fopen(filename, "r");
|
|
@@ -9632,7 +9617,6 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
}
|
|
|
fclose(fptr1);
|
|
|
- DEBUG_INFO("n_chargingProfile_3=%d\n",n_chargingProfile);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -9786,18 +9770,6 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
system(rmFileCmd);
|
|
|
|
|
|
rename(tempfile, filename);
|
|
|
-#if 0
|
|
|
- resultRename = rename(tempfile, filename);
|
|
|
-
|
|
|
- if(resultRename == 0)
|
|
|
- {
|
|
|
- DEBUG_INFO("File chargingProfile renamed successfully");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DEBUG_INFO("Error: unable to rename the chargingProfile file");
|
|
|
- }
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
}
|
|
@@ -9967,18 +9939,6 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
|
|
|
rename(tempfile, filename);
|
|
|
|
|
|
-#if 0
|
|
|
- resultRename = rename(tempfile, filename);
|
|
|
-
|
|
|
- if(resultRename == 0)
|
|
|
- {
|
|
|
- DEBUG_INFO("File chargingProfile renamed successfully");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DEBUG_INFO("Error: unable to rename the chargingProfile file");
|
|
|
- }
|
|
|
-#endif
|
|
|
result = TRUE;
|
|
|
sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Accepted] );
|
|
|
}
|
|
@@ -15378,6 +15338,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
|
|
|
strcpy(fname, ChargePointMaxProfile_JSON);
|
|
|
ChargePointMaxProfileIsNull=TRUE;
|
|
|
+
|
|
|
if((access(ChargePointMaxProfile_JSON,F_OK))!=-1)
|
|
|
{
|
|
|
fptr1 = fopen(fname, "r");
|
|
@@ -15729,14 +15690,23 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
{
|
|
|
- sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
-
|
|
|
- c++;
|
|
|
+ while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
+
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempNumberPhasesInt = atoi(sstr);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempNumberPhasesInt = 0;
|
|
|
}
|
|
|
- sstr[c] = '\0';
|
|
|
- tempNumberPhasesInt = atoi(sstr);
|
|
|
|
|
|
if(j == 0)
|
|
|
{
|
|
@@ -16125,14 +16095,22 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
{
|
|
|
- sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
-
|
|
|
- c++;
|
|
|
+ while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
+
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempNumberPhasesInt = atoi(sstr);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempNumberPhasesInt = 0;
|
|
|
}
|
|
|
- sstr[c] = '\0';
|
|
|
- tempNumberPhasesInt = atoi(sstr);
|
|
|
|
|
|
if(j == 0)
|
|
|
{
|
|
@@ -16583,15 +16561,22 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+
|
|
|
+ if(loc != NULL)
|
|
|
{
|
|
|
- sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
-
|
|
|
- c++;
|
|
|
+ while (loc[strlen("numberPhases")+2+c] != '}')
|
|
|
+ {
|
|
|
+ sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
+
|
|
|
+ c++;
|
|
|
+ }
|
|
|
+ sstr[c] = '\0';
|
|
|
+ tempNumberPhasesInt = atoi(sstr);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ tempNumberPhasesInt = 0;
|
|
|
}
|
|
|
- sstr[c] = '\0';
|
|
|
- tempNumberPhasesInt = atoi(sstr);
|
|
|
-
|
|
|
|
|
|
|
|
|
TxProfile.TotalPeriod = n_SchedulePeriods;
|