|
@@ -65,6 +65,18 @@
|
|
|
#define LocalAuthorizationList_JSON "/Storage/OCPP/LocalAuthorizationList.json"
|
|
|
|
|
|
|
|
|
+//===================================
|
|
|
+// Define CP State constant
|
|
|
+//===================================
|
|
|
+#define CP_STATE_UNKNOWN 0
|
|
|
+#define CP_STATE_A 1
|
|
|
+#define CP_STATE_B 2
|
|
|
+#define CP_STATE_C 3
|
|
|
+#define CP_STATE_D 4
|
|
|
+#define CP_STATE_E 5
|
|
|
+#define CP_STATE_F 6
|
|
|
+
|
|
|
+
|
|
|
struct SysConfigAndInfo *ShmSysConfigAndInfo;
|
|
|
struct StatusCodeData *ShmStatusCodeData;
|
|
|
struct PsuData *ShmPsuData ;
|
|
@@ -158,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
|
|
@@ -1069,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;
|
|
@@ -1304,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;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -1320,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;
|
|
|
}
|
|
@@ -1333,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;
|
|
|
}
|
|
@@ -1353,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;
|
|
|
}
|
|
@@ -2099,7 +2122,15 @@ S_FAULT =12
|
|
|
{
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_IDLE)) //S_IDLE
|
|
|
{
|
|
|
- currentStatus = 0; //OCPP Status: Available
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn == 1) // //0: unplug, 1: Plug-in
|
|
|
+ {
|
|
|
+ currentStatus = 1; //OCPP Status: Preparing
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ currentStatus = 0; //OCPP Status: Available
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus == SYS_MODE_PREPARING)) //S_PRECHARGE
|
|
|
{
|
|
@@ -2136,7 +2167,15 @@ S_FAULT =12
|
|
|
{
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_IDLE)) //S_IDLE
|
|
|
{
|
|
|
- currentStatus = 0; //OCPP Status: Available
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn == 1) //0: unplug, 1: Plug-in
|
|
|
+ {
|
|
|
+ currentStatus = 1; //OCPP Status: Preparing
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ currentStatus = 0; //OCPP Status: Available
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus == SYS_MODE_PREPARING)) //S_PRECHARGE
|
|
|
{
|
|
@@ -2173,7 +2212,14 @@ S_FAULT =12
|
|
|
{
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index) &&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_IDLE)) //S_IDLE
|
|
|
{
|
|
|
- currentStatus = 0; //OCPP Status: Available
|
|
|
+ if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn == 1) // //0: unplug, 1: Plug-in
|
|
|
+ {
|
|
|
+ currentStatus = 1; //OCPP Status: Preparing
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ currentStatus = 0; //OCPP Status: Available
|
|
|
+ }
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == gun_index) &&(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus == SYS_MODE_PREPARING)) //S_PRECHARGE
|
|
|
{
|
|
@@ -2212,7 +2258,15 @@ S_FAULT =12
|
|
|
{
|
|
|
if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_IDLE)) //S_IDLE
|
|
|
{
|
|
|
- currentStatus = 0; //OCPP Status: Available
|
|
|
+ if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState == CP_STATE_B) ||(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState == CP_STATE_C) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState == CP_STATE_D))
|
|
|
+ {
|
|
|
+ currentStatus = 1; //OCPP Status: Preparing
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ currentStatus = 0; //OCPP Status: Available
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else if ((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == gun_index)&&(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus == SYS_MODE_PREPARING)) //S_PRECHARGE
|
|
|
{
|
|
@@ -3342,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
|
|
|
{
|
|
@@ -4503,14 +4569,19 @@ int handleClearChargingProfileRequest(char *uuid, char *payload)
|
|
|
|
|
|
if((connectorIsNULL == FALSE) && (connectorIdInt == 0) )
|
|
|
{
|
|
|
- //clear file in C
|
|
|
- sprintf(str,"rm -f %s",fname);
|
|
|
- system(str);
|
|
|
-
|
|
|
+ memset(str, 0, sizeof str);
|
|
|
// clear temp file
|
|
|
sprintf(str,"rm -f %s",temp);
|
|
|
system(str);
|
|
|
|
|
|
+ for(int k=0; k < ChargeProfileCount; k++)
|
|
|
+ {
|
|
|
+ memset(str, 0, sizeof str);
|
|
|
+ //clear file in C
|
|
|
+ sprintf(str,"rm -f %s",chargingProfiles[k]);
|
|
|
+ system(str);
|
|
|
+ }
|
|
|
+
|
|
|
sprintf(comfirmstr, "%s", ClearChargingProfileStatusStr[ClearChargingProfileStatus_Accepted] );
|
|
|
goto end;
|
|
|
}
|
|
@@ -4976,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;
|
|
@@ -5361,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");
|
|
@@ -5479,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);
|
|
@@ -5501,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;
|
|
@@ -5516,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)*/) )
|
|
|
{
|
|
@@ -5553,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);
|
|
|
|
|
|
}
|
|
@@ -5639,7 +5727,6 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
strcpy(tempstartScheduleStr, sstr);
|
|
|
strcpy(ChargePointMaxProfileScheduleStr, sstr);
|
|
|
|
|
|
-
|
|
|
//**********chargingRateUnit**********/
|
|
|
c = 0;
|
|
|
loc = strstr(sLineWord, "chargingRateUnit");
|
|
@@ -5752,8 +5839,6 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
MinChargingRate = tempminChargingRateFloat;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
if(confirmPeriods < n_SchedulePeriods)
|
|
|
{
|
|
|
confirmPeriods = n_SchedulePeriods;
|
|
@@ -5770,9 +5855,8 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}// the end of access file ChargePointMaxProfile
|
|
|
|
|
|
|
|
|
-
|
|
|
//****************************TxDefaultProfile************************************************/
|
|
|
-
|
|
|
+#if 0
|
|
|
switch(connectorIdInt)
|
|
|
{
|
|
|
case 0:
|
|
@@ -5790,6 +5874,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
strcpy(fname, TxDefaultProfile_1_JSON );
|
|
|
break;
|
|
|
}
|
|
|
+#endif
|
|
|
+ memset(fname, 0, sizeof fname);
|
|
|
+ sprintf(fname, "/Storage/OCPP/TxDefaultProfile_%d.json", connectorIdInt);
|
|
|
|
|
|
TxDefaultProfileFileIsNull=TRUE;
|
|
|
if((access(fname,F_OK))!=-1)
|
|
@@ -6071,6 +6158,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
}// the end of ACCESS TxDefaultProfile
|
|
|
|
|
|
//****************************TxProfile************************************************/
|
|
|
+#if 0
|
|
|
switch(connectorIdInt)
|
|
|
{
|
|
|
case 0:
|
|
@@ -6088,6 +6176,9 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
strcpy(fname, TxProfile_1_JSON );
|
|
|
break;
|
|
|
}
|
|
|
+#endif
|
|
|
+ memset(fname, 0, sizeof fname);
|
|
|
+ sprintf(fname, "/Storage/OCPP/TxProfile_%d.json", connectorIdInt);
|
|
|
|
|
|
TxProfileIsNull=TRUE;
|
|
|
if((access(fname,F_OK))!=-1)
|
|
@@ -6287,9 +6378,6 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
|
|
|
//CompositeSchedule
|
|
|
int period=0;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
if((TxDefaultProfileFileIsNull==FALSE) && (ChargePointMaxProfileIsNull==FALSE) && (TxProfileIsNull==FALSE) )
|
|
|
{
|
|
|
strcpy(CurrentChargingProfileScheduleStr,TxProfileScheduleStr);
|
|
@@ -6386,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);
|
|
@@ -6416,6 +6511,7 @@ int handleGetCompositeScheduleRequest(char *uuid, char *payload)
|
|
|
sprintf(comfirmstr, "%s", GetCompositeScheduleStatusStr[GetCompositeScheduleStatus_Accepted] );
|
|
|
}
|
|
|
|
|
|
+ end:
|
|
|
sendGetCompositeScheduleConfirmation(uuid,comfirmstr, connectorIdInt, confirmPeriods);
|
|
|
|
|
|
return result;
|
|
@@ -9014,7 +9110,6 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
//DEBUG_INFO("chargingSchedulePeriodCount=%d\n",chargingSchedulePeriodCount);
|
|
|
- //DEBUG_INFO("handleSetChargingProfileRequest -13 -1\n");
|
|
|
//where = payload;
|
|
|
int templength = 0;
|
|
|
//int searchstart = 0;
|
|
@@ -9071,7 +9166,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
templength = templength + strlen("limit")+2+c;
|
|
|
- //DEBUG_INFO("handleSetChargingProfileRequest -13 -3\n");
|
|
|
+
|
|
|
//****************numberPhases*******************/
|
|
|
loc = strstr(tempChargingProfile + templength, "numberPhases");
|
|
|
if(loc != NULL)
|
|
@@ -9103,7 +9198,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
//where = loc;
|
|
|
|
|
|
}
|
|
|
- //DEBUG_INFO("handleSetChargingProfileRequest -14\n");
|
|
|
+
|
|
|
//****************chargingSchedulePeriod count end*******************/
|
|
|
|
|
|
|
|
@@ -9191,6 +9286,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
|
+#if 0
|
|
|
switch(connectorIdInt)
|
|
|
{
|
|
|
case 0:
|
|
@@ -9209,6 +9305,9 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
strcpy(filename, TxDefaultProfile_0_JSON );
|
|
|
break;
|
|
|
}
|
|
|
+#endif
|
|
|
+ memset(filename, 0, sizeof filename);
|
|
|
+ sprintf(filename, "/Storage/OCPP/TxDefaultProfile_%d.json", connectorIdInt);
|
|
|
|
|
|
fptr1 = fopen(filename, "r");
|
|
|
if (!fptr1)
|
|
@@ -9301,7 +9400,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+#if 0
|
|
|
switch(connectorIdInt)
|
|
|
{
|
|
|
case 0:
|
|
@@ -9319,6 +9418,8 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
strcpy(filename, TxProfile_1_JSON);
|
|
|
break;
|
|
|
}
|
|
|
+#endif
|
|
|
+ sprintf(filename, "/Storage/OCPP/TxProfile_%d.json", connectorIdInt);
|
|
|
|
|
|
fptr1 = fopen(filename, "r");
|
|
|
if (!fptr1)
|
|
@@ -9353,7 +9454,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
|
|
|
- // Check all Charging Files
|
|
|
+ //------------------------------Satrt: Check Configuration Key "MaxChargingProfilesInstalled" Logic---------------------------------------//
|
|
|
{
|
|
|
int i = 0;
|
|
|
char fnametemp[200]={0};
|
|
@@ -9463,7 +9564,10 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
goto end;
|
|
|
}
|
|
|
|
|
|
- }// End connectorIsNULL is TRUE
|
|
|
+ }
|
|
|
+ //------------------------------End: Check Configuration Key "MaxChargingProfilesInstalled" Logic---------------------------------------//
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
//**********************************Write to File********************************************************/
|
|
@@ -15405,7 +15509,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
|
|
|
|
|
|
//****************************TxDefaultProfile************************************************/
|
|
|
-
|
|
|
+#if 0
|
|
|
switch(gunindex + 1)
|
|
|
{
|
|
|
case 0:
|
|
@@ -15424,6 +15528,9 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
strcpy(fname, TxDefaultProfile_1_JSON );
|
|
|
break;
|
|
|
}
|
|
|
+#endif
|
|
|
+ memset(fname, 0, sizeof fname);
|
|
|
+ sprintf(fname, "/Storage/OCPP/TxDefaultProfile_%d.json", (gunindex + 1));
|
|
|
|
|
|
TxDefaultProfileFileIsNull=TRUE;
|
|
|
if((access(fname,F_OK))!=-1)
|
|
@@ -15838,6 +15945,7 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
}// the end of ACCESS TxDefaultProfile
|
|
|
|
|
|
//****************************TxProfile************************************************/
|
|
|
+#if 0
|
|
|
switch(gunindex + 1)
|
|
|
{
|
|
|
case 0:
|
|
@@ -15855,6 +15963,9 @@ void GetChargingProfileRequest(int gunindex)
|
|
|
strcpy(fname, TxProfile_1_JSON );
|
|
|
break;
|
|
|
}
|
|
|
+#endif
|
|
|
+ memset(fname, 0, sizeof fname);
|
|
|
+ sprintf(fname, "/Storage/OCPP/TxProfile_%d.json", (gunindex + 1));
|
|
|
|
|
|
TxProfileIsNull=TRUE;
|
|
|
if((access(fname,F_OK))!=-1)
|