| BootNotificationResponse
| StatusNotificationResponse
| HeartbeatResponse
- | MeterValuesResponse
- | DataTransferResponse
- | DiagnosticsStatusNotificationResponse
- | FirmwareStatusNotificationResponse;
+ | DataTransferResponse;
type CommandHandler = (
requestPayload?: BroadcastChannelRequestPayload,
RequestCommand.STOP_TRANSACTION,
{
meterStop: this.chargingStation.getEnergyActiveImportRegisterByTransactionId(
- requestPayload.transactionId,
+ requestPayload!.transactionId!,
true,
),
...requestPayload,
// FIXME: Implement OCPP version agnostic helpers
OCPP16ServiceUtils.buildMeterValue(
this.chargingStation,
- requestPayload.connectorId,
- this.chargingStation.getConnectorStatus(requestPayload.connectorId)
- ?.transactionId,
+ requestPayload!.connectorId!,
+ this.chargingStation.getConnectorStatus(requestPayload!.connectorId!)!
+ .transactionId!,
configuredMeterValueSampleInterval
? convertToInt(configuredMeterValueSampleInterval.value) * 1000
: Constants.DEFAULT_METER_VALUES_INTERVAL,
);
return;
}
- let responsePayload: BroadcastChannelResponsePayload;
- let commandResponse: CommandResponse | void;
+ let responsePayload: BroadcastChannelResponsePayload | undefined;
+ let commandResponse: CommandResponse | void | undefined;
try {
commandResponse = await this.commandHandler(command, requestPayload);
if (isNullOrUndefined(commandResponse) || isEmptyObject(commandResponse as CommandResponse)) {
errorDetails: (error as OCPPError).details,
};
} finally {
- this.sendResponse([uuid, responsePayload]);
+ this.sendResponse([uuid, responsePayload!]);
}
}
): Promise<CommandResponse | void> {
if (this.commandHandlers.has(command) === true) {
this.cleanRequestPayload(command, requestPayload);
- return this.commandHandlers.get(command)(requestPayload);
+ return this.commandHandlers.get(command)!(requestPayload);
}
throw new BaseError(`Unknown worker broadcast channel command: ${command}`);
}