e2cad6451d1c08959e19fb9d33a6e62e3347cd87
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPResponseService.ts
1 import { JsonType } from '../../types/JsonType';
2 import { RequestCommand } from '../../types/ocpp/Requests';
3 import type ChargingStation from '../ChargingStation';
4
5 const moduleName = 'OCPPResponseService';
6
7 export default abstract class OCPPResponseService {
8 private static instance: OCPPResponseService | null = null;
9
10 protected constructor() {
11 // This is intentional
12 }
13
14 public static getInstance<T extends OCPPResponseService>(this: new () => T): T {
15 if (!OCPPResponseService.instance) {
16 OCPPResponseService.instance = new this();
17 }
18 return OCPPResponseService.instance as T;
19 }
20
21 public abstract responseHandler(
22 chargingStation: ChargingStation,
23 commandName: RequestCommand,
24 payload: JsonType,
25 requestPayload: JsonType
26 ): Promise<void>;
27 }