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 JB |
17 | static readonly OCPP_WEBSOCKET_TIMEOUT = 60000 // Ms |
18 | static readonly OCPP_TRIGGER_MESSAGE_DELAY = 500 // Ms | |
d8b1fab1 | 19 | |
c3da35d4 JB |
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, | |
66a7748d JB |
25 | MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER |
26 | ]) | |
c3da35d4 | 27 | |
66a7748d JB |
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 }) | |
bf53cadf JB |
32 | |
33 | static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({ | |
66a7748d JB |
34 | status: ConfigurationStatus.ACCEPTED |
35 | }) | |
bf53cadf JB |
36 | |
37 | static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({ | |
66a7748d JB |
38 | status: ConfigurationStatus.REJECTED |
39 | }) | |
bf53cadf JB |
40 | |
41 | static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({ | |
66a7748d JB |
42 | status: ConfigurationStatus.REBOOT_REQUIRED |
43 | }) | |
bf53cadf JB |
44 | |
45 | static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({ | |
66a7748d JB |
46 | status: ConfigurationStatus.NOT_SUPPORTED |
47 | }) | |
bf53cadf JB |
48 | |
49 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({ | |
66a7748d JB |
50 | status: ChargingProfileStatus.ACCEPTED |
51 | }) | |
bf53cadf JB |
52 | |
53 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED = Object.freeze({ | |
66a7748d JB |
54 | status: ChargingProfileStatus.REJECTED |
55 | }) | |
bf53cadf JB |
56 | |
57 | static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_NOT_SUPPORTED = Object.freeze({ | |
66a7748d JB |
58 | status: ChargingProfileStatus.NOT_SUPPORTED |
59 | }) | |
bf53cadf JB |
60 | |
61 | static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({ | |
66a7748d JB |
62 | status: ClearChargingProfileStatus.ACCEPTED |
63 | }) | |
bf53cadf JB |
64 | |
65 | static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN = Object.freeze({ | |
66a7748d JB |
66 | status: ClearChargingProfileStatus.UNKNOWN |
67 | }) | |
bf53cadf | 68 | |
66a7748d | 69 | static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED }) |
bf53cadf | 70 | static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({ |
66a7748d JB |
71 | status: UnlockStatus.UNLOCK_FAILED |
72 | }) | |
bf53cadf JB |
73 | |
74 | static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({ | |
66a7748d JB |
75 | status: UnlockStatus.NOT_SUPPORTED |
76 | }) | |
bf53cadf JB |
77 | |
78 | static readonly OCPP_AVAILABILITY_RESPONSE_ACCEPTED = Object.freeze({ | |
66a7748d JB |
79 | status: AvailabilityStatus.ACCEPTED |
80 | }) | |
bf53cadf JB |
81 | |
82 | static readonly OCPP_AVAILABILITY_RESPONSE_REJECTED = Object.freeze({ | |
66a7748d JB |
83 | status: AvailabilityStatus.REJECTED |
84 | }) | |
bf53cadf JB |
85 | |
86 | static readonly OCPP_AVAILABILITY_RESPONSE_SCHEDULED = Object.freeze({ | |
66a7748d JB |
87 | status: AvailabilityStatus.SCHEDULED |
88 | }) | |
bf53cadf JB |
89 | |
90 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED = Object.freeze({ | |
66a7748d JB |
91 | status: TriggerMessageStatus.ACCEPTED |
92 | }) | |
bf53cadf JB |
93 | |
94 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED = Object.freeze({ | |
66a7748d JB |
95 | status: TriggerMessageStatus.REJECTED |
96 | }) | |
bf53cadf JB |
97 | |
98 | static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED = Object.freeze({ | |
66a7748d JB |
99 | status: TriggerMessageStatus.NOT_IMPLEMENTED |
100 | }) | |
bf53cadf | 101 | |
b63b4a73 | 102 | static readonly OCPP_DATA_TRANSFER_RESPONSE_ACCEPTED = Object.freeze({ |
66a7748d JB |
103 | status: DataTransferStatus.ACCEPTED |
104 | }) | |
b63b4a73 | 105 | |
bf53cadf | 106 | static readonly OCPP_DATA_TRANSFER_RESPONSE_REJECTED = Object.freeze({ |
66a7748d JB |
107 | status: DataTransferStatus.REJECTED |
108 | }) | |
022a231c | 109 | |
b63b4a73 | 110 | static readonly OCPP_DATA_TRANSFER_RESPONSE_UNKNOWN_VENDOR_ID = Object.freeze({ |
66a7748d JB |
111 | status: DataTransferStatus.UNKNOWN_VENDOR_ID |
112 | }) | |
bf53cadf | 113 | |
66dd3447 | 114 | static readonly OCPP_RESERVATION_RESPONSE_ACCEPTED = Object.freeze({ |
66a7748d JB |
115 | status: ReservationStatus.ACCEPTED |
116 | }) // Reservation has been made | |
899cb106 | 117 | |
66dd3447 | 118 | static readonly OCPP_RESERVATION_RESPONSE_FAULTED = Object.freeze({ |
66a7748d JB |
119 | status: ReservationStatus.FAULTED |
120 | }) // Reservation has not been made, because of connector in FAULTED state | |
899cb106 | 121 | |
66dd3447 | 122 | static readonly OCPP_RESERVATION_RESPONSE_OCCUPIED = Object.freeze({ |
66a7748d JB |
123 | status: ReservationStatus.OCCUPIED |
124 | }) // Reservation has not been made, because all connectors are OCCUPIED | |
66dd3447 JB |
125 | |
126 | static readonly OCPP_RESERVATION_RESPONSE_REJECTED = Object.freeze({ | |
66a7748d JB |
127 | status: ReservationStatus.REJECTED |
128 | }) // Reservation has not been made, because charging station is not configured to accept reservations | |
66dd3447 JB |
129 | |
130 | static readonly OCPP_RESERVATION_RESPONSE_UNAVAILABLE = Object.freeze({ | |
66a7748d JB |
131 | status: ReservationStatus.UNAVAILABLE |
132 | }) // Reservation has not been made, because connector is in UNAVAILABLE state | |
66dd3447 JB |
133 | |
134 | static readonly OCPP_CANCEL_RESERVATION_RESPONSE_ACCEPTED = Object.freeze({ | |
66a7748d JB |
135 | status: GenericStatus.Accepted |
136 | }) // Reservation for id has been cancelled | |
66dd3447 JB |
137 | |
138 | static readonly OCPP_CANCEL_RESERVATION_RESPONSE_REJECTED = Object.freeze({ | |
66a7748d JB |
139 | status: GenericStatus.Rejected |
140 | }) // Reservation could not be cancelled, because there is no reservation active for id | |
899cb106 | 141 | |
66a7748d | 142 | protected constructor () { |
bf53cadf JB |
143 | // This is intentional |
144 | } | |
145 | } |