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