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
connectorId: number,
status: ConnectorStatusEnum
): StatusNotificationRequest {
- switch (chargingStation.stationInfo.ocppVersion) {
+ switch (chargingStation.stationInfo.ocppVersion ?? OCPPVersion.VERSION_16) {
case OCPPVersion.VERSION_16:
return {
connectorId,
connectorId,
evseId: connectorId,
} as OCPP20StatusNotificationRequest;
+ default:
+ throw new BaseError('Cannot build status notification payload: OCPP version not supported');
}
}