X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16RequestService.ts;h=a4b1275f5a4c1474ccb0ac2e447a354d77eb64a8;hb=2040a613fd09c3476094e671a103131b99d08a8b;hp=d840e5e97a23ca788d7a922697e471215ae60755;hpb=ed3d28080b6597ba2f728d625e34ce05aea49d06;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index d840e5e9..a4b1275f 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -12,6 +12,7 @@ import type { OCPP16MeterValuesRequest } from '../../../types/ocpp/1.6/MeterValu import { DiagnosticsStatusNotificationRequest, OCPP16BootNotificationRequest, + OCPP16DataTransferRequest, OCPP16HeartbeatRequest, OCPP16RequestCommand, OCPP16StatusNotificationRequest, @@ -27,7 +28,6 @@ import Constants from '../../../utils/Constants'; import logger from '../../../utils/Logger'; import Utils from '../../../utils/Utils'; import type ChargingStation from '../../ChargingStation'; -import { ChargingStationUtils } from '../../ChargingStationUtils'; import OCPPRequestService from '../OCPPRequestService'; import type OCPPResponseService from '../OCPPResponseService'; import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; @@ -139,6 +139,18 @@ export default class OCPP16RequestService extends OCPPRequestService { ) ) as JSONSchemaType, ], + [ + OCPP16RequestCommand.DATA_TRANSFER, + JSON.parse( + fs.readFileSync( + path.resolve( + path.dirname(fileURLToPath(import.meta.url)), + '../../../assets/json-schemas/ocpp/1.6/DataTransfer.json' + ), + 'utf8' + ) + ) as JSONSchemaType, + ], ]); this.buildRequestPayload.bind(this); this.validatePayload.bind(this); @@ -150,7 +162,7 @@ export default class OCPP16RequestService extends OCPPRequestService { commandParams?: JsonType, params?: RequestParams ): Promise { - if (OCPP16ServiceUtils.isRequestCommandSupported(commandName, chargingStation)) { + if (OCPP16ServiceUtils.isRequestCommandSupported(chargingStation, commandName) === true) { const requestPayload = this.buildRequestPayload( chargingStation, commandName, @@ -269,6 +281,8 @@ export default class OCPP16RequestService extends OCPPRequestService { ), }), } as unknown as Request; + case OCPP16RequestCommand.DATA_TRANSFER: + return commandParams as unknown as Request; default: // OCPPError usage here is debatable: it's an error in the OCPP stack but not targeted to sendError(). throw new OCPPError(