Add OCPP DataTransfer request support
[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 OCPP16DataTransferRequest,
10 OCPP16HeartbeatRequest,
11 OCPP16IncomingRequestCommand,
12 OCPP16MessageTrigger,
13 OCPP16RequestCommand,
14 OCPP16StatusNotificationRequest,
15} from './1.6/Requests';
16import type { MessageType } from './MessageType';
17
18export type RequestCommand = OCPP16RequestCommand;
19
20export const RequestCommand = {
21 ...OCPP16RequestCommand,
22};
23
24export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType];
25
26export type RequestParams = {
27 skipBufferingOnError?: boolean;
28 triggerMessage?: boolean;
29};
30
31export type IncomingRequestCommand = OCPP16IncomingRequestCommand;
32
33export const IncomingRequestCommand = {
34 ...OCPP16IncomingRequestCommand,
35};
36
37export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType];
38
39export type CachedRequest = [
40 (payload: JsonType, requestPayload: JsonType) => void,
41 (error: OCPPError, requestStatistic?: boolean) => void,
42 RequestCommand | IncomingRequestCommand,
43 JsonType
44];
45
46export type MessageTrigger = OCPP16MessageTrigger;
47
48export const MessageTrigger = {
49 ...OCPP16MessageTrigger,
50};
51
52export type BootNotificationRequest = OCPP16BootNotificationRequest;
53
54export type HeartbeatRequest = OCPP16HeartbeatRequest;
55
56export type StatusNotificationRequest = OCPP16StatusNotificationRequest;
57
58export type MeterValuesRequest = OCPP16MeterValuesRequest;
59
60export type DataTransferRequest = OCPP16DataTransferRequest;
61
62export type IncomingRequestHandler = (
63 chargingStation: ChargingStation,
64 commandPayload: JsonType
65) => JsonType | Promise<JsonType>;
66
67export type AvailabilityType = OCPP16AvailabilityType;
68
69export const AvailabilityType = {
70 ...OCPP16AvailabilityType,
71};
72
73export type DiagnosticsStatus = OCPP16DiagnosticsStatus;
74
75export const DiagnosticsStatus = {
76 ...OCPP16DiagnosticsStatus,
77};
78
79export type ResponseType = JsonType | OCPPError;