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