|
@@ -13372,7 +13372,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
char rmFileCmd[128]={0};
|
|
|
|
|
|
int profileQuantity = 0;
|
|
|
- int isReplaceable = FALSE;
|
|
|
+ int replaceableProfileCnt = 0;
|
|
|
json_object *SetChargingProfile;
|
|
|
|
|
|
DEBUG_INFO("handleSetChargingProfileRequest\n");
|
|
@@ -13486,43 +13486,45 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
// Check invalid limit
|
|
|
- if(ShmSysConfigAndInfo->SysConfig.ModelName[0] == 'A')
|
|
|
+ if(strcmp((char*)SetProfileReq.ChargingProfile.ChargingProfilePurpose, ChargingProfilePurposeTypeStr[ChargePointMaxProfile]) != 0)
|
|
|
{
|
|
|
- for(uint8_t idxPeriod=0;idxPeriod<chargingSchedulePeriodCount;idxPeriod++)
|
|
|
+ if(ShmSysConfigAndInfo->SysConfig.ModelName[0] == 'A')
|
|
|
{
|
|
|
-
|
|
|
- if(((0 < SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit) && (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit < (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='A'?6:6*220*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases)))) ||
|
|
|
- (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit > (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='W'?modelnameInfo.ratedPower:ShmSysConfigAndInfo->SysConfig.RatingCurrent)))
|
|
|
+ for(uint8_t idxPeriod=0;idxPeriod<chargingSchedulePeriodCount;idxPeriod++)
|
|
|
{
|
|
|
- sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
|
- DEBUG_WARN("Profile period-%02d is invalid limit: %.2f %s with phase %d.\n", idxPeriod,
|
|
|
- SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit,
|
|
|
- SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit,
|
|
|
- (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases));
|
|
|
+ if(((0 < SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit) && (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit < (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='A'?6:6*220*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases)))) ||
|
|
|
+ (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit > (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='W'?modelnameInfo.ratedPower:ShmSysConfigAndInfo->SysConfig.RatingCurrent)))
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
|
+ DEBUG_WARN("Profile period-%02d is invalid limit: %.2f %s with phase %d.\n", idxPeriod,
|
|
|
+ SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit,
|
|
|
+ SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit,
|
|
|
+ (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases));
|
|
|
|
|
|
- goto end;
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- for(uint8_t idxPeriod=0;idxPeriod<chargingSchedulePeriodCount;idxPeriod++)
|
|
|
+ else
|
|
|
{
|
|
|
-
|
|
|
- if((SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='W'?1:220*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases)) > modelnameInfo.ratedPower) ||
|
|
|
- (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='W'?1:220*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases)) < (modelnameInfo.ratedPower*0.01)))
|
|
|
+ for(uint8_t idxPeriod=0;idxPeriod<chargingSchedulePeriodCount;idxPeriod++)
|
|
|
{
|
|
|
- sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
|
- DEBUG_WARN("Profile period-%02d is invalid limit: %.2f %s with phase %d.\n", idxPeriod,
|
|
|
- SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit,
|
|
|
- SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit,
|
|
|
- (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases));
|
|
|
+ if((SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='W'?1:220*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases)) > modelnameInfo.ratedPower) ||
|
|
|
+ (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit[0]=='W'?1:220*(SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases)) < (modelnameInfo.ratedPower*0.01)))
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
|
+ DEBUG_WARN("Profile period-%02d is invalid limit: %.2f %s with phase %d.\n", idxPeriod,
|
|
|
+ SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit,
|
|
|
+ SetProfileReq.ChargingProfile.ChargingSchedule.ChargingRateUnit,
|
|
|
+ (SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases==0?3:SetProfileReq.ChargingProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases));
|
|
|
|
|
|
- goto end;
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// Profile purpose info check
|
|
|
if(strcmp((char*)SetProfileReq.ChargingProfile.ChargingProfilePurpose, ChargingProfilePurposeTypeStr[ChargePointMaxProfile]) == 0)
|
|
|
{
|
|
@@ -13562,7 +13564,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
profileQuantity += 1;
|
|
|
}
|
|
|
else
|
|
|
- isReplaceable = TRUE;
|
|
|
+ replaceableProfileCnt += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -13616,7 +13618,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
tmpProfileQuantity += 1;
|
|
|
}
|
|
|
else
|
|
|
- isReplaceable = TRUE;
|
|
|
+ replaceableProfileCnt += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -13657,7 +13659,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
profileQuantity += 1;
|
|
|
}
|
|
|
else
|
|
|
- isReplaceable = TRUE;
|
|
|
+ replaceableProfileCnt += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -13849,7 +13851,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
profileQuantity += 1;
|
|
|
}
|
|
|
else
|
|
|
- isReplaceable = TRUE;
|
|
|
+ replaceableProfileCnt += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -13941,10 +13943,26 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
DEBUG_INFO("All purpose profile quantity: %d\n", profileQuantity);
|
|
|
- if((profileQuantity > atoi((const char *)ShmOCPP16DataPH->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData)) && (isReplaceable != TRUE))
|
|
|
+ DEBUG_INFO("Replaceable profile quantity: %d\n", replaceableProfileCnt);
|
|
|
+
|
|
|
+ // To check total Profile quantity
|
|
|
+ if((SetProfileReq.ConnectorId > 0) || (strcmp((char*)SetProfileReq.ChargingProfile.ChargingProfilePurpose, ChargingProfilePurposeTypeStr[ChargePointMaxProfile]) == 0))
|
|
|
{
|
|
|
- sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected] );
|
|
|
- goto end;
|
|
|
+ if((profileQuantity-replaceableProfileCnt) >= atoi((const char*)ShmOCPP16DataPH->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData))
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected]);
|
|
|
+ DEBUG_WARN("Total profile quantify is over installed limit %s.\n", ShmOCPP16DataPH->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData);
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if((profileQuantity+gunTotalNumber-replaceableProfileCnt) > atoi((const char*)ShmOCPP16DataPH->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData))
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected]);
|
|
|
+ DEBUG_WARN("Total profile quantify is over installed limit %s.\n", ShmOCPP16DataPH->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData);
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//------------------------------End: Check Configuration Key "MaxChargingProfilesInstalled" Logic---------------------------------------//
|
|
@@ -19523,6 +19541,12 @@ int httpUploadFile(char *location, char *path, char *filename,char *url)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if(systemresult != 1)
|
|
|
+ {
|
|
|
+ DEBUG_WARN("PHP PUT upload fail.\n");
|
|
|
+ return FALSE;
|
|
|
+ }
|
|
|
+
|
|
|
return TRUE;
|
|
|
}
|
|
|
|