3 ProtocolRequestHandler
,
6 } from
'../../../types/UIProtocol';
8 BroadcastChannelProcedureName
,
9 BroadcastChannelRequestPayload
,
10 } from
'../../../types/WorkerBroadcastChannel';
11 import { AbstractUIServer
} from
'../AbstractUIServer';
12 import AbstractUIService from
'./AbstractUIService';
14 export default class UIService001
extends AbstractUIService
{
15 constructor(uiServer
: AbstractUIServer
) {
16 super(uiServer
, ProtocolVersion
['0.0.1']);
17 this.requestHandlers
.set(
18 ProcedureName
.START_TRANSACTION
,
19 this.handleStartTransaction
.bind(this) as ProtocolRequestHandler
21 this.requestHandlers
.set(
22 ProcedureName
.STOP_TRANSACTION
,
23 this.handleStopTransaction
.bind(this) as ProtocolRequestHandler
25 this.requestHandlers
.set(
26 ProcedureName
.START_CHARGING_STATION
,
27 this.handleStartChargingStation
.bind(this) as ProtocolRequestHandler
29 this.requestHandlers
.set(
30 ProcedureName
.STOP_CHARGING_STATION
,
31 this.handleStopChargingStation
.bind(this) as ProtocolRequestHandler
35 private handleStartTransaction(uuid
: string, payload
: RequestPayload
): void {
36 this.uiServiceWorkerBroadcastChannel
.sendRequest([
38 BroadcastChannelProcedureName
.START_TRANSACTION
,
39 payload
as BroadcastChannelRequestPayload
,
43 private handleStopTransaction(uuid
: string, payload
: RequestPayload
): void {
44 this.uiServiceWorkerBroadcastChannel
.sendRequest([
46 BroadcastChannelProcedureName
.STOP_TRANSACTION
,
47 payload
as BroadcastChannelRequestPayload
,
51 private handleStartChargingStation(uuid
: string, payload
: RequestPayload
): void {
52 this.uiServiceWorkerBroadcastChannel
.sendRequest([
54 BroadcastChannelProcedureName
.START_CHARGING_STATION
,
55 payload
as BroadcastChannelRequestPayload
,
59 private handleStopChargingStation(uuid
: string, payload
: RequestPayload
): void {
60 this.uiServiceWorkerBroadcastChannel
.sendRequest([
62 BroadcastChannelProcedureName
.STOP_CHARGING_STATION
,
63 payload
as BroadcastChannelRequestPayload
,