- public abstract handleResponse(commandName: RequestCommand, payload: JsonType | string, requestPayload: JsonType): Promise<void>;
+ public static getInstance<T extends OCPPResponseService>(
+ 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<void>;