refactor: cleanup constants namespace
[e-mobility-charging-stations-simulator.git] / src / utils / Constants.ts
CommitLineData
268a74bb 1import { MeterValueMeasurand } from '../types';
9ccca265 2
268a74bb 3export class Constants {
7d34a2f4 4 static readonly DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000; // Ms
d2a64eb5 5
10570d97 6 static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms
a4cc42ea 7 static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000; // Ms
7d75bee1 8 static readonly CHARGING_STATION_ATG_DEFAULT_STOP_AFTER_HOURS = 0.25; // Hours
9ac86a7e 9
b25b8684 10 // See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
3637ca2c
JB
11 static readonly SEMVER_PATTERN =
12 '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$';
b25b8684 13
9a15316c 14 static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = 1024;
1e080116 15
3f94cab5
JB
16 static readonly DEFAULT_HASH_ALGORITHM = 'sha384';
17
c69294f7 18 static readonly DEFAULT_IDTAG = '00000000';
3d2ff9e4 19
291cb255 20 static readonly DEFAULT_CONNECTION_TIMEOUT = 30;
9ccca265 21
25f5a959
JB
22 static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60; // Seconds
23
47e22477 24 static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000; // Ms
d3195f0a 25 static readonly DEFAULT_METER_VALUES_INTERVAL = 60000; // Ms
47e22477 26
6a49ad23
JB
27 static readonly SUPPORTED_MEASURANDS = Object.freeze([
28 MeterValueMeasurand.STATE_OF_CHARGE,
29 MeterValueMeasurand.VOLTAGE,
30 MeterValueMeasurand.POWER_ACTIVE_IMPORT,
31 MeterValueMeasurand.CURRENT_IMPORT,
e7aeea18 32 MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER,
6a49ad23 33 ]);
9ccca265
JB
34
35 static readonly DEFAULT_FLUCTUATION_PERCENT = 5;
2a370053 36
a6b3c6c3 37 static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json';
7f774a55 38 static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator';
ae8ee665 39 static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records';
6a49ad23 40
adbddcb4
JB
41 static readonly DEFAULT_UI_SERVER_HOST = 'localhost';
42 static readonly DEFAULT_UI_SERVER_PORT = 8080;
4db8406c 43
2a232a18
JB
44 static readonly UNKNOWN_COMMAND = 'unknown command';
45
59395dc1
JB
46 static readonly MAX_RANDOM_INTEGER = 281474976710654;
47
59b6ed8d
JB
48 static readonly EMPTY_FREEZED_OBJECT = Object.freeze({});
49 static readonly EMPTY_FUNCTION = Object.freeze(() => {
50 /* This is intentional */
51 });
52
4db8406c
JB
53 private constructor() {
54 // This is intentional
55 }
f7869514 56}