fcd39a014a34e4f5c1355dedae845284b0a5e524
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Requests.ts
1 import { OCPP16AvailabilityType, OCPP16BootNotificationRequest, OCPP16IncomingRequestCommand, OCPP16RequestCommand } from './1.6/Requests';
2
3 import { JsonType } from '../JsonType';
4 import { MessageType } from './MessageType';
5 import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus';
6 import OCPPError from '../../exception/OCPPError';
7
8 export interface SendParams {
9 skipBufferingOnError?: boolean,
10 triggerMessage?: boolean
11 }
12
13 export type IncomingRequestHandler = (commandPayload: JsonType) => JsonType | Promise<JsonType>;
14
15 export type BootNotificationRequest = OCPP16BootNotificationRequest;
16
17 export type AvailabilityType = OCPP16AvailabilityType;
18
19 export const AvailabilityType = {
20 ...OCPP16AvailabilityType
21 };
22
23 export type RequestCommand = OCPP16RequestCommand;
24
25 export const RequestCommand = {
26 ...OCPP16RequestCommand
27 };
28
29 export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
30
31 export const IncomingRequestCommand = {
32 ...OCPP16IncomingRequestCommand
33 };
34
35 export type DiagnosticsStatus = OCPP16DiagnosticsStatus;
36
37 export const DiagnosticsStatus = {
38 ...OCPP16DiagnosticsStatus
39 };
40
41 export type Request = [MessageType, string, RequestCommand, JsonType, JsonType];
42
43 export type IncomingRequest = [MessageType, string, IncomingRequestCommand, JsonType, JsonType];
44
45 export type CachedRequest = [(payload: JsonType, requestPayload: JsonType) => void, (error: OCPPError, requestStatistic?: boolean) => void, RequestCommand | IncomingRequestCommand, JsonType | OCPPError];