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
<
11 protected readonly chargingStation
: ChargingStation
;
13 protected constructor(chargingStation
: ChargingStation
) {
14 this.chargingStation
= chargingStation
;
17 public static getInstance
<T
extends OCPPResponseService
>(
18 this: new (chargingStation
: ChargingStation
) => T
,
19 chargingStation
: ChargingStation
21 if (!OCPPResponseService
.instances
.has(chargingStation
.hashId
)) {
22 OCPPResponseService
.instances
.set(chargingStation
.hashId
, new this(chargingStation
));
24 return OCPPResponseService
.instances
.get(chargingStation
.hashId
) as T
;
27 public abstract responseHandler(
28 commandName
: RequestCommand
,
29 payload
: JsonType
| string,
30 requestPayload
: JsonType