Commit | Line | Data |
---|---|---|
69074173 JB |
1 | import type { JsonObject } from './JsonType'; |
2 | import type { BroadcastChannelResponsePayload } from './WorkerBroadcastChannel'; | |
d1888640 | 3 | |
4198ad5c JB |
4 | export enum Protocol { |
5 | UI = 'ui', | |
6 | } | |
8244f5f0 | 7 | |
675fa8e3 JB |
8 | export enum ApplicationProtocol { |
9 | HTTP = 'http', | |
10 | WS = 'ws', | |
11 | } | |
12 | ||
eb3abc4f JB |
13 | export enum AuthenticationType { |
14 | BASIC_AUTH = 'basic-auth', | |
15 | } | |
16 | ||
8244f5f0 JB |
17 | export enum ProtocolVersion { |
18 | '0.0.1' = '0.0.1', | |
8244f5f0 JB |
19 | } |
20 | ||
89b7a234 JB |
21 | export type ProtocolRequest = [string, ProcedureName, RequestPayload]; |
22 | export type ProtocolResponse = [string, ResponsePayload]; | |
23 | ||
24 | export type ProtocolRequestHandler = ( | |
4e3ff94d | 25 | uuid?: string, |
5e8e29f4 | 26 | procedureName?: ProcedureName, |
5edd8ba0 | 27 | payload?: RequestPayload, |
6c8f5d90 | 28 | ) => undefined | Promise<undefined> | ResponsePayload | Promise<ResponsePayload>; |
89b7a234 | 29 | |
32de5a57 | 30 | export enum ProcedureName { |
5e8e29f4 JB |
31 | START_SIMULATOR = 'startSimulator', |
32 | STOP_SIMULATOR = 'stopSimulator', | |
ee0f106b | 33 | LIST_CHARGING_STATIONS = 'listChargingStations', |
89b7a234 JB |
34 | START_CHARGING_STATION = 'startChargingStation', |
35 | STOP_CHARGING_STATION = 'stopChargingStation', | |
db2336d9 JB |
36 | OPEN_CONNECTION = 'openConnection', |
37 | CLOSE_CONNECTION = 'closeConnection', | |
4f69be04 JB |
38 | START_AUTOMATIC_TRANSACTION_GENERATOR = 'startAutomaticTransactionGenerator', |
39 | STOP_AUTOMATIC_TRANSACTION_GENERATOR = 'stopAutomaticTransactionGenerator', | |
269de583 | 40 | SET_SUPERVISION_URL = 'setSupervisionUrl', |
5e8e29f4 JB |
41 | START_TRANSACTION = 'startTransaction', |
42 | STOP_TRANSACTION = 'stopTransaction', | |
1984f194 | 43 | AUTHORIZE = 'authorize', |
8bfbc743 | 44 | BOOT_NOTIFICATION = 'bootNotification', |
a9ed42b2 | 45 | STATUS_NOTIFICATION = 'statusNotification', |
10db00b2 | 46 | HEARTBEAT = 'heartbeat', |
d3195f0a | 47 | METER_VALUES = 'meterValues', |
91a7d3ea | 48 | DATA_TRANSFER = 'dataTransfer', |
c9a4f9ea JB |
49 | DIAGNOSTICS_STATUS_NOTIFICATION = 'diagnosticsStatusNotification', |
50 | FIRMWARE_STATUS_NOTIFICATION = 'firmwareStatusNotification', | |
8244f5f0 | 51 | } |
5612b691 | 52 | |
89b7a234 | 53 | export interface RequestPayload extends JsonObject { |
4eca248c | 54 | hashIds?: string[]; |
757b2ecf | 55 | connectorIds?: number[]; |
89b7a234 | 56 | } |
8244f5f0 | 57 | |
32de5a57 LM |
58 | export enum ResponseStatus { |
59 | SUCCESS = 'success', | |
60 | FAILURE = 'failure', | |
61 | } | |
62 | ||
63 | export interface ResponsePayload extends JsonObject { | |
64 | status: ResponseStatus; | |
0d2cec76 JB |
65 | hashIdsSucceeded?: string[]; |
66 | hashIdsFailed?: string[]; | |
f53c88d0 | 67 | responsesFailed?: BroadcastChannelResponsePayload[]; |
32de5a57 | 68 | } |