this.chargingStation = chargingStation;
this.ocppResponseService = ocppResponseService;
this.sendMessageHandler.bind(this);
+ this.sendResult.bind(this);
+ this.sendError.bind(this);
}
public static getInstance<T extends OCPPRequestService>(
chargingStation: ChargingStation,
ocppResponseService: OCPPResponseService
): T {
- if (!OCPPRequestService.instances.has(chargingStation.id)) {
+ if (!OCPPRequestService.instances.has(chargingStation.hashId)) {
OCPPRequestService.instances.set(
- chargingStation.id,
+ chargingStation.hashId,
new this(chargingStation, ocppResponseService)
);
}
- return OCPPRequestService.instances.get(chargingStation.id) as T;
+ return OCPPRequestService.instances.get(chargingStation.hashId) as T;
}
public async sendResult(
}
}
- public abstract sendMessageHandler(
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ public abstract sendMessageHandler<Request extends JsonType, Response extends JsonType>(
commandName: RequestCommand,
commandParams?: JsonType,
params?: SendParams
- ): Promise<ResponseType>;
+ ): Promise<Response>;
}