| 1 | import { |
| 2 | AvailabilityStatus, |
| 3 | ChargingProfileStatus, |
| 4 | ClearChargingProfileStatus, |
| 5 | ConfigurationStatus, |
| 6 | DataTransferStatus, |
| 7 | GenericStatus, |
| 8 | MeterValueMeasurand, |
| 9 | ReservationStatus, |
| 10 | TriggerMessageStatus, |
| 11 | UnlockStatus |
| 12 | } from '../../types/index.js' |
| 13 | import { Constants } from '../../utils/index.js' |
| 14 | |
| 15 | // eslint-disable-next-line @typescript-eslint/no-extraneous-class |
| 16 | export class OCPPConstants { |
| 17 | static readonly OCPP_WEBSOCKET_TIMEOUT = 60000 // Ms |
| 18 | static readonly OCPP_TRIGGER_MESSAGE_DELAY = 500 // Ms |
| 19 | |
| 20 | static readonly OCPP_MEASURANDS_SUPPORTED = Object.freeze([ |
| 21 | MeterValueMeasurand.STATE_OF_CHARGE, |
| 22 | MeterValueMeasurand.VOLTAGE, |
| 23 | MeterValueMeasurand.POWER_ACTIVE_IMPORT, |
| 24 | MeterValueMeasurand.CURRENT_IMPORT, |
| 25 | MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER |
| 26 | ]) |
| 27 | |
| 28 | static readonly OCPP_REQUEST_EMPTY = Constants.EMPTY_FROZEN_OBJECT |
| 29 | static readonly OCPP_RESPONSE_EMPTY = Constants.EMPTY_FROZEN_OBJECT |
| 30 | static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: GenericStatus.Accepted }) |
| 31 | static readonly OCPP_RESPONSE_REJECTED = Object.freeze({ status: GenericStatus.Rejected }) |
| 32 | |
| 33 | static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({ |
| 34 | status: ConfigurationStatus.ACCEPTED |
| 35 | }) |
| 36 | |
| 37 | static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({ |
| 38 | status: ConfigurationStatus.REJECTED |
| 39 | }) |
| 40 | |
| 41 | static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({ |
| 42 | status: ConfigurationStatus.REBOOT_REQUIRED |
| 43 | }) |
| 44 | |
| 45 | static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({ |
| 46 | status: ConfigurationStatus.NOT_SUPPORTED |
| 47 | }) |
| 48 | |
| 49 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({ |
| 50 | status: ChargingProfileStatus.ACCEPTED |
| 51 | }) |
| 52 | |
| 53 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED = Object.freeze({ |
| 54 | status: ChargingProfileStatus.REJECTED |
| 55 | }) |
| 56 | |
| 57 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_NOT_SUPPORTED = Object.freeze({ |
| 58 | status: ChargingProfileStatus.NOT_SUPPORTED |
| 59 | }) |
| 60 | |
| 61 | static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({ |
| 62 | status: ClearChargingProfileStatus.ACCEPTED |
| 63 | }) |
| 64 | |
| 65 | static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN = Object.freeze({ |
| 66 | status: ClearChargingProfileStatus.UNKNOWN |
| 67 | }) |
| 68 | |
| 69 | static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED }) |
| 70 | static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({ |
| 71 | status: UnlockStatus.UNLOCK_FAILED |
| 72 | }) |
| 73 | |
| 74 | static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({ |
| 75 | status: UnlockStatus.NOT_SUPPORTED |
| 76 | }) |
| 77 | |
| 78 | static readonly OCPP_AVAILABILITY_RESPONSE_ACCEPTED = Object.freeze({ |
| 79 | status: AvailabilityStatus.ACCEPTED |
| 80 | }) |
| 81 | |
| 82 | static readonly OCPP_AVAILABILITY_RESPONSE_REJECTED = Object.freeze({ |
| 83 | status: AvailabilityStatus.REJECTED |
| 84 | }) |
| 85 | |
| 86 | static readonly OCPP_AVAILABILITY_RESPONSE_SCHEDULED = Object.freeze({ |
| 87 | status: AvailabilityStatus.SCHEDULED |
| 88 | }) |
| 89 | |
| 90 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED = Object.freeze({ |
| 91 | status: TriggerMessageStatus.ACCEPTED |
| 92 | }) |
| 93 | |
| 94 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED = Object.freeze({ |
| 95 | status: TriggerMessageStatus.REJECTED |
| 96 | }) |
| 97 | |
| 98 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED = Object.freeze({ |
| 99 | status: TriggerMessageStatus.NOT_IMPLEMENTED |
| 100 | }) |
| 101 | |
| 102 | static readonly OCPP_DATA_TRANSFER_RESPONSE_ACCEPTED = Object.freeze({ |
| 103 | status: DataTransferStatus.ACCEPTED |
| 104 | }) |
| 105 | |
| 106 | static readonly OCPP_DATA_TRANSFER_RESPONSE_REJECTED = Object.freeze({ |
| 107 | status: DataTransferStatus.REJECTED |
| 108 | }) |
| 109 | |
| 110 | static readonly OCPP_DATA_TRANSFER_RESPONSE_UNKNOWN_VENDOR_ID = Object.freeze({ |
| 111 | status: DataTransferStatus.UNKNOWN_VENDOR_ID |
| 112 | }) |
| 113 | |
| 114 | static readonly OCPP_RESERVATION_RESPONSE_ACCEPTED = Object.freeze({ |
| 115 | status: ReservationStatus.ACCEPTED |
| 116 | }) // Reservation has been made |
| 117 | |
| 118 | static readonly OCPP_RESERVATION_RESPONSE_FAULTED = Object.freeze({ |
| 119 | status: ReservationStatus.FAULTED |
| 120 | }) // Reservation has not been made, because of connector in FAULTED state |
| 121 | |
| 122 | static readonly OCPP_RESERVATION_RESPONSE_OCCUPIED = Object.freeze({ |
| 123 | status: ReservationStatus.OCCUPIED |
| 124 | }) // Reservation has not been made, because all connectors are OCCUPIED |
| 125 | |
| 126 | static readonly OCPP_RESERVATION_RESPONSE_REJECTED = Object.freeze({ |
| 127 | status: ReservationStatus.REJECTED |
| 128 | }) // Reservation has not been made, because charging station is not configured to accept reservations |
| 129 | |
| 130 | static readonly OCPP_RESERVATION_RESPONSE_UNAVAILABLE = Object.freeze({ |
| 131 | status: ReservationStatus.UNAVAILABLE |
| 132 | }) // Reservation has not been made, because connector is in UNAVAILABLE state |
| 133 | |
| 134 | static readonly OCPP_CANCEL_RESERVATION_RESPONSE_ACCEPTED = Object.freeze({ |
| 135 | status: GenericStatus.Accepted |
| 136 | }) // Reservation for id has been cancelled |
| 137 | |
| 138 | static readonly OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED = Object.freeze({ |
| 139 | status: GenericStatus.Rejected |
| 140 | }) // Reservation could not be cancelled, because there is no reservation active for id |
| 141 | |
| 142 | protected constructor () { |
| 143 | // This is intentional |
| 144 | } |
| 145 | } |