Commit | Line | Data |
---|---|---|
8114d10e | 1 | import type ChargingStation from '../../charging-station/ChargingStation'; |
6c1761d4 JB |
2 | import type OCPPError from '../../exception/OCPPError'; |
3 | import type { JsonType } from '../JsonType'; | |
8114d10e | 4 | import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus'; |
6c1761d4 | 5 | import type { OCPP16MeterValuesRequest } from './1.6/MeterValues'; |
e7aeea18 JB |
6 | import { |
7 | OCPP16AvailabilityType, | |
953d6b02 JB |
8 | type OCPP16BootNotificationRequest, |
9 | type OCPP16DataTransferRequest, | |
10 | type OCPP16HeartbeatRequest, | |
e7aeea18 | 11 | OCPP16IncomingRequestCommand, |
c60ed4b8 | 12 | OCPP16MessageTrigger, |
e7aeea18 | 13 | OCPP16RequestCommand, |
953d6b02 | 14 | type OCPP16StatusNotificationRequest, |
e7aeea18 | 15 | } from './1.6/Requests'; |
953d6b02 | 16 | import { OCPP20IncomingRequestCommand, OCPP20RequestCommand } from './2.0/Requests'; |
6c1761d4 | 17 | import type { MessageType } from './MessageType'; |
6a64534b | 18 | |
e3018bc4 JB |
19 | export type RequestCommand = OCPP16RequestCommand; |
20 | ||
21 | export const RequestCommand = { | |
22 | ...OCPP16RequestCommand, | |
953d6b02 | 23 | ...OCPP20RequestCommand, |
e3018bc4 JB |
24 | }; |
25 | ||
5cc4b63b | 26 | export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType]; |
b3ec7bc1 | 27 | |
83e00df1 | 28 | export type RequestParams = { |
e3018bc4 JB |
29 | skipBufferingOnError?: boolean; |
30 | triggerMessage?: boolean; | |
83e00df1 | 31 | }; |
e3018bc4 JB |
32 | |
33 | export type IncomingRequestCommand = OCPP16IncomingRequestCommand; | |
34 | ||
35 | export const IncomingRequestCommand = { | |
36 | ...OCPP16IncomingRequestCommand, | |
953d6b02 | 37 | ...OCPP20IncomingRequestCommand, |
e3018bc4 JB |
38 | }; |
39 | ||
5cc4b63b | 40 | export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType]; |
b3ec7bc1 | 41 | |
d900c8d7 JB |
42 | export type ResponseCallback = (payload: JsonType, requestPayload: JsonType) => void; |
43 | ||
44 | export type ErrorCallback = (error: OCPPError, requestStatistic?: boolean) => void; | |
45 | ||
b3ec7bc1 | 46 | export type CachedRequest = [ |
d900c8d7 JB |
47 | ResponseCallback, |
48 | ErrorCallback, | |
b3ec7bc1 | 49 | RequestCommand | IncomingRequestCommand, |
5cc4b63b | 50 | JsonType |
b3ec7bc1 JB |
51 | ]; |
52 | ||
c60ed4b8 JB |
53 | export type MessageTrigger = OCPP16MessageTrigger; |
54 | ||
55 | export const MessageTrigger = { | |
56 | ...OCPP16MessageTrigger, | |
57 | }; | |
58 | ||
c0560973 JB |
59 | export type BootNotificationRequest = OCPP16BootNotificationRequest; |
60 | ||
ef6fa3fb JB |
61 | export type HeartbeatRequest = OCPP16HeartbeatRequest; |
62 | ||
63 | export type StatusNotificationRequest = OCPP16StatusNotificationRequest; | |
64 | ||
65 | export type MeterValuesRequest = OCPP16MeterValuesRequest; | |
66 | ||
91a7d3ea JB |
67 | export type DataTransferRequest = OCPP16DataTransferRequest; |
68 | ||
e3018bc4 JB |
69 | export type IncomingRequestHandler = ( |
70 | chargingStation: ChargingStation, | |
71 | commandPayload: JsonType | |
72 | ) => JsonType | Promise<JsonType>; | |
73 | ||
7e3926cc | 74 | export type AvailabilityType = OCPP16AvailabilityType; |
c0560973 JB |
75 | |
76 | export const AvailabilityType = { | |
e7aeea18 | 77 | ...OCPP16AvailabilityType, |
c0560973 JB |
78 | }; |
79 | ||
47e22477 JB |
80 | export type DiagnosticsStatus = OCPP16DiagnosticsStatus; |
81 | ||
82 | export const DiagnosticsStatus = { | |
e7aeea18 | 83 | ...OCPP16DiagnosticsStatus, |
47e22477 | 84 | }; |
e3018bc4 JB |
85 | |
86 | export type ResponseType = JsonType | OCPPError; |