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: add support charging profile validity interval
[e-mobility-charging-stations-simulator.git]
/
src
/
charging-station
/
ocpp
/
OCPPServiceUtils.ts
diff --git
a/src/charging-station/ocpp/OCPPServiceUtils.ts
b/src/charging-station/ocpp/OCPPServiceUtils.ts
index dcd7447272a4dccb74c1dc21844141f2353385b2..5dbe2fb4953d66ab535141e0ac4de12362f2af74 100644
(file)
--- a/
src/charging-station/ocpp/OCPPServiceUtils.ts
+++ b/
src/charging-station/ocpp/OCPPServiceUtils.ts
@@
-7,7
+7,7
@@
import type { DefinedError, ErrorObject, JSONSchemaType } from 'ajv';
import { OCPP16Constants } from './1.6/OCPP16Constants';
import { OCPP20Constants } from './2.0/OCPP20Constants';
import { OCPPConstants } from './OCPPConstants';
import { OCPP16Constants } from './1.6/OCPP16Constants';
import { OCPP20Constants } from './2.0/OCPP20Constants';
import { OCPPConstants } from './OCPPConstants';
-import { type ChargingStation,
ChargingStationConfigurationUtils
} from '../../charging-station';
+import { type ChargingStation,
getConfigurationKey
} from '../../charging-station';
import { BaseError } from '../../exception';
import {
ChargePointErrorCode,
import { BaseError } from '../../exception';
import {
ChargePointErrorCode,
@@
-15,7
+15,6
@@
import {
ErrorType,
FileType,
IncomingRequestCommand,
ErrorType,
FileType,
IncomingRequestCommand,
- type JsonObject,
type JsonType,
MessageTrigger,
MessageType,
type JsonType,
MessageTrigger,
MessageType,
@@
-144,10
+143,14
@@
export class OCPPServiceUtils {
}
public static convertDateToISOString<T extends JsonType>(obj: T): void {
}
public static convertDateToISOString<T extends JsonType>(obj: T): void {
- for (const key in obj as JsonObject) {
+ for (const key in obj) {
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
if (obj![key] instanceof Date) {
if (obj![key] instanceof Date) {
- obj![key] = (obj![key] as Date).toISOString();
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
+ (obj![key] as string) = (obj![key] as Date).toISOString();
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
} else if (obj![key] !== null && typeof obj![key] === 'object') {
} else if (obj![key] !== null && typeof obj![key] === 'object') {
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
OCPPServiceUtils.convertDateToISOString<T>(obj![key] as T);
}
}
OCPPServiceUtils.convertDateToISOString<T>(obj![key] as T);
}
}
@@
-305,7
+308,7
@@
export class OCPPServiceUtils {
}
if (
measurand !== MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER &&
}
if (
measurand !== MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER &&
-
ChargingStationConfigurationUtils.
getConfigurationKey(
+ getConfigurationKey(
chargingStation,
StandardParametersKey.MeterValuesSampledData,
)?.value?.includes(measurand) === false
chargingStation,
StandardParametersKey.MeterValuesSampledData,
)?.value?.includes(measurand) === false
@@
-337,7
+340,7
@@
export class OCPPServiceUtils {
phase &&
sampledValueTemplates[index]?.phase === phase &&
sampledValueTemplates[index]?.measurand === measurand &&
phase &&
sampledValueTemplates[index]?.phase === phase &&
sampledValueTemplates[index]?.measurand === measurand &&
-
ChargingStationConfigurationUtils.
getConfigurationKey(
+ getConfigurationKey(
chargingStation,
StandardParametersKey.MeterValuesSampledData,
)?.value?.includes(measurand) === true
chargingStation,
StandardParametersKey.MeterValuesSampledData,
)?.value?.includes(measurand) === true
@@
-347,7
+350,7
@@
export class OCPPServiceUtils {
!phase &&
!sampledValueTemplates[index].phase &&
sampledValueTemplates[index]?.measurand === measurand &&
!phase &&
!sampledValueTemplates[index].phase &&
sampledValueTemplates[index]?.measurand === measurand &&
-
ChargingStationConfigurationUtils.
getConfigurationKey(
+ getConfigurationKey(
chargingStation,
StandardParametersKey.MeterValuesSampledData,
)?.value?.includes(measurand) === true
chargingStation,
StandardParametersKey.MeterValuesSampledData,
)?.value?.includes(measurand) === true