From: Jérôme Benoit Date: Tue, 26 Jul 2022 15:25:01 +0000 (+0200) Subject: Track version is UI service instance X-Git-Tag: v1.1.64~3 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=33cea51772832a15a2fae0a0ee076fd306a634b3;p=e-mobility-charging-stations-simulator.git Track version is UI service instance Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ui-server/ui-services/AbstractUIService.ts b/src/charging-station/ui-server/ui-services/AbstractUIService.ts index 9b5e0885..ba8aa80c 100644 --- a/src/charging-station/ui-server/ui-services/AbstractUIService.ts +++ b/src/charging-station/ui-server/ui-services/AbstractUIService.ts @@ -6,16 +6,19 @@ import { ProtocolCommand, ProtocolRequest, ProtocolRequestHandler, + ProtocolVersion, } from '../../../types/UIProtocol'; import logger from '../../../utils/Logger'; import Utils from '../../../utils/Utils'; import { AbstractUIServer } from '../AbstractUIServer'; export default abstract class AbstractUIService { + protected readonly version: ProtocolVersion; protected readonly uiServer: AbstractUIServer; protected readonly messageHandlers: Map; - constructor(uiServer: AbstractUIServer) { + constructor(uiServer: AbstractUIServer, version: ProtocolVersion) { + this.version = version; this.uiServer = uiServer; this.messageHandlers = new Map([ [ProtocolCommand.LIST_CHARGING_STATIONS, this.handleListChargingStations.bind(this)], diff --git a/src/charging-station/ui-server/ui-services/UIService001.ts b/src/charging-station/ui-server/ui-services/UIService001.ts index 10f21f06..0981ca35 100644 --- a/src/charging-station/ui-server/ui-services/UIService001.ts +++ b/src/charging-station/ui-server/ui-services/UIService001.ts @@ -1,11 +1,15 @@ import { JsonType } from '../../../types/JsonType'; -import { ProtocolCommand, ProtocolRequestHandler } from '../../../types/UIProtocol'; +import { + ProtocolCommand, + ProtocolRequestHandler, + ProtocolVersion, +} from '../../../types/UIProtocol'; import { AbstractUIServer } from '../AbstractUIServer'; import AbstractUIService from './AbstractUIService'; export default class UIService001 extends AbstractUIService { constructor(uiServer: AbstractUIServer) { - super(uiServer); + super(uiServer, ProtocolVersion['0.0.1']); this.messageHandlers.set( ProtocolCommand.START_TRANSACTION, this.handleStartTransaction.bind(this) as ProtocolRequestHandler