import {
DiagnosticsStatusNotificationRequest,
OCPP16BootNotificationRequest,
+ OCPP16DataTransferRequest,
OCPP16HeartbeatRequest,
OCPP16RequestCommand,
OCPP16StatusNotificationRequest,
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';
)
) as JSONSchemaType<OCPP16StopTransactionRequest>,
],
+ [
+ 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<OCPP16DataTransferRequest>,
+ ],
]);
this.buildRequestPayload.bind(this);
this.validatePayload.bind(this);
commandParams?: JsonType,
params?: RequestParams
): Promise<ResponseType> {
- if (OCPP16ServiceUtils.isRequestCommandSupported(commandName, chargingStation)) {
+ if (OCPP16ServiceUtils.isRequestCommandSupported(chargingStation, commandName) === true) {
const requestPayload = this.buildRequestPayload<RequestType>(
chargingStation,
commandName,
),
}),
} 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(