fix: avoid concurrent ATG startup
[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 TriggerMessageStatus,
10 UnlockStatus,
11 } from '../../types';
12 import { Constants } from '../../utils';
13
14 export class OCPPConstants {
15 static readonly OCPP_WEBSOCKET_TIMEOUT = 60000; // Ms
16 static readonly OCPP_TRIGGER_MESSAGE_DELAY = 500; // Ms
17
18 static readonly OCPP_MEASURANDS_SUPPORTED = Object.freeze([
19 MeterValueMeasurand.STATE_OF_CHARGE,
20 MeterValueMeasurand.VOLTAGE,
21 MeterValueMeasurand.POWER_ACTIVE_IMPORT,
22 MeterValueMeasurand.CURRENT_IMPORT,
23 MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER,
24 ]);
25
26 static readonly OCPP_REQUEST_EMPTY = Constants.EMPTY_FREEZED_OBJECT;
27 static readonly OCPP_RESPONSE_EMPTY = Constants.EMPTY_FREEZED_OBJECT;
28 static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: GenericStatus.Accepted });
29 static readonly OCPP_RESPONSE_REJECTED = Object.freeze({ status: GenericStatus.Rejected });
30
31 static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({
32 status: ConfigurationStatus.ACCEPTED,
33 });
34
35 static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({
36 status: ConfigurationStatus.REJECTED,
37 });
38
39 static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({
40 status: ConfigurationStatus.REBOOT_REQUIRED,
41 });
42
43 static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({
44 status: ConfigurationStatus.NOT_SUPPORTED,
45 });
46
47 static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({
48 status: ChargingProfileStatus.ACCEPTED,
49 });
50
51 static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_REJECTED = Object.freeze({
52 status: ChargingProfileStatus.REJECTED,
53 });
54
55 static readonly OCPP_SET_CHARGING_PROFILE_RESPONSE_NOT_SUPPORTED = Object.freeze({
56 status: ChargingProfileStatus.NOT_SUPPORTED,
57 });
58
59 static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_ACCEPTED = Object.freeze({
60 status: ClearChargingProfileStatus.ACCEPTED,
61 });
62
63 static readonly OCPP_CLEAR_CHARGING_PROFILE_RESPONSE_UNKNOWN = Object.freeze({
64 status: ClearChargingProfileStatus.UNKNOWN,
65 });
66
67 static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED });
68 static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({
69 status: UnlockStatus.UNLOCK_FAILED,
70 });
71
72 static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({
73 status: UnlockStatus.NOT_SUPPORTED,
74 });
75
76 static readonly OCPP_AVAILABILITY_RESPONSE_ACCEPTED = Object.freeze({
77 status: AvailabilityStatus.ACCEPTED,
78 });
79
80 static readonly OCPP_AVAILABILITY_RESPONSE_REJECTED = Object.freeze({
81 status: AvailabilityStatus.REJECTED,
82 });
83
84 static readonly OCPP_AVAILABILITY_RESPONSE_SCHEDULED = Object.freeze({
85 status: AvailabilityStatus.SCHEDULED,
86 });
87
88 static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_ACCEPTED = Object.freeze({
89 status: TriggerMessageStatus.ACCEPTED,
90 });
91
92 static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED = Object.freeze({
93 status: TriggerMessageStatus.REJECTED,
94 });
95
96 static readonly OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED = Object.freeze({
97 status: TriggerMessageStatus.NOT_IMPLEMENTED,
98 });
99
100 static readonly OCPP_DATA_TRANSFER_RESPONSE_ACCEPTED = Object.freeze({
101 status: DataTransferStatus.ACCEPTED,
102 });
103
104 static readonly OCPP_DATA_TRANSFER_RESPONSE_REJECTED = Object.freeze({
105 status: DataTransferStatus.REJECTED,
106 });
107
108 static readonly OCPP_DATA_TRANSFER_RESPONSE_UNKNOWN_VENDOR_ID = Object.freeze({
109 status: DataTransferStatus.UNKNOWN_VENDOR_ID,
110 });
111
112 protected constructor() {
113 // This is intentional
114 }
115 }