X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Futils%2FConstants.ts;h=ee9d96d9d03c00fb920b0664086fdcdd406ca730;hb=1f7a03460c25a4d696d23a1a4ff6fbe7384346e9;hp=d3128469a0f3f8b1d372d202325a1d54fcfb4a47;hpb=7c72977bb3400f474c8641fc91d9f54fba25cb64;p=e-mobility-charging-stations-simulator.git diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index d3128469..ee9d96d9 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -1,15 +1,15 @@ +import { MeterValueMeasurand } from '../types/ocpp/MeterValues'; import { AvailabilityStatus, ChargingProfileStatus, ClearChargingProfileStatus, ConfigurationStatus, + DataTransferStatus, DefaultStatus, TriggerMessageStatus, UnlockStatus, } from '../types/ocpp/Responses'; -import { MeterValueMeasurand } from '../types/ocpp/MeterValues'; - export default class Constants { static readonly OCPP_RESPONSE_EMPTY = Object.freeze({}); static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: DefaultStatus.ACCEPTED }); @@ -83,6 +83,10 @@ export default class Constants { status: TriggerMessageStatus.NOT_IMPLEMENTED, }); + static readonly OCPP_DATA_TRANSFER_RESPONSE_REJECTED = Object.freeze({ + status: DataTransferStatus.REJECTED, + }); + static readonly OCPP_DEFAULT_BOOT_NOTIFICATION_INTERVAL = 60000; // Ms static readonly OCPP_WEBSOCKET_TIMEOUT = 60000; // Ms static readonly OCPP_TRIGGER_MESSAGE_DELAY = 500; // Ms @@ -90,11 +94,12 @@ export default class Constants { static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms static readonly CHARGING_STATION_ATG_INITIALIZATION_TIME = 1000; // Ms static readonly CHARGING_STATION_ATG_DEFAULT_STOP_AFTER_HOURS = 0.25; // Hours - static readonly CHARGING_STATION_CONFIGURATION_SECTIONS = Object.freeze([ - 'stationInfo', - 'configurationKey', - 'configurationHash', - ]); + + // See https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string + static readonly SEMVER_REGEXP = + /^(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-]+)*))?$/; + + static readonly DEFAULT_CIRCULAR_BUFFER_CAPACITY = Number.MAX_SAFE_INTEGER; static readonly DEFAULT_HASH_ALGORITHM = 'sha384'; @@ -105,6 +110,7 @@ export default class Constants { static readonly DEFAULT_LOG_STATISTICS_INTERVAL = 60; // Seconds static readonly DEFAULT_HEARTBEAT_INTERVAL = 60000; // Ms + static readonly DEFAULT_METER_VALUES_INTERVAL = 60000; // Ms static readonly SUPPORTED_MEASURANDS = Object.freeze([ MeterValueMeasurand.STATE_OF_CHARGE, @@ -117,9 +123,15 @@ export default class Constants { static readonly DEFAULT_FLUCTUATION_PERCENT = 5; static readonly DEFAULT_PERFORMANCE_RECORDS_FILENAME = 'performanceRecords.json'; - static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'emobility-charging-stations-simulator'; + static readonly DEFAULT_PERFORMANCE_RECORDS_DB_NAME = 'e-mobility-charging-stations-simulator'; static readonly PERFORMANCE_RECORDS_TABLE = 'performance_records'; - static readonly DEFAULT_UI_WEBSOCKET_SERVER_HOST = 'localhost'; - static readonly DEFAULT_UI_WEBSOCKET_SERVER_PORT = 8080; + static readonly DEFAULT_UI_SERVER_HOST = 'localhost'; + static readonly DEFAULT_UI_SERVER_PORT = 8080; + + static readonly UNKNOWN_COMMAND = 'unknown command'; + + private constructor() { + // This is intentional + } }