Fix request and response handling in all registration state
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Requests.ts
CommitLineData
c0560973
JB
1import { OCPP16AvailabilityType, OCPP16BootNotificationRequest, OCPP16IncomingRequestCommand, OCPP16RequestCommand } from './1.6/Requests';
2
6a64534b 3import { MessageType } from './MessageType';
47e22477 4import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus';
e58068fd 5import OCPPError from '../../exception/OCPPError';
6a64534b 6
caad9d6b
JB
7export interface SendParams {
8 skipBufferingOnError?: boolean,
9 triggerMessage?: boolean
10}
11
58144adb
JB
12export type IncomingRequestHandler = (commandPayload: Record<string, unknown>) => Record<string, unknown> | Promise<Record<string, unknown>>;
13
c0560973
JB
14export type BootNotificationRequest = OCPP16BootNotificationRequest;
15
7e3926cc 16export type AvailabilityType = OCPP16AvailabilityType;
c0560973
JB
17
18export const AvailabilityType = {
19 ...OCPP16AvailabilityType
20};
21
7e3926cc 22export type RequestCommand = OCPP16RequestCommand;
c0560973
JB
23
24export const RequestCommand = {
25 ...OCPP16RequestCommand
26};
27
7e3926cc 28export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
9c13b3b5
JB
29
30export const IncomingRequestCommand = {
31 ...OCPP16IncomingRequestCommand
32};
c0560973 33
47e22477
JB
34export type DiagnosticsStatus = OCPP16DiagnosticsStatus;
35
36export const DiagnosticsStatus = {
37 ...OCPP16DiagnosticsStatus
38};
39
32b02249 40export type Request = [MessageType, string, RequestCommand, Record<string, unknown>, Record<string, unknown>];
6a64534b 41
690e5af7 42export type IncomingRequest = [MessageType, string, IncomingRequestCommand, Record<string, unknown>, Record<string, unknown>];
32b02249 43
9239b49a 44export type CachedRequest = [(payload: Record<string, unknown> | string, requestPayload: Record<string, unknown>) => void, (error: OCPPError, requestStatistic?: boolean) => void, RequestCommand | IncomingRequestCommand, Record<string, unknown>];