X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2FOCPPResponseService.ts;h=311d62e393034cb449b79910363abfb332a51af9;hb=a95873d8d308a20a7151346ac70d9a551f1a06f5;hp=c0dd3f767ea14ff8546195556c48daf3aec3dc0c;hpb=9f2e313013116428f5bce2be59e2f5c07502c026;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index c0dd3f76..311d62e3 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -3,19 +3,30 @@ import { JsonType } from '../../types/JsonType'; import { RequestCommand } from '../../types/ocpp/Requests'; export default abstract class OCPPResponseService { - private static readonly instances: Map = new Map(); + private static readonly instances: Map = new Map< + string, + OCPPResponseService + >(); + protected readonly chargingStation: ChargingStation; protected constructor(chargingStation: ChargingStation) { this.chargingStation = chargingStation; } - public static getInstance(this: new (chargingStation: ChargingStation) => T, chargingStation: ChargingStation): T { + public static getInstance( + this: new (chargingStation: ChargingStation) => T, + chargingStation: ChargingStation + ): T { if (!OCPPResponseService.instances.has(chargingStation.id)) { OCPPResponseService.instances.set(chargingStation.id, new this(chargingStation)); } return OCPPResponseService.instances.get(chargingStation.id) as T; } - public abstract handleResponse(commandName: RequestCommand, payload: JsonType | string, requestPayload: JsonType): Promise; + public abstract handleResponse( + commandName: RequestCommand, + payload: JsonType | string, + requestPayload: JsonType + ): Promise; }