Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/src/ui/web/dist
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,9 +450,9 @@ Response:
Request:
`ProcedureName`: 'startTransaction'
`PDU`: {
`hashId`: the unique identifier of a charging station
`connectorId`: the id of the connector
`idTag`: the RFID tag
`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array,
`connectorId`: connector id integer,
`idTag`: RFID tag string
}

Response:
Expand All @@ -465,8 +465,8 @@ Response:
Request:
`ProcedureName`: 'stopTransaction'
`PDU`: {
`hashId`: the unique identifier of a charging station
`transactionId`: the id of the transaction
`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array,
`transactionId`: transaction id integer
}

Response:
Expand All @@ -479,7 +479,7 @@ Response:
Request:
`ProcedureName`: 'startChargingStation'
`PDU`: {
`hashId`: the unique identifier of a charging station
`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array
}

Response:
Expand All @@ -492,7 +492,7 @@ Response:
Request:
`ProcedureName`: 'stopChargingStation'
`PDU`: {
`hashId`: the unique identifier of a charging station
`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array
}

Response:
Expand All @@ -505,7 +505,7 @@ Response:
Request:
`ProcedureName`: 'openConnection'
`PDU`: {
`hashId`: the unique identifier of a charging station
`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array
}

Response:
Expand All @@ -518,7 +518,7 @@ Response:
Request:
`ProcedureName`: 'closeConnection'
`PDU`: {
`hashId`: the unique identifier of a charging station
`hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array
}

Response:
Expand Down
16 changes: 15 additions & 1 deletion src/charging-station/ChargingStationWorkerBroadcastChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,23 @@ export default class ChargingStationWorkerBroadcastChannel extends WorkerBroadca

const [uuid, command, requestPayload] = messageEvent.data as BroadcastChannelRequest;

if (requestPayload?.hashId !== this.chargingStation.hashId) {
if (
requestPayload?.hashId === undefined &&
(requestPayload?.hashIds as string[])?.includes(this.chargingStation.hashId) === false
) {
return;
}
if (
requestPayload?.hashIds === undefined &&
requestPayload?.hashId !== this.chargingStation.hashId
) {
return;
}
if (requestPayload?.hashId !== undefined) {
logger.warn(
`${this.chargingStation.logPrefix()} ${moduleName}.requestHandler: 'hashId' field usage in PDU is deprecated, use 'hashIds' instead`
);
}

let responsePayload: BroadcastChannelResponsePayload;
let commandResponse: CommandResponse;
Expand Down
1 change: 1 addition & 0 deletions src/types/UIProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export enum ProcedureName {

export interface RequestPayload extends JsonObject {
hashId?: string;
hashIds?: string[];
}

export enum ResponseStatus {
Expand Down
15 changes: 13 additions & 2 deletions src/types/WorkerBroadcastChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,24 @@ export enum BroadcastChannelProcedureName {
CLOSE_CONNECTION = 'closeConnection',
}

export interface BroadcastChannelRequestPayload extends Omit<RequestPayload, 'hashId'> {
hashId: string;
interface BaseBroadcastChannelRequestPayload extends Omit<RequestPayload, 'hashId' | 'hashIds'> {
connectorId?: number;
transactionId?: number;
idTag?: string;
}

interface HashIdBroadcastChannelRequestPayload extends BaseBroadcastChannelRequestPayload {
hashId: string;
}

interface HashIdsBroadcastChannelRequestPayload extends BaseBroadcastChannelRequestPayload {
hashIds: string[];
}

export type BroadcastChannelRequestPayload =
| HashIdBroadcastChannelRequestPayload
| HashIdsBroadcastChannelRequestPayload;

export type BroadcastChannelResponsePayload = ResponsePayload;

export type MessageEvent = { data: BroadcastChannelRequest | BroadcastChannelResponse };
1 change: 1 addition & 0 deletions src/ui/web/src/type/UIProtocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export enum ProcedureName {
}
export interface RequestPayload extends JsonObject {
hashId?: string;
hashIds?: string[];
}

export enum ResponseStatus {
Expand Down