Commit | Line | Data |
---|---|---|
66a7748d JB |
1 | import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus.js' |
2 | import type { OCPP16MeterValuesRequest } from './1.6/MeterValues.js' | |
e7aeea18 JB |
3 | import { |
4 | OCPP16AvailabilityType, | |
953d6b02 | 5 | type OCPP16BootNotificationRequest, |
66dd3447 | 6 | type OCPP16CancelReservationRequest, |
953d6b02 | 7 | type OCPP16DataTransferRequest, |
c9a4f9ea | 8 | type OCPP16DiagnosticsStatusNotificationRequest, |
d4c84337 | 9 | OCPP16FirmwareStatus, |
c9a4f9ea | 10 | type OCPP16FirmwareStatusNotificationRequest, |
953d6b02 | 11 | type OCPP16HeartbeatRequest, |
e7aeea18 | 12 | OCPP16IncomingRequestCommand, |
c60ed4b8 | 13 | OCPP16MessageTrigger, |
e7aeea18 | 14 | OCPP16RequestCommand, |
66dd3447 | 15 | type OCPP16ReserveNowRequest, |
66a7748d JB |
16 | type OCPP16StatusNotificationRequest |
17 | } from './1.6/Requests.js' | |
18 | import { OperationalStatusEnumType } from './2.0/Common.js' | |
69074173 | 19 | import { |
d270cc87 JB |
20 | type OCPP20BootNotificationRequest, |
21 | OCPP20IncomingRequestCommand, | |
22 | OCPP20RequestCommand, | |
66a7748d JB |
23 | type OCPP20StatusNotificationRequest |
24 | } from './2.0/Requests.js' | |
25 | import type { MessageType } from './MessageType.js' | |
26 | import type { ChargingStation } from '../../charging-station/index.js' | |
27 | import type { OCPPError } from '../../exception/index.js' | |
28 | import type { JsonType } from '../JsonType.js' | |
6a64534b | 29 | |
e3018bc4 JB |
30 | export const RequestCommand = { |
31 | ...OCPP16RequestCommand, | |
66a7748d JB |
32 | ...OCPP20RequestCommand |
33 | } as const | |
34 | // eslint-disable-next-line @typescript-eslint/no-redeclare | |
35 | export type RequestCommand = OCPP16RequestCommand | OCPP20RequestCommand | |
e3018bc4 | 36 | |
66a7748d | 37 | export type OutgoingRequest = [MessageType.CALL_MESSAGE, string, RequestCommand, JsonType] |
b3ec7bc1 | 38 | |
e1d9a0f4 | 39 | export interface RequestParams { |
66a7748d JB |
40 | skipBufferingOnError?: boolean |
41 | triggerMessage?: boolean | |
42 | throwError?: boolean | |
e1d9a0f4 | 43 | } |
e3018bc4 | 44 | |
e3018bc4 JB |
45 | export const IncomingRequestCommand = { |
46 | ...OCPP16IncomingRequestCommand, | |
66a7748d JB |
47 | ...OCPP20IncomingRequestCommand |
48 | } as const | |
49 | // eslint-disable-next-line @typescript-eslint/no-redeclare | |
50 | export type IncomingRequestCommand = OCPP16IncomingRequestCommand | OCPP20IncomingRequestCommand | |
e3018bc4 | 51 | |
66a7748d | 52 | export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType] |
b3ec7bc1 | 53 | |
73ed6e01 JB |
54 | export type IncomingRequestHandler = ( |
55 | chargingStation: ChargingStation, | |
66a7748d JB |
56 | commandPayload: JsonType |
57 | ) => JsonType | Promise<JsonType> | |
73ed6e01 | 58 | |
66a7748d | 59 | export type ResponseCallback = (payload: JsonType, requestPayload: JsonType) => void |
d900c8d7 | 60 | |
66a7748d | 61 | export type ErrorCallback = (ocppError: OCPPError, requestStatistic?: boolean) => void |
d900c8d7 | 62 | |
b3ec7bc1 | 63 | export type CachedRequest = [ |
d900c8d7 JB |
64 | ResponseCallback, |
65 | ErrorCallback, | |
b3ec7bc1 | 66 | RequestCommand | IncomingRequestCommand, |
a223d9be | 67 | JsonType |
66a7748d | 68 | ] |
b3ec7bc1 | 69 | |
c60ed4b8 | 70 | export const MessageTrigger = { |
66a7748d JB |
71 | ...OCPP16MessageTrigger |
72 | } as const | |
73 | // eslint-disable-next-line @typescript-eslint/no-redeclare | |
74 | export type MessageTrigger = OCPP16MessageTrigger | |
c60ed4b8 | 75 | |
66a7748d | 76 | export type BootNotificationRequest = OCPP16BootNotificationRequest | OCPP20BootNotificationRequest |
c0560973 | 77 | |
66a7748d | 78 | export type HeartbeatRequest = OCPP16HeartbeatRequest |
ef6fa3fb | 79 | |
6e939d9e JB |
80 | export type StatusNotificationRequest = |
81 | | OCPP16StatusNotificationRequest | |
66a7748d | 82 | | OCPP20StatusNotificationRequest |
ef6fa3fb | 83 | |
66a7748d | 84 | export type MeterValuesRequest = OCPP16MeterValuesRequest |
ef6fa3fb | 85 | |
66a7748d | 86 | export type DataTransferRequest = OCPP16DataTransferRequest |
91a7d3ea | 87 | |
66a7748d | 88 | export type DiagnosticsStatusNotificationRequest = OCPP16DiagnosticsStatusNotificationRequest |
c9a4f9ea | 89 | |
66a7748d | 90 | export type FirmwareStatusNotificationRequest = OCPP16FirmwareStatusNotificationRequest |
c9a4f9ea | 91 | |
c0560973 | 92 | export const AvailabilityType = { |
e7aeea18 | 93 | ...OCPP16AvailabilityType, |
66a7748d JB |
94 | ...OperationalStatusEnumType |
95 | } as const | |
96 | // eslint-disable-next-line @typescript-eslint/no-redeclare | |
97 | export type AvailabilityType = OCPP16AvailabilityType | OperationalStatusEnumType | |
47e22477 JB |
98 | |
99 | export const DiagnosticsStatus = { | |
66a7748d JB |
100 | ...OCPP16DiagnosticsStatus |
101 | } as const | |
102 | // eslint-disable-next-line @typescript-eslint/no-redeclare | |
103 | export type DiagnosticsStatus = OCPP16DiagnosticsStatus | |
e3018bc4 | 104 | |
d4c84337 | 105 | export const FirmwareStatus = { |
66a7748d JB |
106 | ...OCPP16FirmwareStatus |
107 | } as const | |
108 | // eslint-disable-next-line @typescript-eslint/no-redeclare | |
109 | export type FirmwareStatus = OCPP16FirmwareStatus | |
d4c84337 | 110 | |
66a7748d | 111 | export type ResponseType = JsonType | OCPPError |
66dd3447 | 112 | |
66a7748d | 113 | export type ReserveNowRequest = OCPP16ReserveNowRequest |
66dd3447 | 114 | |
66a7748d | 115 | export type CancelReservationRequest = OCPP16CancelReservationRequest |