| 1 | import ChargingStation from '../ChargingStation'; |
| 2 | import { IncomingRequestCommand } from '../../types/ocpp/Requests'; |
| 3 | import logger from '../../utils/Logger'; |
| 4 | |
| 5 | export default abstract class OCPPIncomingRequestService { |
| 6 | protected chargingStation: ChargingStation; |
| 7 | |
| 8 | constructor(chargingStation: ChargingStation) { |
| 9 | this.chargingStation = chargingStation; |
| 10 | } |
| 11 | |
| 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 | |
| 17 | public abstract handleRequest(messageId: string, commandName: IncomingRequestCommand, commandPayload: Record<string, unknown>): Promise<void>; |
| 18 | } |