multipleOfPrecision: 2,
});
ajvFormats(this.ajv);
- this.incomingRequestHandler.bind(this);
- this.validateIncomingRequestPayload.bind(this);
+ this.incomingRequestHandler = this.incomingRequestHandler.bind(this) as (
+ chargingStation: ChargingStation,
+ messageId: string,
+ commandName: IncomingRequestCommand,
+ commandPayload: JsonType
+ ) => Promise<void>;
+ this.validateIncomingRequestPayload = this.validateIncomingRequestPayload.bind(this) as <
+ T extends JsonType
+ >(
+ chargingStation: ChargingStation,
+ commandName: IncomingRequestCommand,
+ schema: JSONSchemaType<T>,
+ payload: T
+ ) => boolean;
}
public static getInstance<T extends OCPPIncomingRequestService>(this: new () => T): T {
});
ajvFormats(this.ajv);
this.ocppResponseService = ocppResponseService;
- this.requestHandler.bind(this);
- this.sendMessage.bind(this);
- this.sendResponse.bind(this);
- this.sendError.bind(this);
- this.internalSendMessage.bind(this);
- this.buildMessageToSend.bind(this);
- this.validateRequestPayload.bind(this);
- this.validateIncomingRequestResponsePayload.bind(this);
+ this.requestHandler = this.requestHandler.bind(this) as <
+ ReqType extends JsonType,
+ ResType extends JsonType
+ >(
+ chargingStation: ChargingStation,
+ commandName: RequestCommand,
+ commandParams?: JsonType,
+ params?: RequestParams
+ ) => Promise<ResType>;
+ this.sendMessage = this.sendMessage.bind(this) as (
+ chargingStation: ChargingStation,
+ messageId: string,
+ messagePayload: JsonType,
+ commandName: RequestCommand,
+ params?: RequestParams
+ ) => Promise<ResponseType>;
+ this.sendResponse = this.sendResponse.bind(this) as (
+ chargingStation: ChargingStation,
+ messageId: string,
+ messagePayload: JsonType,
+ commandName: IncomingRequestCommand
+ ) => Promise<ResponseType>;
+ this.sendError = this.sendError.bind(this) as (
+ chargingStation: ChargingStation,
+ messageId: string,
+ ocppError: OCPPError,
+ commandName: RequestCommand | IncomingRequestCommand
+ ) => Promise<ResponseType>;
+ this.internalSendMessage = this.internalSendMessage.bind(this) as (
+ chargingStation: ChargingStation,
+ messageId: string,
+ messagePayload: JsonType | OCPPError,
+ messageType: MessageType,
+ commandName: RequestCommand | IncomingRequestCommand,
+ params?: RequestParams
+ ) => Promise<ResponseType>;
+ this.buildMessageToSend = this.buildMessageToSend.bind(this) as (
+ chargingStation: ChargingStation,
+ messageId: string,
+ messagePayload: JsonType | OCPPError,
+ messageType: MessageType,
+ commandName: RequestCommand | IncomingRequestCommand,
+ responseCallback: ResponseCallback,
+ errorCallback: ErrorCallback
+ ) => string;
+ this.validateRequestPayload = this.validateRequestPayload.bind(this) as <T extends JsonObject>(
+ chargingStation: ChargingStation,
+ commandName: RequestCommand | IncomingRequestCommand,
+ payload: T
+ ) => boolean;
+ this.validateIncomingRequestResponsePayload = this.validateIncomingRequestResponsePayload.bind(
+ this
+ ) as <T extends JsonObject>(
+ chargingStation: ChargingStation,
+ commandName: RequestCommand | IncomingRequestCommand,
+ payload: T
+ ) => boolean;
}
public static getInstance<T extends OCPPRequestService>(
multipleOfPrecision: 2,
});
ajvFormats(this.ajv);
- this.responseHandler.bind(this);
- this.validateResponsePayload.bind(this);
+ this.responseHandler = this.responseHandler.bind(this) as (
+ chargingStation: ChargingStation,
+ commandName: RequestCommand,
+ payload: JsonType,
+ requestPayload: JsonType
+ ) => Promise<void>;
+ this.validateResponsePayload = this.validateResponsePayload.bind(this) as <T extends JsonType>(
+ chargingStation: ChargingStation,
+ commandName: RequestCommand,
+ schema: JSONSchemaType<T>,
+ payload: T
+ ) => boolean;
}
public static getInstance<T extends OCPPResponseService>(this: new () => T): T {