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