X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=d730a2cb04f0bd5b37c825ce9b0a2def3b6fa16f;hb=69074173770c04bc5e5aa744b655edf9491daa46;hp=5d6ee757a7009f7dea6b3f31ea999eedc4e32bab;hpb=12f26d4a81773cf8ede8bad4255e36aadf10bce0;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 5d6ee757..d730a2cb 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -9,33 +9,28 @@ import { parentPort } from 'node:worker_threads'; import merge from 'just-merge'; import WebSocket, { type RawData } from 'ws'; +import { AutomaticTransactionGenerator } from './AutomaticTransactionGenerator'; +import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; +import { ChargingStationUtils } from './ChargingStationUtils'; +import { ChargingStationWorkerBroadcastChannel } from './ChargingStationWorkerBroadcastChannel'; +import { IdTagsCache } from './IdTagsCache'; +import { MessageChannelUtils } from './MessageChannelUtils'; import { - AutomaticTransactionGenerator, - ChargingStationConfigurationUtils, - ChargingStationUtils, - ChargingStationWorkerBroadcastChannel, - IdTagsCache, - MessageChannelUtils, - SharedLRUCache, -} from './internal'; -import { - // OCPP16IncomingRequestService, + OCPP16IncomingRequestService, OCPP16RequestService, - // OCPP16ResponseService, + OCPP16ResponseService, OCPP16ServiceUtils, OCPP20IncomingRequestService, OCPP20RequestService, - // OCPP20ResponseService, + OCPP20ResponseService, type OCPPIncomingRequestService, type OCPPRequestService, - // OCPPServiceUtils, + OCPPServiceUtils, } from './ocpp'; -import { OCPP16IncomingRequestService } from './ocpp/1.6/OCPP16IncomingRequestService'; -import { OCPP16ResponseService } from './ocpp/1.6/OCPP16ResponseService'; -import { OCPP20ResponseService } from './ocpp/2.0/OCPP20ResponseService'; -import { OCPPServiceUtils } from './ocpp/OCPPServiceUtils'; +import { SharedLRUCache } from './SharedLRUCache'; import { BaseError, OCPPError } from '../exception'; -import { PerformanceStatistics } from '../performance'; +// import { PerformanceStatistics } from '../performance'; +import { PerformanceStatistics } from '../performance/PerformanceStatistics'; import { type AutomaticTransactionGeneratorConfiguration, AvailabilityType, @@ -185,8 +180,9 @@ export class ChargingStation { }; public hasIdTags(): boolean { - const idTagsFile = ChargingStationUtils.getIdTagsFile(this.stationInfo); - return Utils.isNotEmptyArray(this.idTagsCache.getIdTags(idTagsFile)); + return Utils.isNotEmptyArray( + this.idTagsCache.getIdTags(ChargingStationUtils.getIdTagsFile(this.stationInfo)) + ); } public getEnableStatistics(): boolean { @@ -221,26 +217,26 @@ export class ChargingStation { return this?.bootNotificationResponse?.status; } - public isInUnknownState(): boolean { + public inUnknownState(): boolean { return Utils.isNullOrUndefined(this?.bootNotificationResponse?.status); } - public isInPendingState(): boolean { + public inPendingState(): boolean { return this?.bootNotificationResponse?.status === RegistrationStatusEnumType.PENDING; } - public isInAcceptedState(): boolean { + public inAcceptedState(): boolean { return this?.bootNotificationResponse?.status === RegistrationStatusEnumType.ACCEPTED; } - public isInRejectedState(): boolean { + public inRejectedState(): boolean { return this?.bootNotificationResponse?.status === RegistrationStatusEnumType.REJECTED; } public isRegistered(): boolean { return ( - this.isInUnknownState() === false && - (this.isInAcceptedState() === true || this.isInPendingState() === true) + this.inUnknownState() === false && + (this.inAcceptedState() === true || this.inPendingState() === true) ); } @@ -1689,7 +1685,7 @@ export class ChargingStation { ); } if (this.isRegistered() === true) { - if (this.isInAcceptedState() === true) { + if (this.inAcceptedState() === true) { await this.startMessageSequence(); } } else {