Use eslint extension for import sorting instead of unmaintained external ones
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Requests.ts
1 import type ChargingStation from '../../charging-station/ChargingStation';
2 import OCPPError from '../../exception/OCPPError';
3 import { JsonType } from '../JsonType';
4 import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus';
5 import { OCPP16MeterValuesRequest } from './1.6/MeterValues';
6 import {
7 OCPP16AvailabilityType,
8 OCPP16BootNotificationRequest,
9 OCPP16HeartbeatRequest,
10 OCPP16IncomingRequestCommand,
11 OCPP16RequestCommand,
12 OCPP16StatusNotificationRequest,
13 } from './1.6/Requests';
14 import { MessageType } from './MessageType';
15
16 export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType];
17
18 export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType];
19
20 export type CachedRequest = [
21 (payload: JsonType, requestPayload: JsonType) => void,
22 (error: OCPPError, requestStatistic?: boolean) => void,
23 RequestCommand | IncomingRequestCommand,
24 JsonType
25 ];
26
27 export type IncomingRequestHandler = (
28 chargingStation: ChargingStation,
29 commandPayload: JsonType
30 ) => JsonType | Promise<JsonType>;
31
32 export type ResponseType = JsonType | OCPPError;
33
34 export interface RequestParams {
35 skipBufferingOnError?: boolean;
36 triggerMessage?: boolean;
37 }
38
39 export type BootNotificationRequest = OCPP16BootNotificationRequest;
40
41 export type HeartbeatRequest = OCPP16HeartbeatRequest;
42
43 export type StatusNotificationRequest = OCPP16StatusNotificationRequest;
44
45 export type MeterValuesRequest = OCPP16MeterValuesRequest;
46
47 export type AvailabilityType = OCPP16AvailabilityType;
48
49 export const AvailabilityType = {
50 ...OCPP16AvailabilityType,
51 };
52
53 export type RequestCommand = OCPP16RequestCommand;
54
55 export const RequestCommand = {
56 ...OCPP16RequestCommand,
57 };
58
59 export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
60
61 export const IncomingRequestCommand = {
62 ...OCPP16IncomingRequestCommand,
63 };
64
65 export type DiagnosticsStatus = OCPP16DiagnosticsStatus;
66
67 export const DiagnosticsStatus = {
68 ...OCPP16DiagnosticsStatus,
69 };