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