|
@@ -45,7 +45,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
#define PASS 1
|
|
|
#define FAIL -1
|
|
|
|
|
@@ -1052,7 +1051,7 @@ int InitShareMemory()
|
|
|
{
|
|
|
clientTime.StatusNotification[gun_index] = time((time_t*)NULL);
|
|
|
clientTime.MeterValues[gun_index] = time((time_t*)NULL);
|
|
|
- strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode, "NoError");
|
|
|
+ //strcpy((char *)ShmOCPP16Data->StatusNotification[gun_index].ErrorCode, "NoError");
|
|
|
}
|
|
|
|
|
|
|
|
@@ -3500,18 +3499,50 @@ int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connector
|
|
|
double diff_f = 0.0;
|
|
|
int diff_i = 0;
|
|
|
struct tm tp;
|
|
|
+ int TimeZero = FALSE;
|
|
|
+ int CompositeScheduleIndex = 0;
|
|
|
|
|
|
- DEBUG_ERROR("handle sendGetCompositeScheduleConfirmation ...\n");
|
|
|
+ DEBUG_INFO("handle sendGetCompositeScheduleConfirmation ...\n");
|
|
|
|
|
|
|
|
|
- strptime((const char *)ShmOCPP16Data->SetChargingProfile[0].ChargingProfile.ChargingSchedule.StartSchedule, "%Y-%m-%dT%H:%M:%S", &tp);
|
|
|
- tp.tm_isdst = -1;
|
|
|
- time_t utc = mktime(&tp);
|
|
|
- time_t t = time(NULL);
|
|
|
- diff_f = difftime(t, utc);
|
|
|
- diff_i = (int)diff_f;
|
|
|
- DEBUG_INFO("\n diff_f=%f \n",diff_f);
|
|
|
+ if(connectorIdInt > 0)
|
|
|
+ {
|
|
|
+ if((ShmOCPP16Data->SetChargingProfile[connectorIdInt -1].ChargingProfile.ChargingSchedule.StartSchedule == NULL)||(strcmp((const char *)ShmOCPP16Data->SetChargingProfile[connectorIdInt -1].ChargingProfile.ChargingSchedule.StartSchedule,"")==0))
|
|
|
+ {
|
|
|
+ TimeZero = TRUE;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strptime((const char *)ShmOCPP16Data->SetChargingProfile[connectorIdInt -1].ChargingProfile.ChargingSchedule.StartSchedule, "%Y-%m-%dT%H:%M:%S", &tp);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if((ShmOCPP16Data->SetChargingProfile[connectorIdInt -1].ChargingProfile.ChargingSchedule.StartSchedule == NULL)||(strcmp((const char *)ShmOCPP16Data->SetChargingProfile[connectorIdInt -1].ChargingProfile.ChargingSchedule.StartSchedule,"")==0))
|
|
|
+ {
|
|
|
+ TimeZero = TRUE;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ strptime((const char *)ShmOCPP16Data->SetChargingProfile[0].ChargingProfile.ChargingSchedule.StartSchedule, "%Y-%m-%dT%H:%M:%S", &tp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ DEBUG_INFO("ShmOCPP16Data->SetChargingProfile[0].ChargingProfile.ChargingSchedule.StartSchedule=%s\n",ShmOCPP16Data->SetChargingProfile[0].ChargingProfile.ChargingSchedule.StartSchedule);
|
|
|
+
|
|
|
+ if(TimeZero == FALSE)
|
|
|
+ {
|
|
|
+ tp.tm_isdst = -1;
|
|
|
+ time_t utc = mktime(&tp);
|
|
|
+ time_t t = time(NULL);
|
|
|
+ diff_f = difftime(t, utc);
|
|
|
+ diff_i = (int)diff_f;
|
|
|
+ }
|
|
|
+
|
|
|
+ DEBUG_INFO("\n diff_f=%f \n",diff_f);
|
|
|
+
|
|
|
+ CompositeScheduleIndex = (connectorIdInt > 0) ?(connectorIdInt -1) : 0;
|
|
|
|
|
|
#if 0 //remove temporally
|
|
|
sprintf(message,"[%d,\"%s\",{\"status\":\"%s\",\"connectorId\":%d,\"scheduleStart\":\"%s\",\"chargingSchedule\":{\"duration\":%d,\"startSchedule\":\"%s\",\"chargingRateUnit\":\"%s\",\"chargingSchedulePeriod\":[{\"startPeriod\":0,\"limit\":6.0,\"numberPhases\":3},{\"startPeriod\":40,\"limit\":10.0,\"numberPhases\":3},{\"startPeriod\":100,\"limit\":8.0,\"numberPhases\":3}"
|
|
@@ -3532,7 +3563,7 @@ int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connector
|
|
|
,uuid
|
|
|
,payload
|
|
|
,connectorIdInt
|
|
|
- ,ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.StartSchedule);
|
|
|
+ ,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.StartSchedule);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -3541,10 +3572,10 @@ int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connector
|
|
|
,uuid
|
|
|
,payload
|
|
|
,connectorIdInt
|
|
|
- ,ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.StartSchedule
|
|
|
- ,ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.Duration
|
|
|
- ,ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.StartSchedule
|
|
|
- ,ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingRateUnit);
|
|
|
+ ,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.StartSchedule
|
|
|
+ ,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.Duration
|
|
|
+ ,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.StartSchedule
|
|
|
+ ,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingRateUnit);
|
|
|
|
|
|
|
|
|
//int len = nPeriod;//sizeof(ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod)/sizeof(ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[0]);
|
|
@@ -3553,25 +3584,39 @@ int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connector
|
|
|
#if 1 // remove temporally
|
|
|
int len = nPeriod;//sizeof(ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod)/sizeof(ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[0]);
|
|
|
|
|
|
- for(int idx_sample=0;idx_sample< len;idx_sample++)
|
|
|
+ if(ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[len -1].StartPeriod < diff_i)
|
|
|
{
|
|
|
|
|
|
- if (idx_sample == 0)
|
|
|
- {
|
|
|
- sprintf(message + strlen(message), "{\"startPeriod\":%d,\"limit\":%.1f,\"numberPhases\":%d}"
|
|
|
- , ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod
|
|
|
- , ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].Limit
|
|
|
- , ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].NumberPhases );
|
|
|
- }
|
|
|
- else
|
|
|
+ sprintf(message + strlen(message), "{\"startPeriod\":%d,\"limit\":%.1f,\"numberPhases\":%d}"
|
|
|
+ , 0
|
|
|
+ , ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[len -1].Limit
|
|
|
+ , ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[len -1].NumberPhases );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ for(int idx_sample=0;idx_sample< len;idx_sample++)
|
|
|
{
|
|
|
- sprintf(message + strlen(message), ",{\"startPeriod\":%d,\"limit\":%.1f,\"numberPhases\":%d}"
|
|
|
- , (ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod - diff_i /*-1*/)
|
|
|
- , ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].Limit
|
|
|
- , ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].NumberPhases );
|
|
|
- }
|
|
|
|
|
|
+ if (idx_sample == 0)
|
|
|
+ {
|
|
|
+ sprintf(message + strlen(message), "{\"startPeriod\":%d,\"limit\":%.1f,\"numberPhases\":%d}"
|
|
|
+ , ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod
|
|
|
+ , ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].Limit
|
|
|
+ , ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].NumberPhases );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf(message + strlen(message), ",{\"startPeriod\":%d,\"limit\":%.1f,\"numberPhases\":%d}"
|
|
|
+ , (((ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod - diff_i /*-1*/) <= 0)?(ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod):(ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].StartPeriod - diff_i /*-1*/))
|
|
|
+ , ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].Limit
|
|
|
+ , ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[idx_sample].NumberPhases );
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
#endif
|
|
|
|
|
|
|
|
@@ -4873,6 +4918,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
int TxDefaultProfileFileIsNull=FALSE;
|
|
|
int ChargePointMaxProfileIsNull=FALSE;
|
|
|
int TxProfileIsNull=FALSE;
|
|
|
+ int CompositeSceduleIndex = 0;
|
|
|
|
|
|
|
|
|
|
|
@@ -4880,6 +4926,8 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
memset(&TxDefaultProfile,0,sizeof(struct StructProfile));
|
|
|
memset(&TxProfile,0,sizeof(struct StructProfile));
|
|
|
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 1\n");
|
|
|
+
|
|
|
c=0;
|
|
|
loc = strstr(payload, "connectorId");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
@@ -4922,9 +4970,11 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
strcpy(chargingRateUnitStr, sstr);
|
|
|
}
|
|
|
|
|
|
+ CompositeSceduleIndex = (connectorIdInt > 0) ?(connectorIdInt -1) :0;
|
|
|
|
|
|
memset(ShmOCPP16Data->GetCompositeSchedule, 0, sizeof(struct StructChargingSchedulePeriod)*gunTotalNumber/*(CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY)*/ );
|
|
|
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 2\n");
|
|
|
if(connectorIdInt==0) // connectorId is 0
|
|
|
{
|
|
|
|
|
@@ -5041,9 +5091,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
if(loc != NULL)
|
|
|
{
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[3+strlen("minChargingRate")+c] != '\"')
|
|
|
+ while ((loc[2+strlen("minChargingRate")+c] != ',')&&(loc[2+strlen("minChargingRate")+c] != '}'))
|
|
|
{
|
|
|
- sstr[c] = loc[3+strlen("minChargingRate")+c];
|
|
|
+ sstr[c] = loc[2+strlen("minChargingRate")+c];
|
|
|
//printf("i=%d sstr=%c\n",c, sstr[c]);
|
|
|
c++;
|
|
|
}
|
|
@@ -5112,7 +5162,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("numberPhases")+2+c] != ',')
|
|
|
+ while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
{
|
|
|
sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
//printf("i=%d sstr=%c\n",c, sstr[c]);
|
|
@@ -5259,9 +5309,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
if(loc != NULL)
|
|
|
{
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[3+strlen("minChargingRate")+c] != '\"')
|
|
|
+ while ((loc[2+strlen("minChargingRate")+c] != ',')&&(loc[2+strlen("minChargingRate")+c] != '}'))
|
|
|
{
|
|
|
- sstr[c] = loc[3+strlen("minChargingRate")+c];
|
|
|
+ sstr[c] = loc[2+strlen("minChargingRate")+c];
|
|
|
//printf("i=%d sstr=%c\n",c, sstr[c]);
|
|
|
c++;
|
|
|
}
|
|
@@ -5329,7 +5379,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
c = 0;
|
|
|
loc = strstr(SchedulePeriodList[i], "numberPhases");
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[strlen("numberPhases")+2+c] != ',')
|
|
|
+ while ((loc[strlen("numberPhases")+2+c] != ',')&&(loc[strlen("numberPhases")+2+c] != '}'))
|
|
|
{
|
|
|
sstr[c] = loc[strlen("numberPhases")+2+c];
|
|
|
//printf("i=%d sstr=%c\n",c, sstr[c]);
|
|
@@ -5364,16 +5414,16 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if(ChargePointMaxProfile.Period[0].Limit > TxDefaultProfile.Period[index].Limit)
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[index].Limit = TxDefaultProfile.Period[index].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[index].Limit = TxDefaultProfile.Period[index].Limit;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[index].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[index].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
}
|
|
|
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[index].NumberPhases = TxDefaultProfile.Period[index].NumberPhases; //for discussion
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[index].StartPeriod = TxDefaultProfile.Period[index].StartPeriod;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.Duration = TxDefaultProfile.Duration;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[index].NumberPhases = TxDefaultProfile.Period[index].NumberPhases; //for discussion
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[index].StartPeriod = TxDefaultProfile.Period[index].StartPeriod;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.Duration = TxDefaultProfile.Duration;
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -5390,23 +5440,23 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
strftime(buf, 28, "%Y-%m-%dT%H:%M:%SZ", gtime);
|
|
|
|
|
|
// make .conf
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.StartSchedule,buf);
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.StartSchedule,buf);
|
|
|
|
|
|
//MaxChargingProfilesInstalled is 10
|
|
|
// ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod = (struct StructChargingSchedulePeriod *) malloc(sizeof(struct StructChargingSchedulePeriod)* 9);
|
|
|
- memset(ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod, 0, sizeof(struct StructChargingSchedulePeriod)* 9);
|
|
|
+ memset(ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod, 0, sizeof(struct StructChargingSchedulePeriod)* 9);
|
|
|
|
|
|
//nPeriod = 1;
|
|
|
|
|
|
if(chargingRateUnitStr[0] != 0)
|
|
|
{
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingRateUnit, chargingRateUnitStr );
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingRateUnit, chargingRateUnitStr );
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingRateUnit, "" );
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingRateUnit, "" );
|
|
|
}
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
|
|
|
confirmPeriods = 1;
|
|
@@ -5414,6 +5464,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
else if ((connectorIdInt > 0)&&((connectorIdInt -1) < gunTotalNumber/*(CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY)*/) )
|
|
|
{
|
|
|
//*****************************ChargePointMaxProfile******************************************/
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 3\n");
|
|
|
strcpy(fname, ChargePointMaxProfile_JSON);
|
|
|
ChargePointMaxProfileIsNull=TRUE;
|
|
|
if((access(ChargePointMaxProfile_JSON,F_OK))!=-1)
|
|
@@ -5531,9 +5582,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
if(loc != NULL)
|
|
|
{
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[3+strlen("minChargingRate")+c] != '\"')
|
|
|
+ while ((loc[2+strlen("minChargingRate")+c] != ',')&&(loc[2+strlen("minChargingRate")+c] != '}'))
|
|
|
{
|
|
|
- sstr[c] = loc[3+strlen("minChargingRate")+c];
|
|
|
+ sstr[c] = loc[2+strlen("minChargingRate")+c];
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
@@ -5665,7 +5716,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
TxDefaultProfileFileIsNull=TRUE;
|
|
|
if((access(fname,F_OK))!=-1)
|
|
|
{
|
|
|
-
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 4\n");
|
|
|
fptr1 = fopen(fname, "r");
|
|
|
|
|
|
c = 0;
|
|
@@ -5730,7 +5781,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
strcpy(tempvalidFromStr,"");
|
|
|
}
|
|
|
-
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 5\n");
|
|
|
//***********validFrom**************/
|
|
|
c = 0;
|
|
|
loc = strstr(sLineWord, "duration");
|
|
@@ -5750,6 +5801,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
tempdurationInt = 0;
|
|
|
}
|
|
|
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 6\n");
|
|
|
//**********startSchedule**********/
|
|
|
c = 0;
|
|
|
loc = strstr(sLineWord, "startSchedule");
|
|
@@ -5780,9 +5832,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
if(loc != NULL)
|
|
|
{
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[3+strlen("minChargingRate")+c] != '\"')
|
|
|
+ while ((loc[2+strlen("minChargingRate")+c] != ',')&&(loc[2+strlen("minChargingRate")+c] != '}'))
|
|
|
{
|
|
|
- sstr[c] = loc[3+strlen("minChargingRate")+c];
|
|
|
+ sstr[c] = loc[2+strlen("minChargingRate")+c];
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
@@ -5792,7 +5844,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
tempminChargingRateFloat = 0.0;
|
|
|
}
|
|
|
-
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 7\n");
|
|
|
//
|
|
|
strptime(tempstartScheduleStr, "%Y-%m-%dT%H:%M:%S", &tp);
|
|
|
tp.tm_isdst = -1;
|
|
@@ -5815,6 +5867,8 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
n_SchedulePeriods = i;
|
|
|
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 8\n");
|
|
|
+
|
|
|
for(int i=0;i<n_SchedulePeriods;i++)
|
|
|
{
|
|
|
//*************startPeriod****************/
|
|
@@ -5936,7 +5990,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}// the end of ACCESS TxDefaultProfile
|
|
|
|
|
|
|
|
|
-
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 9\n");
|
|
|
//****************************TxProfile************************************************/
|
|
|
switch(connectorIdInt)
|
|
|
{
|
|
@@ -6053,9 +6107,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
if(loc != NULL)
|
|
|
{
|
|
|
memset(sstr ,0, sizeof(sstr) );
|
|
|
- while (loc[3+strlen("minChargingRate")+c] != '\"')
|
|
|
+ while ((loc[2+strlen("minChargingRate")+c] != ',')&&(loc[2+strlen("minChargingRate")+c] != '}'))
|
|
|
{
|
|
|
- sstr[c] = loc[3+strlen("minChargingRate")+c];
|
|
|
+ sstr[c] = loc[2+strlen("minChargingRate")+c];
|
|
|
c++;
|
|
|
}
|
|
|
sstr[c] = '\0';
|
|
@@ -6149,20 +6203,23 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
}// the end of ACCESS TxProfile
|
|
|
|
|
|
-
|
|
|
+ DEBUG_INFO("handleGetCompositeScheduleRequest 10\n");
|
|
|
|
|
|
|
|
|
//CompositeSchedule
|
|
|
int period=0;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if((TxDefaultProfileFileIsNull==FALSE) && (ChargePointMaxProfileIsNull==FALSE) && (TxProfileIsNull==FALSE) )
|
|
|
{
|
|
|
for(int k=0; k < TxProfile.TotalPeriod;k++)
|
|
|
{
|
|
|
if(TxProfile.Period[k].Limit < ChargePointMaxProfile.Period[0].Limit)
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = TxProfile.Period[k].Limit;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].NumberPhases = TxProfile.Period[k].NumberPhases;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].StartPeriod = TxProfile.Period[k].StartPeriod;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = TxProfile.Period[k].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].NumberPhases = TxProfile.Period[k].NumberPhases;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].StartPeriod = TxProfile.Period[k].StartPeriod;
|
|
|
period = period + 1;
|
|
|
}
|
|
|
else
|
|
@@ -6173,9 +6230,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].NumberPhases = TxProfile.Period[k].NumberPhases;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].StartPeriod = TxProfile.Period[k].StartPeriod;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].NumberPhases = TxProfile.Period[k].NumberPhases;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].StartPeriod = TxProfile.Period[k].StartPeriod;
|
|
|
period = period + 1;
|
|
|
}
|
|
|
|
|
@@ -6184,19 +6241,19 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
for(int l=0; l < TxDefaultProfile.TotalPeriod;l++)
|
|
|
{
|
|
|
- if((TxDefaultProfile.Period[l].StartPeriod < durationInt)&&(TxDefaultProfile.Period[l].StartPeriod > ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period-1].StartPeriod))
|
|
|
+ if((TxDefaultProfile.Period[l].StartPeriod < durationInt)&&(TxDefaultProfile.Period[l].StartPeriod > ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period-1].StartPeriod))
|
|
|
{
|
|
|
if(TxDefaultProfile.Period[l].Limit < ChargePointMaxProfile.Period[0].Limit)
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = TxDefaultProfile.Period[l].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = TxDefaultProfile.Period[l].Limit;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
|
|
|
}
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
|
|
|
period = period + 1;
|
|
|
}
|
|
@@ -6204,11 +6261,11 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
}
|
|
|
|
|
|
- if((TxDefaultProfile.Duration < durationInt) && (ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period-1].Limit) < ChargePointMaxProfile.Period[0].Limit)
|
|
|
+ if((TxDefaultProfile.Duration < durationInt) && (ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period-1].Limit) < ChargePointMaxProfile.Period[0].Limit)
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].NumberPhases = ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period-1].NumberPhases;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period].StartPeriod = TxDefaultProfile.Duration;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].NumberPhases = ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[period-1].NumberPhases;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[period].StartPeriod = TxDefaultProfile.Duration;
|
|
|
period = period + 1;
|
|
|
|
|
|
}
|
|
@@ -6220,17 +6277,17 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
if(TxProfile.Period[l].Limit < ChargePointMaxProfile.Period[0].Limit)
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].Limit = TxDefaultProfile.Period[l].Limit;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].Limit = TxDefaultProfile.Period[l].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
period = period + 1;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].Limit = ChargePointMaxProfile.Period[0].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
period = period + 1;
|
|
|
}
|
|
|
}
|
|
@@ -6240,9 +6297,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
for(int l=0; l < TxDefaultProfile.TotalPeriod;l++)
|
|
|
{
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].Limit = TxDefaultProfile.Period[l].Limit;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingSchedulePeriod[l].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].Limit = TxDefaultProfile.Period[l].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].NumberPhases = TxDefaultProfile.Period[l].NumberPhases;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[l].StartPeriod = TxDefaultProfile.Period[l].StartPeriod;
|
|
|
period = period + 1;
|
|
|
}
|
|
|
|
|
@@ -6262,18 +6319,13 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
strftime(buf, 28, "%Y-%m-%dT%H:%M:%SZ", gtime);
|
|
|
|
|
|
// make .conf
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.StartSchedule,buf);
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.Duration = durationInt;
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.StartSchedule,buf);
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.Duration = durationInt;
|
|
|
//DEBUG_INFO(" debug 11\n");
|
|
|
- // if(chargingRateUnitStr[0] != 0)
|
|
|
- // {
|
|
|
- // strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingRateUnit, chargingRateUnitStr );
|
|
|
- // }
|
|
|
- // else
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.ChargingRateUnit, tempchargingRateUnitStr );
|
|
|
- }
|
|
|
- ShmOCPP16Data->GetCompositeSchedule[0].ResponseChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
+
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingRateUnit, tempchargingRateUnitStr );
|
|
|
+
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
}
|
|
|
else
|