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 JB |
4 | |
5 | export default abstract class OCPPResponseService { | |
08f130a0 | 6 | private static instance: OCPPResponseService | null = null; |
10068088 | 7 | |
08f130a0 JB |
8 | protected constructor() { |
9 | // This is intentional | |
c0560973 JB |
10 | } |
11 | ||
08f130a0 JB |
12 | public static getInstance<T extends OCPPResponseService>(this: new () => T): T { |
13 | if (!OCPPResponseService.instance) { | |
14 | OCPPResponseService.instance = new this(); | |
9f2e3130 | 15 | } |
08f130a0 | 16 | return OCPPResponseService.instance as T; |
9f2e3130 JB |
17 | } |
18 | ||
f7f98c68 | 19 | public abstract responseHandler( |
08f130a0 | 20 | chargingStation: ChargingStation, |
e7aeea18 | 21 | commandName: RequestCommand, |
5cc4b63b JB |
22 | payload: JsonType, |
23 | requestPayload: JsonType | |
e7aeea18 | 24 | ): Promise<void>; |
c0560973 | 25 | } |