logger.debug(
`${this.logPrefix()} << Command '${
requestCommandName ?? Constants.UNKNOWN_COMMAND
- }' received error payload: ${JSON.stringify(request)}`
+ }' received error response payload: ${JSON.stringify(request)}`
);
errorCallback(new OCPPError(errorType, errorMessage, requestCommandName, errorDetails));
break;
try {
chargingStation.wsConnection.send(messageToSend);
logger.debug(
- `${chargingStation.logPrefix()} >> Command '${commandName}' sent ${this.getMessageTypeString(
+ `${chargingStation.logPrefix()} >> Command '${commandName}' sent ${OCPPServiceUtils.getMessageTypeString(
messageType
)} payload: ${messageToSend}`
);
} catch (error) {
logger.error(
- `${chargingStation.logPrefix()} >> Command '${commandName}' failed to send ${this.getMessageTypeString(
+ `${chargingStation.logPrefix()} >> Command '${commandName}' failed to send ${OCPPServiceUtils.getMessageTypeString(
messageType
)} payload: ${messageToSend}:`,
error
);
}
logger.error(
- `${chargingStation.logPrefix()} Error occurred at ${self.getMessageTypeString(
+ `${chargingStation.logPrefix()} Error occurred at ${OCPPServiceUtils.getMessageTypeString(
messageType
)} command ${commandName} with PDU %j:`,
messagePayload,
return messageToSend;
}
- private getMessageTypeString(messageType: MessageType): string {
- switch (messageType) {
- case MessageType.CALL_MESSAGE:
- return 'request';
- case MessageType.CALL_RESULT_MESSAGE:
- return 'response';
- case MessageType.CALL_ERROR_MESSAGE:
- return 'error';
- }
- }
-
private handleSendMessageError(
chargingStation: ChargingStation,
commandName: RequestCommand | IncomingRequestCommand,
import { StandardParametersKey } from '../../types/ocpp/Configuration';
import type { ConnectorStatusEnum } from '../../types/ocpp/ConnectorStatusEnum';
import { ErrorType } from '../../types/ocpp/ErrorType';
+import { MessageType } from '../../types/ocpp/MessageType';
import { MeterValueMeasurand, type MeterValuePhase } from '../../types/ocpp/MeterValues';
import { OCPPVersion } from '../../types/ocpp/OCPPVersion';
import {
return ErrorType.FORMAT_VIOLATION;
}
+ public static getMessageTypeString(messageType: MessageType): string {
+ switch (messageType) {
+ case MessageType.CALL_MESSAGE:
+ return 'request';
+ case MessageType.CALL_RESULT_MESSAGE:
+ return 'response';
+ case MessageType.CALL_ERROR_MESSAGE:
+ return 'error';
+ }
+ }
+
public static isRequestCommandSupported(
chargingStation: ChargingStation,
command: RequestCommand