AvailabilityType,
BootNotificationRequest,
CachedRequest,
+ ErrorCallback,
HeartbeatRequest,
IncomingRequest,
IncomingRequestCommand,
MeterValuesRequest,
RequestCommand,
+ ResponseCallback,
StatusNotificationRequest,
} from '../types/ocpp/Requests';
import {
let errorType: ErrorType;
let errorMessage: string;
let errorDetails: JsonType;
- let responseCallback: (payload: JsonType, requestPayload: JsonType) => void;
- let errorCallback: (error: OCPPError, requestStatistic?: boolean) => void;
+ let responseCallback: ResponseCallback;
+ let errorCallback: ErrorCallback;
let requestCommandName: RequestCommand | IncomingRequestCommand;
let requestPayload: JsonType;
let cachedRequest: CachedRequest;
import { ErrorType } from '../../types/ocpp/ErrorType';
import { MessageType } from '../../types/ocpp/MessageType';
import {
+ ErrorCallback,
IncomingRequestCommand,
OutgoingRequest,
RequestCommand,
RequestParams,
+ ResponseCallback,
ResponseType,
} from '../../types/ocpp/Requests';
import type { ErrorResponse, Response } from '../../types/ocpp/Responses';
messagePayload: JsonType | OCPPError,
messageType: MessageType,
commandName?: RequestCommand | IncomingRequestCommand,
- responseCallback?: (payload: JsonType, requestPayload: JsonType) => void,
- errorCallback?: (error: OCPPError, requestStatistic?: boolean) => void
+ responseCallback?: ResponseCallback,
+ errorCallback?: ErrorCallback
): string {
let messageToSend: string;
// Type of message
export type IncomingRequest = [MessageType.CALL_MESSAGE, string, IncomingRequestCommand, JsonType];
+export type ResponseCallback = (payload: JsonType, requestPayload: JsonType) => void;
+
+export type ErrorCallback = (error: OCPPError, requestStatistic?: boolean) => void;
+
export type CachedRequest = [
- (payload: JsonType, requestPayload: JsonType) => void,
- (error: OCPPError, requestStatistic?: boolean) => void,
+ ResponseCallback,
+ ErrorCallback,
RequestCommand | IncomingRequestCommand,
JsonType
];