-import { OCPP20ServiceUtils } from './OCPP20ServiceUtils';
-import type { ChargingStation } from '../../../charging-station';
-import { OCPPError } from '../../../exception';
+import { OCPP20ServiceUtils } from './OCPP20ServiceUtils.js'
+import type { ChargingStation } from '../../../charging-station/index.js'
+import { OCPPError } from '../../../exception/index.js'
type JsonType,
type OCPP20ClearCacheRequest,
OCPP20IncomingRequestCommand,
type JsonType,
type OCPP20ClearCacheRequest,
OCPP20IncomingRequestCommand,
- OCPPVersion,
-} from '../../../types';
-import { logger } from '../../../utils';
-import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService';
+ OCPPVersion
+} from '../../../types/index.js'
+import { logger } from '../../../utils/index.js'
+import { OCPPIncomingRequestService } from '../OCPPIncomingRequestService.js'
- protected jsonSchemas: Map<OCPP20IncomingRequestCommand, JSONSchemaType<JsonObject>>;
- private incomingRequestHandlers: Map<OCPP20IncomingRequestCommand, IncomingRequestHandler>;
+ protected jsonSchemas: Map<OCPP20IncomingRequestCommand, JSONSchemaType<JsonType>>
+ private readonly incomingRequestHandlers: Map<
+ OCPP20IncomingRequestCommand,
+ IncomingRequestHandler
+ >
- public constructor() {
- // if (new.target?.name === moduleName) {
- // throw new TypeError(`Cannot construct ${new.target?.name} instances directly`);
+ public constructor () {
+ // if (new.target.name === moduleName) {
+ // throw new TypeError(`Cannot construct ${new.target.name} instances directly`)
- [OCPP20IncomingRequestCommand.CLEAR_CACHE, this.handleRequestClearCache.bind(this)],
- ]);
- this.jsonSchemas = new Map<OCPP20IncomingRequestCommand, JSONSchemaType<JsonObject>>([
+ [OCPP20IncomingRequestCommand.CLEAR_CACHE, this.handleRequestClearCache.bind(this)]
+ ])
+ this.jsonSchemas = new Map<OCPP20IncomingRequestCommand, JSONSchemaType<JsonType>>([
[
OCPP20IncomingRequestCommand.CLEAR_CACHE,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheRequest>(
'assets/json-schemas/ocpp/2.0/ClearCacheRequest.json',
moduleName,
[
OCPP20IncomingRequestCommand.CLEAR_CACHE,
OCPP20ServiceUtils.parseJsonSchemaFile<OCPP20ClearCacheRequest>(
'assets/json-schemas/ocpp/2.0/ClearCacheRequest.json',
moduleName,
this.validatePayload = this.validatePayload.bind(this) as (
chargingStation: ChargingStation,
commandName: OCPP20IncomingRequestCommand,
this.validatePayload = this.validatePayload.bind(this) as (
chargingStation: ChargingStation,
commandName: OCPP20IncomingRequestCommand,
}
public async incomingRequestHandler<ReqType extends JsonType, ResType extends JsonType>(
chargingStation: ChargingStation,
messageId: string,
commandName: OCPP20IncomingRequestCommand,
}
public async incomingRequestHandler<ReqType extends JsonType, ResType extends JsonType>(
chargingStation: ChargingStation,
messageId: string,
commandName: OCPP20IncomingRequestCommand,
- chargingStation.getOcppStrictCompliance() === true &&
- chargingStation.inPendingState() === true &&
+ chargingStation.stationInfo?.ocppStrictCompliance === true &&
+ chargingStation.inPendingState() &&
(commandName === OCPP20IncomingRequestCommand.REQUEST_START_TRANSACTION ||
commandName === OCPP20IncomingRequestCommand.REQUEST_STOP_TRANSACTION)
) {
(commandName === OCPP20IncomingRequestCommand.REQUEST_START_TRANSACTION ||
commandName === OCPP20IncomingRequestCommand.REQUEST_STOP_TRANSACTION)
) {
- chargingStation.isRegistered() === true ||
- (chargingStation.getOcppStrictCompliance() === false &&
- chargingStation.inUnknownState() === true)
+ chargingStation.isRegistered() ||
+ (chargingStation.stationInfo?.ocppStrictCompliance === false &&
+ chargingStation.inUnknownState())
- this.incomingRequestHandlers.has(commandName) === true &&
- OCPP20ServiceUtils.isIncomingRequestCommandSupported(chargingStation, commandName) === true
+ this.incomingRequestHandlers.has(commandName) &&
+ OCPP20ServiceUtils.isIncomingRequestCommandSupported(chargingStation, commandName)
chargingStation: ChargingStation,
commandName: OCPP20IncomingRequestCommand,
chargingStation: ChargingStation,
commandName: OCPP20IncomingRequestCommand,