From: Jérôme Benoit Date: Sun, 2 Oct 2022 21:14:24 +0000 (+0200) Subject: Make OCPP command clear cache code clear the authorization tags X-Git-Tag: v1.1.75~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a36bad10340be6ff3ac66b8cedf136d36778c857;p=e-mobility-charging-stations-simulator.git Make OCPP command clear cache code clear the authorization tags cache Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AuthorizedTagsCache.ts b/src/charging-station/AuthorizedTagsCache.ts index 747b7593..0f702047 100644 --- a/src/charging-station/AuthorizedTagsCache.ts +++ b/src/charging-station/AuthorizedTagsCache.ts @@ -64,6 +64,10 @@ export default class AuthorizedTagsCache { return this.getTags(file); } + public deleteAuthorizedTags(file: string): boolean { + return this.deleteTags(file); + } + private hasTags(file: string): boolean { return this.tagsCaches.has(file); } diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index ceaea14e..f5779ab2 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -392,7 +392,10 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer return Constants.OCPP_RESPONSE_ACCEPTED; } - private handleRequestClearCache(): DefaultResponse { + private handleRequestClearCache(chargingStation: ChargingStation): DefaultResponse { + chargingStation.authorizedTagsCache.deleteAuthorizedTags( + ChargingStationUtils.getAuthorizationFile(chargingStation.stationInfo) + ); return Constants.OCPP_RESPONSE_ACCEPTED; } @@ -588,11 +591,11 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer commandPayload: ClearChargingProfileRequest ): ClearChargingProfileResponse { if ( - !OCPP16ServiceUtils.checkFeatureProfile( + OCPP16ServiceUtils.checkFeatureProfile( chargingStation, OCPP16SupportedFeatureProfiles.SmartCharging, OCPP16IncomingRequestCommand.CLEAR_CHARGING_PROFILE - ) + ) === false ) { return Constants.OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN; }