import {
type BootNotificationRequest,
type DataTransferRequest,
+ type DiagnosticsStatusNotificationRequest,
+ type FirmwareStatusNotificationRequest,
type HeartbeatRequest,
type MeterValuesRequest,
RequestCommand,
type BootNotificationResponse,
type DataTransferResponse,
DataTransferStatus,
+ type DiagnosticsStatusNotificationResponse,
+ type FirmwareStatusNotificationResponse,
type HeartbeatResponse,
type MeterValuesResponse,
RegistrationStatusEnumType,
| StatusNotificationResponse
| HeartbeatResponse
| MeterValuesResponse
- | DataTransferResponse;
+ | DataTransferResponse
+ | DiagnosticsStatusNotificationResponse
+ | FirmwareStatusNotificationResponse;
type CommandHandler = (
requestPayload?: BroadcastChannelRequestPayload
DataTransferResponse
>(this.chargingStation, RequestCommand.DATA_TRANSFER, requestPayload),
],
+ [
+ BroadcastChannelProcedureName.DIAGNOSTICS_STATUS_NOTIFICATION,
+ async (requestPayload?: BroadcastChannelRequestPayload) =>
+ this.chargingStation.ocppRequestService.requestHandler<
+ DiagnosticsStatusNotificationRequest,
+ DiagnosticsStatusNotificationResponse
+ >(this.chargingStation, RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION, requestPayload),
+ ],
+ [
+ BroadcastChannelProcedureName.FIRMWARE_STATUS_NOTIFICATION,
+ async (requestPayload?: BroadcastChannelRequestPayload) =>
+ this.chargingStation.ocppRequestService.requestHandler<
+ FirmwareStatusNotificationRequest,
+ FirmwareStatusNotificationResponse
+ >(this.chargingStation, RequestCommand.FIRMWARE_STATUS_NOTIFICATION, requestPayload),
+ ],
]);
this.chargingStation = chargingStation;
this.onmessage = this.requestHandler.bind(this) as (message: MessageEvent) => void;
let commandResponse: CommandResponse | void;
try {
commandResponse = await this.commandHandler(command, requestPayload);
- if (commandResponse === undefined || commandResponse === null) {
+ if (
+ commandResponse === undefined ||
+ commandResponse === null ||
+ Utils.isEmptyObject(commandResponse as CommandResponse)
+ ) {
responsePayload = {
hashId: this.chargingStation.stationInfo.hashId,
status: ResponseStatus.SUCCESS,