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