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