Comment some dubious OCPPError usage
[e-mobility-charging-stations-simulator.git] / src / types / UIProtocol.ts
... / ...
CommitLineData
1import type { JsonObject } from './JsonType';
2import type { BroadcastChannelResponsePayload } from './WorkerBroadcastChannel';
3
4export enum Protocol {
5 UI = 'ui',
6}
7
8export enum ApplicationProtocol {
9 HTTP = 'http',
10 WS = 'ws',
11}
12
13export enum AuthenticationType {
14 BASIC_AUTH = 'basic-auth',
15}
16
17export enum ProtocolVersion {
18 '0.0.1' = '0.0.1',
19}
20
21export type ProtocolRequest = [string, ProcedureName, RequestPayload];
22export type ProtocolResponse = [string, ResponsePayload];
23
24export type ProtocolRequestHandler = (
25 uuid?: string,
26 procedureName?: ProcedureName,
27 payload?: RequestPayload
28) => undefined | Promise<undefined> | ResponsePayload | Promise<ResponsePayload>;
29
30export enum ProcedureName {
31 START_SIMULATOR = 'startSimulator',
32 STOP_SIMULATOR = 'stopSimulator',
33 LIST_CHARGING_STATIONS = 'listChargingStations',
34 START_CHARGING_STATION = 'startChargingStation',
35 STOP_CHARGING_STATION = 'stopChargingStation',
36 OPEN_CONNECTION = 'openConnection',
37 CLOSE_CONNECTION = 'closeConnection',
38 START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator',
39 STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator',
40 START_TRANSACTION = 'startTransaction',
41 STOP_TRANSACTION = 'stopTransaction',
42 AUTHORIZE = 'authorize',
43 BOOT_NOTIFICATION = 'bootNotification',
44 STATUS_NOTIFICATION = 'statusNotification',
45 HEARTBEAT = 'heartbeat',
46 METER_VALUES = 'meterValues',
47}
48
49export interface RequestPayload extends JsonObject {
50 hashIds?: string[];
51 connectorIds?: number[];
52}
53
54export enum ResponseStatus {
55 SUCCESS = 'success',
56 FAILURE = 'failure',
57}
58
59export interface ResponsePayload extends JsonObject {
60 status: ResponseStatus;
61 hashIdsSucceeded?: string[];
62 hashIdsFailed?: string[];
63 responsesFailed?: BroadcastChannelResponsePayload[];
64}