Commit | Line | Data |
---|---|---|
5cc4b63b | 1 | import { JsonType } from '../../types/JsonType'; |
c0560973 | 2 | import { RequestCommand } from '../../types/ocpp/Requests'; |
8114d10e | 3 | import type ChargingStation from '../ChargingStation'; |
c0560973 | 4 | |
e3018bc4 JB |
5 | const moduleName = 'OCPPResponseService'; |
6 | ||
c0560973 | 7 | export 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 | } |