repositories
/
e-mobility-charging-stations-simulator.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
feat: ensure charging station add op return its station info
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ui-server
/
ui-services
/
AbstractUIService.ts
diff --git
a/src/charging-station/ui-server/ui-services/AbstractUIService.ts
b/src/charging-station/ui-server/ui-services/AbstractUIService.ts
index 6aed70a1b555cfcf5718cc153d02edc3e25da894..6652def2ad2f64e5a43cf30fb1ab0831a9dfdcda 100644
(file)
--- a/
src/charging-station/ui-server/ui-services/AbstractUIService.ts
+++ b/
src/charging-station/ui-server/ui-services/AbstractUIService.ts
@@
-2,6
+2,7
@@
import { BaseError, type OCPPError } from '../../../exception/index.js'
import {
BroadcastChannelProcedureName,
type BroadcastChannelRequestPayload,
import {
BroadcastChannelProcedureName,
type BroadcastChannelRequestPayload,
+ type ChargingStationInfo,
type ChargingStationOptions,
ConfigurationSection,
type JsonObject,
type ChargingStationOptions,
ConfigurationSection,
type JsonObject,
@@
-275,23
+276,30
@@
export abstract class AbstractUIService {
errorMessage: `Template '${template}' not found`
} satisfies ResponsePayload
}
errorMessage: `Template '${template}' not found`
} satisfies ResponsePayload
}
+ const stationInfos: ChargingStationInfo[] = []
for (let i = 0; i < numberOfStations; i++) {
for (let i = 0; i < numberOfStations; i++) {
+ let stationInfo: ChargingStationInfo | undefined
try {
try {
- await Bootstrap.getInstance().addChargingStation(
+
stationInfo =
await Bootstrap.getInstance().addChargingStation(
Bootstrap.getInstance().getLastIndex(template) + 1,
`${template}.json`,
options
)
Bootstrap.getInstance().getLastIndex(template) + 1,
`${template}.json`,
options
)
+ if (stationInfo != null) {
+ stationInfos.push(stationInfo)
+ }
} catch (error) {
return {
status: ResponseStatus.FAILURE,
} catch (error) {
return {
status: ResponseStatus.FAILURE,
+ ...(stationInfo?.hashId != null && { hashIdsFailed: [stationInfo.hashId] }),
errorMessage: (error as Error).message,
errorStack: (error as Error).stack
} satisfies ResponsePayload
}
}
return {
errorMessage: (error as Error).message,
errorStack: (error as Error).stack
} satisfies ResponsePayload
}
}
return {
- status: ResponseStatus.SUCCESS
+ status: ResponseStatus.SUCCESS,
+ hashIdsSucceeded: stationInfos.map(stationInfo => stationInfo.hashId)
}
}
}
}