From: Jérôme Benoit Date: Mon, 2 Nov 2020 10:34:17 +0000 (+0100) Subject: Type a bit some attributes. X-Git-Tag: v1.0.1-0~227 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=a4a217091f3e2b774e3b5e5c835f59f80684fcff;p=e-mobility-charging-stations-simulator.git Type a bit some attributes. Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 4c538d77..cc5b924f 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -15,24 +15,24 @@ import logger from '../utils/Logger'; export default class ChargingStation { private _index: number; - private _stationTemplateFile; + private _stationTemplateFile: string; private _stationInfo; private _bootNotificationMessage; private _connectors; private _configuration; - private _connectorsConfigurationHash; + private _connectorsConfigurationHash: string; private _supervisionUrl; private _wsConnectionUrl; - private _wsConnection; + private _wsConnection: WebSocket; private _isSocketRestart; - private _autoReconnectRetryCount; - private _autoReconnectMaxRetries; - private _autoReconnectTimeout; + private _autoReconnectRetryCount: number; + private _autoReconnectMaxRetries: number; + private _autoReconnectTimeout: number; private _requests; private _messageQueue; private _automaticTransactionGeneration: AutomaticTransactionGenerator; private _authorizedTags: string[]; - private _heartbeatInterval; + private _heartbeatInterval: number; private _heartbeatSetInterval; private _statistics: Statistics; private _performanceObserver: PerformanceObserver; @@ -332,7 +332,7 @@ export default class ChargingStation { } } - async _stopMessageSequence(reason = '') { + async _stopMessageSequence(reason = ''): Promise { // Stop heartbeat this._stopHeartbeat(); // Stop the ATG diff --git a/src/charging-station/OcppError.ts b/src/charging-station/OcppError.ts index a43c62d3..1f384783 100644 --- a/src/charging-station/OcppError.ts +++ b/src/charging-station/OcppError.ts @@ -1,10 +1,10 @@ import Constants from '../utils/Constants'; export default class OCPPError extends Error { - code; + code: string; details; - constructor(code, message, details?) { + constructor(code: string, message:string , details?) { super(message); this.code = code || Constants.OCPP_ERROR_GENERIC_ERROR; diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index b6642358..995ab5d3 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -12,60 +12,60 @@ export default class Configuration { return Configuration.configuration; } - static getStatisticsDisplayInterval() { + static getStatisticsDisplayInterval(): number { // Read conf return Utils.objectHasOwnProperty(Configuration.getConfig(), 'statisticsDisplayInterval') ? Configuration.getConfig().statisticsDisplayInterval : 60; } - static getAutoReconnectTimeout() { + static getAutoReconnectTimeout(): number { // Read conf return Utils.objectHasOwnProperty(Configuration.getConfig(), 'autoReconnectTimeout') ? Configuration.getConfig().autoReconnectTimeout : 10; } - static getAutoReconnectMaxRetries() { + static getAutoReconnectMaxRetries(): number { // Read conf return Utils.objectHasOwnProperty(Configuration.getConfig(), 'autoReconnectMaxRetries') ? Configuration.getConfig().autoReconnectMaxRetries : -1; } - static getStationTemplateURLs() { + static getStationTemplateURLs(): any[] { // Read conf return Configuration.getConfig().stationTemplateURLs; } - static useWorkerPool() { + static useWorkerPool(): boolean { return Configuration.getConfig().useWorkerPool; } - static getWorkerPoolSize() { + static getWorkerPoolSize(): number { return Configuration.getConfig().workerPoolSize; } - static getConsoleLog() { + static getConsoleLog(): boolean { return Utils.objectHasOwnProperty(Configuration.getConfig(), 'consoleLog') ? Configuration.getConfig().consoleLog : false; } - static getLogFormat() { + static getLogFormat(): string { return Utils.objectHasOwnProperty(Configuration.getConfig(), 'logFormat') ? Configuration.getConfig().logFormat : 'simple'; } - static getLogLevel() { + static getLogLevel(): string { return Utils.objectHasOwnProperty(Configuration.getConfig(), 'logLevel') ? Configuration.getConfig().logLevel : 'info'; } - static getLogFile() { + static getLogFile(): string { return Utils.objectHasOwnProperty(Configuration.getConfig(), 'logFile') ? Configuration.getConfig().logFile : 'combined.log'; } - static getErrorFile() { + static getErrorFile(): string { return Utils.objectHasOwnProperty(Configuration.getConfig(), 'errorFile') ? Configuration.getConfig().errorFile : 'error.log'; } - static getSupervisionURLs() { + static getSupervisionURLs(): string { // Read conf return Configuration.getConfig().supervisionURLs; } - static getDistributeStationToTenantEqually() { + static getDistributeStationToTenantEqually(): boolean { return Utils.objectHasOwnProperty(Configuration.getConfig(), 'distributeStationToTenantEqually') ? Configuration.getConfig().distributeStationToTenantEqually : true; } }