+ return [uuid, procedureName, requestPayload]
+ }
+
+ public buildProtocolResponse (
+ uuid: `${string}-${string}-${string}-${string}-${string}`,
+ responsePayload: ResponsePayload
+ ): ProtocolResponse {
+ return [uuid, responsePayload]
+ }
+
+ public stop (): void {
+ this.stopHttpServer()
+ for (const uiService of this.uiServices.values()) {
+ uiService.stop()
+ }
+ this.clearCaches()
+ }
+
+ public clearCaches (): void {
+ this.chargingStations.clear()
+ this.chargingStationTemplates.clear()
+ }
+
+ public async sendInternalRequest (request: ProtocolRequest): Promise<ProtocolResponse> {
+ const protocolVersion = ProtocolVersion['0.0.1']
+ this.registerProtocolVersionUIService(protocolVersion)
+ return await (this.uiServices
+ .get(protocolVersion)
+ ?.requestHandler(request) as Promise<ProtocolResponse>)
+ }
+
+ public hasResponseHandler (uuid: `${string}-${string}-${string}-${string}-${string}`): boolean {
+ return this.responseHandlers.has(uuid)
+ }
+
+ protected startHttpServer (): void {
+ this.httpServer.on('error', error => {
+ logger.error(
+ `${this.logPrefix(moduleName, 'start.httpServer.on.error')} HTTP server error:`,
+ error
+ )
+ })
+ if (!this.httpServer.listening) {
+ this.httpServer.listen(this.uiServerConfiguration.options)
+ }