getConfigurationKey,
setConfigurationKeyValue,
} from './ConfigurationKeyUtils';
-import { IdTagsCache } from './IdTagsCache';
-import {
- OCPP16IncomingRequestService,
- OCPP16RequestService,
- OCPP16ResponseService,
- OCPP16ServiceUtils,
- OCPP20IncomingRequestService,
- OCPP20RequestService,
- OCPP20ResponseService,
- type OCPPIncomingRequestService,
- type OCPPRequestService,
- OCPPServiceUtils,
-} from './ocpp';
-import { SharedLRUCache } from './SharedLRUCache';
import {
buildConnectorsMap,
checkConnectorsConfiguration,
propagateSerialNumber,
stationTemplateToStationInfo,
warnTemplateKeysDeprecation,
-} from './Utils';
+} from './Helpers';
+import { IdTagsCache } from './IdTagsCache';
+import {
+ OCPP16IncomingRequestService,
+ OCPP16RequestService,
+ OCPP16ResponseService,
+ OCPP16ServiceUtils,
+ OCPP20IncomingRequestService,
+ OCPP20RequestService,
+ OCPP20ResponseService,
+ type OCPPIncomingRequestService,
+ type OCPPRequestService,
+ OCPPServiceUtils,
+} from './ocpp';
+import { SharedLRUCache } from './SharedLRUCache';
import { BaseError, OCPPError } from '../exception';
import { PerformanceStatistics } from '../performance';
import {
);
}
- public getReservationOnConnectorId0Enabled(): boolean {
+ public getReserveConnectorZeroSupported(): boolean {
return convertToBoolean(
getConfigurationKey(this, StandardParametersKey.ReserveConnectorZeroSupported)!.value,
);
this.startReservationExpirationSetInterval();
}
- public validateIncomingRequestWithReservation(connectorId: number, idTag: string): boolean {
- return this.getReservationBy('connectorId', connectorId)?.idTag === idTag;
- }
-
public isConnectorReservable(
reservationId: number,
idTag?: string,
connectorId?: number,
): boolean {
const reservationExists = !isUndefined(this.getReservationBy('reservationId', reservationId));
- const userReservationExists =
- !isUndefined(idTag) && isUndefined(this.getReservationBy('idTag', idTag!)) ? false : true;
- const notConnectorZero = isUndefined(connectorId) ? true : connectorId! > 0;
- const freeConnectorsAvailable = this.getNumberOfReservableConnectors() > 0;
- return (
- !reservationExists && !userReservationExists && notConnectorZero && freeConnectorsAvailable
- );
+ if (arguments.length === 1) {
+ return !reservationExists;
+ } else if (arguments.length > 1) {
+ const userReservationExists =
+ !isUndefined(idTag) && isUndefined(this.getReservationBy('idTag', idTag!)) ? false : true;
+ const notConnectorZero = isUndefined(connectorId) ? true : connectorId! > 0;
+ const freeConnectorsAvailable = this.getNumberOfReservableConnectors() > 0;
+ return (
+ !reservationExists && !userReservationExists && notConnectorZero && freeConnectorsAvailable
+ );
+ }
+ return false;
}
private getNumberOfReservableConnectors(): number {