X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Ftypes%2Focpp%2FRequests.ts;h=2808e2f56a31dc3cb0d7b60176a81d9fd6dc7a3b;hb=72495c24c4e750fce20245faca4609dd4eacd7ba;hp=ea2da2436ddf00d66d85309b3c229030a3aef56b;hpb=690e5af73261da3434b37ef02c67c22ff19b8e5e;p=e-mobility-charging-stations-simulator.git diff --git a/src/types/ocpp/Requests.ts b/src/types/ocpp/Requests.ts index ea2da243..2808e2f5 100644 --- a/src/types/ocpp/Requests.ts +++ b/src/types/ocpp/Requests.ts @@ -1,11 +1,39 @@ -import { IncomingRequestCommand } from './1.6/Requests'; +import { OCPP16AvailabilityType, OCPP16BootNotificationRequest, OCPP16IncomingRequestCommand, OCPP16RequestCommand } from './1.6/Requests'; + import { MessageType } from './MessageType'; -import OCPPError from '../../charging-station/OcppError'; +import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus'; +import OCPPError from '../../exception/OCPPError'; + +export type IncomingRequestHandler = (commandPayload: Record) => Record | Promise>; + +export type BootNotificationRequest = OCPP16BootNotificationRequest; + +export type AvailabilityType = OCPP16AvailabilityType; + +export const AvailabilityType = { + ...OCPP16AvailabilityType +}; + +export type RequestCommand = OCPP16RequestCommand; -export default interface Requests { - [id: string]: Request; -} +export const RequestCommand = { + ...OCPP16RequestCommand +}; -export type Request = [(payload?: Record, requestPayload?: Record) => void, (error?: OCPPError) => void, Record]; +export type IncomingRequestCommand = OCPP16IncomingRequestCommand; + +export const IncomingRequestCommand = { + ...OCPP16IncomingRequestCommand +}; + +export type DiagnosticsStatus = OCPP16DiagnosticsStatus; + +export const DiagnosticsStatus = { + ...OCPP16DiagnosticsStatus +}; + +export type Request = [MessageType, string, RequestCommand, Record, Record]; export type IncomingRequest = [MessageType, string, IncomingRequestCommand, Record, Record]; + +export type CachedRequest = [(payload: Record | string, requestPayload: Record) => void, (error: OCPPError, requestStatistic?: boolean) => void, RequestCommand | IncomingRequestCommand, Record];