build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / src / charging-station / ocpp / OCPPConstants.ts
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
19 static readonly OCPP_MEASURANDS_SUPPORTED = Object.freeze([
20 MeterValueMeasurand.STATE_OF_CHARGE,
21 MeterValueMeasurand.VOLTAGE,
22 MeterValueMeasurand.POWER_ACTIVE_IMPORT,
23 MeterValueMeasurand.CURRENT_IMPORT,
24 MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
25 ])
26
27 static readonly OCPP_REQUEST_EMPTY = Constants.EMPTY_FROZEN_OBJECT
28 static readonly OCPP_RESPONSE_EMPTY = Constants.EMPTY_FROZEN_OBJECT
29 static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({
30 status: GenericStatus.Accepted
31 })
32
33 static readonly OCPP_RESPONSE_REJECTED = Object.freeze({
34 status: GenericStatus.Rejected
35 })
36
37 static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({
38 status: ConfigurationStatus.ACCEPTED
39 })
40
41 static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({
42 status: ConfigurationStatus.REJECTED
43 })
44
45 static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({
46 status: ConfigurationStatus.REBOOT_REQUIRED
47 })
48
49 static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({
50 status: ConfigurationStatus.NOT_SUPPORTED
51 })
52
53 static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({
54 status: ChargingProfileStatus.ACCEPTED
55 })
56
57 static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED = Object.freeze({
58 status: ChargingProfileStatus.REJECTED
59 })
60
61 static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_NOT_SUPPORTED = Object.freeze({
62 status: ChargingProfileStatus.NOT_SUPPORTED
63 })
64
65 static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({
66 status: ClearChargingProfileStatus.ACCEPTED
67 })
68
69 static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN = Object.freeze({
70 status: ClearChargingProfileStatus.UNKNOWN
71 })
72
73 static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({
74 status: UnlockStatus.UNLOCKED
75 })
76
77 static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({
78 status: UnlockStatus.UNLOCK_FAILED
79 })
80
81 static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({
82 status: UnlockStatus.NOT_SUPPORTED
83 })
84
85 static readonly OCPP_AVAILABILITY_RESPONSE_ACCEPTED = Object.freeze({
86 status: AvailabilityStatus.ACCEPTED
87 })
88
89 static readonly OCPP_AVAILABILITY_RESPONSE_REJECTED = Object.freeze({
90 status: AvailabilityStatus.REJECTED
91 })
92
93 static readonly OCPP_AVAILABILITY_RESPONSE_SCHEDULED = Object.freeze({
94 status: AvailabilityStatus.SCHEDULED
95 })
96
97 static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED = Object.freeze({
98 status: TriggerMessageStatus.ACCEPTED
99 })
100
101 static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED = Object.freeze({
102 status: TriggerMessageStatus.REJECTED
103 })
104
105 static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED = Object.freeze({
106 status: TriggerMessageStatus.NOT_IMPLEMENTED
107 })
108
109 static readonly OCPP_DATA_TRANSFER_RESPONSE_ACCEPTED = Object.freeze({
110 status: DataTransferStatus.ACCEPTED
111 })
112
113 static readonly OCPP_DATA_TRANSFER_RESPONSE_REJECTED = Object.freeze({
114 status: DataTransferStatus.REJECTED
115 })
116
117 static readonly OCPP_DATA_TRANSFER_RESPONSE_UNKNOWN_VENDOR_ID = Object.freeze({
118 status: DataTransferStatus.UNKNOWN_VENDOR_ID
119 })
120
121 static readonly OCPP_RESERVATION_RESPONSE_ACCEPTED = Object.freeze({
122 status: ReservationStatus.ACCEPTED
123 }) // Reservation has been made
124
125 static readonly OCPP_RESERVATION_RESPONSE_FAULTED = Object.freeze({
126 status: ReservationStatus.FAULTED
127 }) // Reservation has not been made, because of connector in FAULTED state
128
129 static readonly OCPP_RESERVATION_RESPONSE_OCCUPIED = Object.freeze({
130 status: ReservationStatus.OCCUPIED
131 }) // Reservation has not been made, because all connectors are OCCUPIED
132
133 static readonly OCPP_RESERVATION_RESPONSE_REJECTED = Object.freeze({
134 status: ReservationStatus.REJECTED
135 }) // Reservation has not been made, because charging station is not configured to accept reservations
136
137 static readonly OCPP_RESERVATION_RESPONSE_UNAVAILABLE = Object.freeze({
138 status: ReservationStatus.UNAVAILABLE
139 }) // Reservation has not been made, because connector is in UNAVAILABLE state
140
141 static readonly OCPP_CANCEL_RESERVATION_RESPONSE_ACCEPTED = Object.freeze({
142 status: GenericStatus.Accepted
143 }) // Reservation for id has been cancelled
144
145 static readonly OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED = Object.freeze({
146 status: GenericStatus.Rejected
147 }) // Reservation could not be cancelled, because there is no reservation active for id
148
149 protected constructor () {
150 // This is intentional
151 }
152 }