From ce7a4fc3afcffe3f14f1cdf88b6af24750cf5910 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 25 Aug 2022 05:50:54 +0200 Subject: [PATCH] Fix UI protocol type definitions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .../ChargingStationWorkerBroadcastChannel.ts | 2 +- src/types/ChargingStationWorker.ts | 2 ++ src/ui/web/src/type/ChargingStationType.ts | 18 ++++++++++++++++++ src/ui/web/src/type/UIProtocol.ts | 2 ++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index 4e43e5ad..9e88b418 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -120,7 +120,7 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca break; default: // eslint-disable-next-line @typescript-eslint/restrict-template-expressions - throw new BaseError(`Unknown broadcast channel command: ${command}`); + throw new BaseError(`Unknown worker broadcast channel command: ${command}`); } } diff --git a/src/types/ChargingStationWorker.ts b/src/types/ChargingStationWorker.ts index 0fba406b..fe4bbc30 100644 --- a/src/types/ChargingStationWorker.ts +++ b/src/types/ChargingStationWorker.ts @@ -1,6 +1,7 @@ import ChargingStationInfo from './ChargingStationInfo'; import { ConnectorStatus } from './ConnectorStatus'; import { JsonObject } from './JsonType'; +import { BootNotificationResponse } from './ocpp/Responses'; import Statistics from './Statistics'; import { WorkerData, WorkerMessage, WorkerMessageEvents } from './Worker'; @@ -18,6 +19,7 @@ export interface ChargingStationData extends WorkerData { hashId: string; stationInfo: ChargingStationInfo; stopped: boolean; + bootNotificationResponse: BootNotificationResponse; connectors: ConnectorStatus[]; } diff --git a/src/ui/web/src/type/ChargingStationType.ts b/src/ui/web/src/type/ChargingStationType.ts index 4c184977..537e7b74 100644 --- a/src/ui/web/src/type/ChargingStationType.ts +++ b/src/ui/web/src/type/ChargingStationType.ts @@ -1,6 +1,10 @@ +import { JsonObject } from './JsonType'; + export type ChargingStationData = { hashId: string; stationInfo: ChargingStationInfo; + stopped: boolean; + bootNotificationResponse: BootNotificationResponse; connectors: ConnectorStatus[]; }; @@ -97,6 +101,20 @@ export const RequestCommand = { ...OCPP16RequestCommand, }; +export type BootNotificationResponse = OCPP16BootNotificationResponse; + +export enum OCPP16RegistrationStatus { + ACCEPTED = 'Accepted', + PENDING = 'Pending', + REJECTED = 'Rejected', +} + +export interface OCPP16BootNotificationResponse extends JsonObject { + status: OCPP16RegistrationStatus; + currentTime: string; + interval: number; +} + export interface CommandsSupport { incomingCommands: Record; outgoingCommands?: Record; diff --git a/src/ui/web/src/type/UIProtocol.ts b/src/ui/web/src/type/UIProtocol.ts index 4c25c58e..b8d40f31 100644 --- a/src/ui/web/src/type/UIProtocol.ts +++ b/src/ui/web/src/type/UIProtocol.ts @@ -28,6 +28,8 @@ export enum ProcedureName { STOP_TRANSACTION = 'stopTransaction', START_SIMULATOR = 'startSimulator', STOP_SIMULATOR = 'stopSimulator', + OPEN_CONNECTION = 'openConnection', + CLOSE_CONNECTION = 'closeConnection', } export interface RequestPayload extends JsonObject { hashId?: string; -- 2.34.1