import {
IncomingRequestCommand,
RequestCommand,
+ RequestParams,
ResponseType,
- SendParams,
} from '../../types/ocpp/Requests';
import type ChargingStation from '../ChargingStation';
) {
this.chargingStation = chargingStation;
this.ocppResponseService = ocppResponseService;
- this.sendMessageHandler.bind(this);
+ this.requestHandler.bind(this);
this.sendResult.bind(this);
this.sendError.bind(this);
}
messageId: string,
messagePayload: JsonType,
commandName: RequestCommand,
- params: SendParams = {
+ params: RequestParams = {
skipBufferingOnError: false,
triggerMessage: false,
}
messagePayload: JsonType | OCPPError,
messageType: MessageType,
commandName?: RequestCommand | IncomingRequestCommand,
- params: SendParams = {
+ params: RequestParams = {
skipBufferingOnError: false,
triggerMessage: false,
}
(!this.chargingStation.getOcppStrictCompliance() &&
this.chargingStation.isInUnknownState()) ||
this.chargingStation.isInAcceptedState() ||
- (this.chargingStation.isInPendingState() && params.triggerMessage)
+ (this.chargingStation.isInPendingState() &&
+ (params.triggerMessage || messageType === MessageType.CALL_RESULT_MESSAGE))
) {
// eslint-disable-next-line @typescript-eslint/no-this-alias
const self = this;
}
// Handle the request's response
try {
- await self.ocppResponseService.handleResponse(
+ await self.ocppResponseService.responseHandler(
commandName as RequestCommand,
payload,
requestPayload
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
- public abstract sendMessageHandler<Request extends JsonType, Response extends JsonType>(
+ public abstract requestHandler<Request extends JsonType, Response extends JsonType>(
commandName: RequestCommand,
commandParams?: JsonType,
- params?: SendParams
+ params?: RequestParams
): Promise<Response>;
}