1 import type ChargingStation from
'../ChargingStation';
2 import { JsonType
} from
'../../types/JsonType';
3 import { RequestCommand
} from
'../../types/ocpp/Requests';
5 export default abstract class OCPPResponseService
{
6 private static readonly instances
: Map
<string, OCPPResponseService
> = new Map
<
10 protected readonly chargingStation
: ChargingStation
;
12 protected constructor(chargingStation
: ChargingStation
) {
13 this.chargingStation
= chargingStation
;
16 public static getInstance
<T
extends OCPPResponseService
>(
17 this: new (chargingStation
: ChargingStation
) => T
,
18 chargingStation
: ChargingStation
20 if (!OCPPResponseService
.instances
.has(chargingStation
.id
)) {
21 OCPPResponseService
.instances
.set(chargingStation
.id
, new this(chargingStation
));
23 return OCPPResponseService
.instances
.get(chargingStation
.id
) as T
;
26 public abstract handleResponse(
27 commandName
: RequestCommand
,
28 payload
: JsonType
| string,
29 requestPayload
: JsonType