1a0d0ffbde9cfb2bd76e36cb8c9afcf565f3ec85
[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 ResponseType = JsonType | OCPPError | string;
16
17 export type BootNotificationRequest = OCPP16BootNotificationRequest;
18
19 export type AvailabilityType = OCPP16AvailabilityType;
20
21 export const AvailabilityType = {
22 ...OCPP16AvailabilityType
23 };
24
25 export type RequestCommand = OCPP16RequestCommand;
26
27 export const RequestCommand = {
28 ...OCPP16RequestCommand
29 };
30
31 export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
32
33 export const IncomingRequestCommand = {
34 ...OCPP16IncomingRequestCommand
35 };
36
37 export type DiagnosticsStatus = OCPP16DiagnosticsStatus;
38
39 export const DiagnosticsStatus = {
40 ...OCPP16DiagnosticsStatus
41 };
42
43 export type Request = [MessageType, string, RequestCommand, JsonType, JsonType];
44
45 export type IncomingRequest = [MessageType, string, IncomingRequestCommand, JsonType, JsonType];
46
47 export type CachedRequest = [(payload: JsonType, requestPayload: JsonType) => void, (error: OCPPError, requestStatistic?: boolean) => void, RequestCommand | IncomingRequestCommand, JsonType | OCPPError];