|
@@ -170,6 +170,10 @@ static int ChademoPreviousSystemStatus[CHAdeMO_QUANTITY];
|
|
|
static int CcsPreviousSystemStatus[CCS_QUANTITY];
|
|
|
static int GbPreviousSystemStatus[GB_QUANTITY];
|
|
|
static int AcPreviousSystemStatus[AC_QUANTITY];
|
|
|
+static int ChademoPreviousConnectorPlugIn[CHAdeMO_QUANTITY];
|
|
|
+static int CcsPreviousConnectorPlugIn[CCS_QUANTITY];
|
|
|
+static int GbPreviousConnectorPlugIn[GB_QUANTITY];
|
|
|
+static int AcPreviousConnectorPlugIn[AC_QUANTITY];
|
|
|
int TransactionMessageAttemptsValue = 0;
|
|
|
int TransactionMessageRetryIntervalValue = 0;
|
|
|
static struct OCPPAuthLocalElemet
|
|
@@ -1081,25 +1085,29 @@ int InitShareMemory()
|
|
|
DEBUG_INFO("AC ...\n");
|
|
|
}
|
|
|
|
|
|
- //Status Setting
|
|
|
+ //Status / ConnectorPlugIn Setting
|
|
|
for (int index = 0; index < CHAdeMO_QUANTITY; index++)
|
|
|
{
|
|
|
ChademoPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PreviousSystemStatus;
|
|
|
+ ChademoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn;
|
|
|
}
|
|
|
|
|
|
for (int index = 0; index < CCS_QUANTITY; index++)
|
|
|
{
|
|
|
- CcsPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PreviousSystemStatus;
|
|
|
+ CcsPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PreviousSystemStatus;
|
|
|
+ CcsPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn;
|
|
|
}
|
|
|
|
|
|
for (int index = 0; index < GB_QUANTITY; index++)
|
|
|
{
|
|
|
- GbPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PreviousSystemStatus;
|
|
|
+ GbPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PreviousSystemStatus;
|
|
|
+ GbPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn;
|
|
|
}
|
|
|
|
|
|
for (int index = 0; index < AC_QUANTITY; index++)
|
|
|
{
|
|
|
AcPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PreviousSystemStatus;
|
|
|
+ AcPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
|
|
|
}
|
|
|
|
|
|
return result;
|
|
@@ -1316,13 +1324,13 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn != ChademoPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
{
|
|
|
- PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus;
|
|
|
+ //PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus;
|
|
|
ChademoPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus;
|
|
|
+ ChademoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
|
statusModeChage[gun_index] = TRUE;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1332,10 +1340,11 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn != CcsPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
{
|
|
|
- PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus;
|
|
|
+ //PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus;
|
|
|
CcsPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus;
|
|
|
+ CcsPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
|
statusModeChage[gun_index] = TRUE;
|
|
|
}
|
|
@@ -1345,12 +1354,13 @@ void CheckSystemValue(void)
|
|
|
|
|
|
for (int index = 0; index < GB_QUANTITY; index++)
|
|
|
{
|
|
|
- if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)/*&&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == '4')*/)
|
|
|
+ if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn != GbPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
{
|
|
|
- PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus;
|
|
|
+ //PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus;
|
|
|
GbPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus;
|
|
|
+ GbPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
|
statusModeChage[gun_index] = TRUE;
|
|
|
}
|
|
@@ -1365,10 +1375,11 @@ void CheckSystemValue(void)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)
|
|
|
{
|
|
|
- if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState != AcPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
|
|
|
{
|
|
|
- PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus;
|
|
|
+ //PRE_SYS_MODE[gun_index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus;
|
|
|
AcPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus;
|
|
|
+ AcPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
|
|
|
cpinitateMsg.bits[gun_index].StatusNotificationReq = 1;
|
|
|
statusModeChage[gun_index] = TRUE;
|
|
|
}
|
|
@@ -3385,12 +3396,24 @@ int sendGetCompositeScheduleConfirmation(char *uuid,char *payload, int connector
|
|
|
|
|
|
if(nPeriod == 0)
|
|
|
{
|
|
|
- sprintf(message,"[%d,\"%s\",{\"status\":\"%s\",\"connectorId\":%d,\"scheduleStart\":\"%s\"}]"
|
|
|
- ,MESSAGE_TYPE_CALLRESULT
|
|
|
- ,uuid
|
|
|
- ,payload
|
|
|
- ,connectorIdInt
|
|
|
- ,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.StartSchedule);
|
|
|
+ if(strcmp((const char *)ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.StartSchedule,"")==0)
|
|
|
+ {
|
|
|
+ sprintf(message,"[%d,\"%s\",{\"status\":\"%s\",\"connectorId\":%d}]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,payload
|
|
|
+ ,connectorIdInt);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sprintf(message,"[%d,\"%s\",{\"status\":\"%s\",\"connectorId\":%d,\"scheduleStart\":\"%s\"}]"
|
|
|
+ ,MESSAGE_TYPE_CALLRESULT
|
|
|
+ ,uuid
|
|
|
+ ,payload
|
|
|
+ ,connectorIdInt
|
|
|
+ ,ShmOCPP16Data->GetCompositeSchedule[CompositeScheduleIndex].ResponseChargingSchedule.StartSchedule);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -5024,7 +5047,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
int n_chargingProfile = 0;
|
|
|
int n_SchedulePeriods = 0;
|
|
|
char SchedulePeriodList[10][200]={0};
|
|
|
- char sLineWord[800]={0};
|
|
|
+ char sLineWord[1600]={0};
|
|
|
//int n_periods = 0;
|
|
|
char word[1000]={0};
|
|
|
int confirmPeriods = 0;
|
|
@@ -5409,8 +5432,6 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
strcpy(tempstartScheduleStr, sstr);
|
|
|
strcpy(TxDefaultProfileScheduleStr, sstr);
|
|
|
|
|
|
-
|
|
|
- DEBUG_INFO(" debug 3-1\n");
|
|
|
//**********chargingRateUnit**********/
|
|
|
c = 0;
|
|
|
loc = strstr(sLineWord, "chargingRateUnit");
|
|
@@ -5527,9 +5548,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}// the end of ACCESS TxDefaultProfile
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- // Composite Schedule
|
|
|
+ //--------------------- Composite Schedule-----------------------------//
|
|
|
if((ChargePointMaxProfileIsNull==FALSE)&&(TxDefaultProfileFileIsNull==FALSE))
|
|
|
{
|
|
|
strcpy(CurrentChargingProfileScheduleStr, TxDefaultProfileScheduleStr);
|
|
@@ -5549,8 +5568,43 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.Duration = TxDefaultProfile.Duration;
|
|
|
}
|
|
|
|
|
|
+ confirmPeriods = TxDefaultProfile.TotalPeriod;
|
|
|
+
|
|
|
}
|
|
|
+ else if((ChargePointMaxProfileIsNull==TRUE)&&(TxDefaultProfileFileIsNull==FALSE))
|
|
|
+ {
|
|
|
+ strcpy(CurrentChargingProfileScheduleStr, TxDefaultProfileScheduleStr);
|
|
|
+ for(int index=0; index < TxDefaultProfile.TotalPeriod ; index++)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[index].Limit = TxDefaultProfile.Period[index].Limit;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
|
|
|
+ confirmPeriods = TxDefaultProfile.TotalPeriod;
|
|
|
+
|
|
|
+ }
|
|
|
+ else if((ChargePointMaxProfileIsNull==FALSE)&&(TxDefaultProfileFileIsNull==TRUE))
|
|
|
+ {
|
|
|
+ strcpy(CurrentChargingProfileScheduleStr, ChargePointMaxProfileScheduleStr);
|
|
|
+ for(int index=0; index < ChargePointMaxProfile.TotalPeriod ; index++)
|
|
|
+ {
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[index].Limit = ChargePointMaxProfile.Period[index].Limit;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[index].NumberPhases = ChargePointMaxProfile.Period[index].NumberPhases; //for discussion
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod[index].StartPeriod = ChargePointMaxProfile.Period[index].StartPeriod;
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.Duration = TxDefaultProfile.Duration;
|
|
|
+ }
|
|
|
+
|
|
|
+ confirmPeriods = ChargePointMaxProfile.TotalPeriod;
|
|
|
+
|
|
|
+ }
|
|
|
+ else if((ChargePointMaxProfileIsNull==TRUE)&&(TxDefaultProfileFileIsNull==TRUE))
|
|
|
+ {
|
|
|
+ confirmPeriods = 0;
|
|
|
+ sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Rejected] );
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
|
|
|
//* Define temporary variables */
|
|
|
struct tm *gtime;
|
|
@@ -5564,25 +5618,11 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
// make .conf
|
|
|
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[CompositeSceduleIndex].ResponseChargingSchedule.ChargingSchedulePeriod, 0, sizeof(struct StructChargingSchedulePeriod)* 9);
|
|
|
-
|
|
|
- //nPeriod = 1;
|
|
|
-
|
|
|
- if(chargingRateUnitStr[0] != 0)
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingRateUnit, chargingRateUnitStr );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingRateUnit, "" );
|
|
|
- }
|
|
|
+ ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.Duration = durationInt;
|
|
|
+ strcpy((char *)ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.ChargingRateUnit, tempchargingRateUnitStr );
|
|
|
ShmOCPP16Data->GetCompositeSchedule[CompositeSceduleIndex].ResponseChargingSchedule.MinChargingRate = MinChargingRate;
|
|
|
sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
|
|
|
- confirmPeriods = 1;
|
|
|
}
|
|
|
else if ((connectorIdInt > 0)&&((connectorIdInt -1) < gunTotalNumber/*(CHAdeMO_QUANTITY+ CCS_QUANTITY + GB_QUANTITY)*/) )
|
|
|
{
|
|
@@ -5601,7 +5641,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
if(c == EOF)
|
|
|
{
|
|
|
DEBUG_INFO("\n End of file reached.");
|
|
|
- ChargePointMaxProfileIsNull=TRUE;
|
|
|
+ ChargePointMaxProfileIsNull=TRUE;
|
|
|
fclose(fptr1);
|
|
|
|
|
|
}
|
|
@@ -5687,7 +5727,6 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
strcpy(tempstartScheduleStr, sstr);
|
|
|
strcpy(ChargePointMaxProfileScheduleStr, sstr);
|
|
|
|
|
|
-
|
|
|
//**********chargingRateUnit**********/
|
|
|
c = 0;
|
|
|
loc = strstr(sLineWord, "chargingRateUnit");
|
|
@@ -5800,8 +5839,6 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
MinChargingRate = tempminChargingRateFloat;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if(confirmPeriods < n_SchedulePeriods)
|
|
|
{
|
|
|
confirmPeriods = n_SchedulePeriods;
|
|
@@ -5818,7 +5855,6 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}// the end of access file ChargePointMaxProfile
|
|
|
|
|
|
|
|
|
-
|
|
|
//****************************TxDefaultProfile************************************************/
|
|
|
#if 0
|
|
|
switch(connectorIdInt)
|
|
@@ -6342,9 +6378,6 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
//CompositeSchedule
|
|
|
int period=0;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if((TxDefaultProfileFileIsNull==FALSE) && (ChargePointMaxProfileIsNull==FALSE) && (TxProfileIsNull==FALSE) )
|
|
|
{
|
|
|
strcpy(CurrentChargingProfileScheduleStr,TxProfileScheduleStr);
|
|
@@ -6441,6 +6474,13 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ else if((TxDefaultProfileFileIsNull==TRUE) && (TxProfileIsNull==TRUE))
|
|
|
+ {
|
|
|
+ confirmPeriods = 0;
|
|
|
+ sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Rejected] );
|
|
|
+ goto end;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
confirmPeriods = period;
|
|
|
//DEBUG_INFO("confirmPeriods=%d\n",confirmPeriods);
|
|
@@ -6471,6 +6511,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
}
|
|
|
|
|
|
+ end:
|
|
|
sendGetCompositeScheduleConfirmation(uuid,comfirmstr, connectorIdInt, confirmPeriods);
|
|
|
|
|
|
return result;
|