Fix UI protocol type definitions
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 25 Aug 2022 03:50:54 +0000 (05:50 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 25 Aug 2022 03:50:54 +0000 (05:50 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStationWorkerBroadcastChannel.ts
src/types/ChargingStationWorker.ts
src/ui/web/src/type/ChargingStationType.ts
src/ui/web/src/type/UIProtocol.ts

index 4e43e5ad024ac4706d54a45ef761f60c35e95094..9e88b4189372eaa030de37cfe159e4cdb3a89044 100644 (file)
@@ -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}`);
     }
   }
 
index 0fba406bc8bea212492f8e365d94f451d9d6f0cf..fe4bbc301ce1379e3354a8f53a7d6152ff4b4096 100644 (file)
@@ -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[];
 }
 
index 4c18497771f480c44dfee82a0ba6f68cfff6a9c9..537e7b74b560d72481ab09ecddf60a0770510706 100644 (file)
@@ -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<IncomingRequestCommand, boolean>;
   outgoingCommands?: Record<RequestCommand, boolean>;
index 4c25c58e921175b7f41535012591228d9feb24ff..b8d40f31a194f1c3ef1a70fe58c527b683ade9f4 100644 (file)
@@ -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;