|
@@ -13866,7 +13866,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");
|
|
@@ -13981,38 +13981,41 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
|
|
|
- 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));
|
|
|
|
|
|
- goto end;
|
|
|
+ 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;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- 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;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -14057,7 +14060,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
profileQuantity += 1;
|
|
|
}
|
|
|
else
|
|
|
- isReplaceable = TRUE;
|
|
|
+ replaceableProfileCnt += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -14112,7 +14115,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
tmpProfileQuantity += 1;
|
|
|
}
|
|
|
else
|
|
|
- isReplaceable = TRUE;
|
|
|
+ replaceableProfileCnt += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -14153,7 +14156,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
profileQuantity += 1;
|
|
|
}
|
|
|
else
|
|
|
- isReplaceable = TRUE;
|
|
|
+ replaceableProfileCnt += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -14348,7 +14351,7 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
profileQuantity += 1;
|
|
|
}
|
|
|
else
|
|
|
- isReplaceable = TRUE;
|
|
|
+ replaceableProfileCnt += 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -14441,11 +14444,26 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
}
|
|
|
|
|
|
DEBUG_INFO("All purpose profile quantity: %d\n", profileQuantity);
|
|
|
- if((profileQuantity >= atoi((const char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData)) && (isReplaceable != TRUE))
|
|
|
+ DEBUG_INFO("Replaceable profile quantity: %d\n", replaceableProfileCnt);
|
|
|
+
|
|
|
+
|
|
|
+ if((SetProfileReq.ConnectorId > 0) || (strcmp((char*)SetProfileReq.ChargingProfile.ChargingProfilePurpose, ChargingProfilePurposeTypeStr[ChargePointMaxProfile]) == 0))
|
|
|
{
|
|
|
- sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected]);
|
|
|
- DEBUG_WARN("Total profile quantify is over installed limit %s.\n", ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData);
|
|
|
- goto end;
|
|
|
+ if((profileQuantity-replaceableProfileCnt) >= atoi((const char*)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData))
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected]);
|
|
|
+ DEBUG_WARN("Total profile quantify is over installed limit %s.\n", ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData);
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if((profileQuantity+gunTotalNumber-replaceableProfileCnt) > atoi((const char*)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData))
|
|
|
+ {
|
|
|
+ sprintf(comfirmstr, "%s", ChargingProfileStatusStr[ChargingProfileStatus_Rejected]);
|
|
|
+ DEBUG_WARN("Total profile quantify is over installed limit %s.\n", ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[MaxChargingProfilesInstalled].ItemData);
|
|
|
+ goto end;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -20244,6 +20262,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;
|
|
|
}
|
|
|
|