X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Fui-server%2FAbstractUIServer.ts;h=9a19d39d9a6d29550c614b937f14fd18bcb514e3;hb=60ddad538d0a01ece43f4f70928a9decf3531dda;hp=91c69a76765b835447988ba46e106ed87829caf2;hpb=0d2cec7666c01396c8125a752341d5b716d12906;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ui-server/AbstractUIServer.ts b/src/charging-station/ui-server/AbstractUIServer.ts index 91c69a76..9a19d39d 100644 --- a/src/charging-station/ui-server/AbstractUIServer.ts +++ b/src/charging-station/ui-server/AbstractUIServer.ts @@ -15,8 +15,8 @@ import type AbstractUIService from './ui-services/AbstractUIService'; export abstract class AbstractUIServer { public readonly chargingStations: Map; - protected readonly uiServices: Map; protected server: WebSocket.Server | HttpServer; + protected readonly uiServices: Map; public constructor() { this.chargingStations = new Map(); @@ -27,17 +27,21 @@ export abstract class AbstractUIServer { id: string, procedureName: ProcedureName, requestPayload: RequestPayload - ): string { - return JSON.stringify([id, procedureName, requestPayload] as ProtocolRequest); + ): ProtocolRequest { + return [id, procedureName, requestPayload]; } - public buildProtocolResponse(id: string, responsePayload: ResponsePayload): string { - return JSON.stringify([id, responsePayload] as ProtocolResponse); + public buildProtocolResponse(id: string, responsePayload: ResponsePayload): ProtocolResponse { + return [id, responsePayload]; } public abstract start(): void; public abstract stop(): void; - public abstract sendRequest(request: string): void; - public abstract sendResponse(response: string): void; - public abstract logPrefix(modName?: string, methodName?: string, prefixSuffix?: string): string; + public abstract sendRequest(request: ProtocolRequest): void; + public abstract sendResponse(response: ProtocolResponse): void; + public abstract logPrefix( + moduleName?: string, + methodName?: string, + prefixSuffix?: string + ): string; }