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