- private workerEventStarted = (data: ChargingStationData) => {
- this.uiServer?.chargingStations.set(data.stationInfo.hashId, data);
- ++this.numberOfStartedChargingStations;
+ private readonly workerEventAdded = (data: ChargingStationData): void => {
+ this.uiServer.chargingStations.set(data.stationInfo.hashId, data)
+ logger.info(
+ `${this.logPrefix()} ${moduleName}.workerEventAdded: Charging station ${
+ data.stationInfo.chargingStationId
+ } (hashId: ${data.stationInfo.hashId}) added (${
+ this.numberOfAddedChargingStations
+ } added from ${this.numberOfConfiguredChargingStations} configured charging station(s))`
+ )
+ }
+
+ private readonly workerEventDeleted = (data: ChargingStationData): void => {
+ this.uiServer.chargingStations.delete(data.stationInfo.hashId)
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ const templateChargingStations = this.templatesChargingStations.get(
+ data.stationInfo.templateName
+ )!
+ --templateChargingStations.added
+ templateChargingStations.indexes.delete(data.stationInfo.templateIndex)
+ logger.info(
+ `${this.logPrefix()} ${moduleName}.workerEventDeleted: Charging station ${
+ data.stationInfo.chargingStationId
+ } (hashId: ${data.stationInfo.hashId}) deleted (${
+ this.numberOfAddedChargingStations
+ } added from ${this.numberOfConfiguredChargingStations} configured charging station(s))`
+ )
+ }
+
+ private readonly workerEventStarted = (data: ChargingStationData): void => {
+ this.uiServer.chargingStations.set(data.stationInfo.hashId, data)
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+ ++this.templatesChargingStations.get(data.stationInfo.templateName)!.started