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