From: Jérôme Benoit Date: Thu, 25 Aug 2022 03:50:54 +0000 (+0200) Subject: Fix UI protocol type definitions X-Git-Tag: v1.1.66~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=ce7a4fc3afcffe3f14f1cdf88b6af24750cf5910;p=e-mobility-charging-stations-simulator.git Fix UI protocol type definitions Signed-off-by: Jérôme Benoit --- 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;