import { OCPP16ChargePointStatus } from '../../../types';
import { OCPPConstants } from '../internal';
-type Transition = { from?: OCPP16ChargePointStatus; to: OCPP16ChargePointStatus };
+type Transition = Readonly<{
+ from?: OCPP16ChargePointStatus;
+ to: OCPP16ChargePointStatus;
+}>;
export class OCPP16Constants extends OCPPConstants {
- static readonly ChargePointStatusChargingStationTransitions: Transition[] = [
- { to: OCPP16ChargePointStatus.Available },
- // { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Faulted },
- { to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Available },
- // { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Unavailable },
- { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Faulted },
- { to: OCPP16ChargePointStatus.Faulted },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Available },
- { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Unavailable },
- // { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted },
- ];
+ static readonly ChargePointStatusChargingStationTransitions: Readonly<Transition[]> =
+ Object.freeze([
+ { to: OCPP16ChargePointStatus.Available },
+ // { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
+ { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Unavailable },
+ { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Faulted },
+ { to: OCPP16ChargePointStatus.Unavailable },
+ { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Available },
+ // { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Unavailable },
+ { from: OCPP16ChargePointStatus.Unavailable, to: OCPP16ChargePointStatus.Faulted },
+ { to: OCPP16ChargePointStatus.Faulted },
+ { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Available },
+ { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Unavailable },
+ // { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted },
+ ]);
- static readonly ChargePointStatusConnectorTransitions: Transition[] = [
+ static readonly ChargePointStatusConnectorTransitions: Readonly<Transition[]> = Object.freeze([
{ to: OCPP16ChargePointStatus.Available },
// { from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Available },
{ from: OCPP16ChargePointStatus.Available, to: OCPP16ChargePointStatus.Preparing },
{ from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Reserved },
{ from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Unavailable },
// { from: OCPP16ChargePointStatus.Faulted, to: OCPP16ChargePointStatus.Faulted },
- ];
+ ]);
}
import { OCPP20ConnectorStatusEnumType } from '../../../types';
import { OCPPConstants } from '../internal';
-type Transition = { from?: OCPP20ConnectorStatusEnumType; to: OCPP20ConnectorStatusEnumType };
+type Transition = Readonly<{
+ from?: OCPP20ConnectorStatusEnumType;
+ to: OCPP20ConnectorStatusEnumType;
+}>;
export class OCPP20Constants extends OCPPConstants {
- static readonly ChargingStationStatusTransitions: Transition[] = [
+ static readonly ChargingStationStatusTransitions: Readonly<Transition[]> = Object.freeze([
{ to: OCPP20ConnectorStatusEnumType.Available },
// { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Available },
{
{ from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Available },
{ from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Unavailable },
// { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Faulted },
- ];
+ ]);
- static readonly ConnectorStatusTransitions: Transition[] = [
+ static readonly ConnectorStatusTransitions: Readonly<Transition[]> = Object.freeze([
{ to: OCPP20ConnectorStatusEnumType.Available },
// { from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Available },
{ from: OCPP20ConnectorStatusEnumType.Available, to: OCPP20ConnectorStatusEnumType.Occupied },
{ from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Reserved },
{ from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Unavailable },
// { from: OCPP20ConnectorStatusEnumType.Faulted, to: OCPP20ConnectorStatusEnumType.Faulted },
- ];
+ ]);
}