Typing.
[e-mobility-charging-stations-simulator.git] / src / utils / Constants.ts
1 import { ConfigurationStatus, DefaultStatus, UnlockStatus } from '../types/ocpp/1.6/RequestResponses';
2
3 export default class Constants {
4 static readonly ENTITY_CHARGING_STATION = 'ChargingStation';
5 static readonly ENTITY_AUTOMATIC_TRANSACTION_GENERATOR = 'AutomaticTransactionGenerator';
6
7 static readonly WS_UNSUPPORTED_DATA = 1007;
8
9 static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: DefaultStatus.ACCEPTED });
10 static readonly OCPP_RESPONSE_REJECTED = Object.freeze({ status: DefaultStatus.REJECTED });
11 static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({ status: ConfigurationStatus.ACCEPTED });
12 static readonly OCPP_CONFIGURATION_RESPONSE_REJECTED = Object.freeze({ status: ConfigurationStatus.REJECTED });
13 static readonly OCPP_CONFIGURATION_RESPONSE_REBOOT_REQUIRED = Object.freeze({ status: ConfigurationStatus.REBOOT_REQUIRED });
14 static readonly OCPP_CONFIGURATION_RESPONSE_NOT_SUPPORTED = Object.freeze({ status: ConfigurationStatus.NOT_SUPPORTED });
15 static readonly OCPP_RESPONSE_UNLOCKED = Object.freeze({ status: UnlockStatus.UNLOCKED });
16 static readonly OCPP_RESPONSE_UNLOCK_FAILED = Object.freeze({ status: UnlockStatus.UNLOCK_FAILED });
17 static readonly OCPP_RESPONSE_UNLOCK_NOT_SUPPORTED = Object.freeze({ status: UnlockStatus.NOT_SUPPORTED });
18 static readonly OCPP_SOCKET_TIMEOUT = 60000; // 60 sec
19 static readonly OCPP_JSON_CALL_MESSAGE = 2; // Caller to callee
20 static readonly OCPP_JSON_CALL_RESULT_MESSAGE = 3; // Callee to caller
21 static readonly OCPP_JSON_CALL_ERROR_MESSAGE = 4; // Callee to caller
22 // Requested Action is not known by receiver
23 static readonly OCPP_ERROR_NOT_IMPLEMENTED = 'NotImplemented';
24 // Requested Action is recognized but not supported by the receiver
25 static readonly OCPP_ERROR_NOT_SUPPORTED = 'NotSupported';
26 // An internal error occurred and the receiver was not able to process the requested Action successfully
27 static readonly OCPP_ERROR_INTERNAL_ERROR = 'InternalError';
28 // Payload for Action is incomplete
29 static readonly OCPP_ERROR_PROTOCOL_ERROR = 'ProtocolError';
30 // During the processing of Action a security issue occurred preventing receiver from completing the Action successfully
31 static readonly OCPP_ERROR_SECURITY_ERROR = 'SecurityError';
32 // Payload for Action is syntactically incorrect or not conform the PDU structure for Action
33 static readonly OCPP_ERROR_FORMATION_VIOLATION = 'FormationViolation';
34 // Payload is syntactically correct but at least one field contains an invalid value
35 static readonly OCPP_ERROR_PROPERTY_RAINT_VIOLATION = 'PropertyraintViolation';
36 // Payload for Action is syntactically correct but at least one of the fields violates occurrence raints
37 static readonly OCPP_ERROR_OCCURENCE_RAINT_VIOLATION = 'OccurenceraintViolation';
38 // Payload for Action is syntactically correct but at least one of the fields violates data type raints (e.g. “somestring” = 12)
39 static readonly OCPP_ERROR_TYPERAINT_VIOLATION = 'TyperaintViolation';
40 // Any other error not covered by the previous ones
41 static readonly OCPP_ERROR_GENERIC_ERROR = 'GenericError';
42
43 static readonly OCPP_PROTOCOL_JSON = 'json';
44 static readonly OCPP_PROTOCOL_SOAP = 'soap';
45 static readonly OCPP_VERSION_12 = '1.2';
46 static readonly OCPP_VERSION_15 = '1.5';
47 static readonly OCPP_VERSION_16 = '1.6';
48 static readonly OCPP_VERSION_20 = '2.0';
49
50 static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms
51 static readonly CHARGING_STATION_ATG_WAIT_TIME = 2000; // Ms
52
53 static readonly TRANSACTION_DEFAULT_IDTAG = '00000000';
54 }