- public abstract handleResponse(commandName: RequestCommand, payload: Record<string, unknown> | string, requestPayload: Record<string, unknown>): Promise<void>;
+ public static getInstance<T extends OCPPResponseService>(
+ this: new (chargingStation: ChargingStation) => T,
+ chargingStation: ChargingStation
+ ): T {
+ if (!OCPPResponseService.instances.has(chargingStation.hashId)) {
+ OCPPResponseService.instances.set(chargingStation.hashId, new this(chargingStation));
+ }
+ return OCPPResponseService.instances.get(chargingStation.hashId) as T;
+ }
+
+ public abstract responseHandler(
+ commandName: RequestCommand,
+ payload: JsonType,
+ requestPayload: JsonType
+ ): Promise<void>;