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