Add GetDiagnostics command support
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPIncomingRequestService.ts
CommitLineData
c0560973
JB
1import ChargingStation from '../ChargingStation';
2import { IncomingRequestCommand } from '../../types/ocpp/Requests';
47e22477 3import logger from '../../utils/Logger';
c0560973
JB
4
5export default abstract class OCPPIncomingRequestService {
6 protected chargingStation: ChargingStation;
7
8 constructor(chargingStation: ChargingStation) {
9 this.chargingStation = chargingStation;
10 }
11
47e22477
JB
12 public handleIncomingRequestError(commandName: IncomingRequestCommand, error: Error): void {
13 logger.error(this.chargingStation.logPrefix() + ' Incoming request command ' + commandName + ' error: %j', error);
14 throw error;
15 }
16
c0560973
JB
17 public abstract handleRequest(messageId: string, commandName: IncomingRequestCommand, commandPayload: Record<string, unknown>): Promise<void>;
18}