Refine connector id validation error message
[e-mobility-charging-stations-simulator.git] / src / types / ocpp / Requests.ts
... / ...
CommitLineData
1import type ChargingStation from '../../charging-station/ChargingStation';
2import type OCPPError from '../../exception/OCPPError';
3import type { JsonType } from '../JsonType';
4import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus';
5import type { OCPP16MeterValuesRequest } from './1.6/MeterValues';
6import {
7 OCPP16AvailabilityType,
8 OCPP16BootNotificationRequest,
9 OCPP16HeartbeatRequest,
10 OCPP16IncomingRequestCommand,
11 OCPP16MessageTrigger,
12 OCPP16RequestCommand,
13 OCPP16StatusNotificationRequest,
14} from './1.6/Requests';
15import type { MessageType } from './MessageType';
16
17export type RequestCommand = OCPP16RequestCommand;
18
19export const RequestCommand = {
20 ...OCPP16RequestCommand,
21};
22
23export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType];
24
25export type RequestParams = {
26 skipBufferingOnError?: boolean;
27 triggerMessage?: boolean;
28};
29
30export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
31
32export const IncomingRequestCommand = {
33 ...OCPP16IncomingRequestCommand,
34};
35
36export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType];
37
38export type CachedRequest = [
39 (payload: JsonType, requestPayload: JsonType) => void,
40 (error: OCPPError, requestStatistic?: boolean) => void,
41 RequestCommand | IncomingRequestCommand,
42 JsonType
43];
44
45export type MessageTrigger = OCPP16MessageTrigger;
46
47export const MessageTrigger = {
48 ...OCPP16MessageTrigger,
49};
50
51export type BootNotificationRequest = OCPP16BootNotificationRequest;
52
53export type HeartbeatRequest = OCPP16HeartbeatRequest;
54
55export type StatusNotificationRequest = OCPP16StatusNotificationRequest;
56
57export type MeterValuesRequest = OCPP16MeterValuesRequest;
58
59export type IncomingRequestHandler = (
60 chargingStation: ChargingStation,
61 commandPayload: JsonType
62) => JsonType | Promise<JsonType>;
63
64export type AvailabilityType = OCPP16AvailabilityType;
65
66export const AvailabilityType = {
67 ...OCPP16AvailabilityType,
68};
69
70export type DiagnosticsStatus = OCPP16DiagnosticsStatus;
71
72export const DiagnosticsStatus = {
73 ...OCPP16DiagnosticsStatus,
74};
75
76export type ResponseType = JsonType | OCPPError;