- public readonly index: number;
- public readonly templateFile: string;
- public stationInfo!: ChargingStationInfo;
- public started: boolean;
- public starting: boolean;
- public idTagsCache: IdTagsCache;
- public automaticTransactionGenerator!: AutomaticTransactionGenerator | undefined;
- public ocppConfiguration!: ChargingStationOcppConfiguration | undefined;
- public wsConnection: WebSocket | null;
- public readonly connectors: Map<number, ConnectorStatus>;
- public readonly evses: Map<number, EvseStatus>;
- public readonly requests: Map<string, CachedRequest>;
- public performanceStatistics!: PerformanceStatistics | undefined;
- public heartbeatSetInterval?: NodeJS.Timeout;
- public ocppRequestService!: OCPPRequestService;
- public bootNotificationRequest!: BootNotificationRequest;
- public bootNotificationResponse!: BootNotificationResponse | undefined;
- public powerDivider!: number;
- private stopping: boolean;
- private configurationFile!: string;
- private configurationFileHash!: string;
- private connectorsConfigurationHash!: string;
- private evsesConfigurationHash!: string;
- private automaticTransactionGeneratorConfiguration?: AutomaticTransactionGeneratorConfiguration;
- private ocppIncomingRequestService!: OCPPIncomingRequestService;
- private readonly messageBuffer: Set<string>;
- private configuredSupervisionUrl!: URL;
- private autoReconnectRetryCount: number;
- private templateFileWatcher!: FSWatcher | undefined;
- private templateFileHash!: string;
- private readonly sharedLRUCache: SharedLRUCache;
- private webSocketPingSetInterval?: NodeJS.Timeout;
- private readonly chargingStationWorkerBroadcastChannel: ChargingStationWorkerBroadcastChannel;
- private flushMessageBufferSetInterval?: NodeJS.Timeout;
-
- constructor(index: number, templateFile: string) {
- super();
- this.started = false;
- this.starting = false;
- this.stopping = false;
- this.wsConnection = null;
- this.autoReconnectRetryCount = 0;
- this.index = index;
- this.templateFile = templateFile;
- this.connectors = new Map<number, ConnectorStatus>();
- this.evses = new Map<number, EvseStatus>();
- this.requests = new Map<string, CachedRequest>();
- this.messageBuffer = new Set<string>();
- this.sharedLRUCache = SharedLRUCache.getInstance();
- this.idTagsCache = IdTagsCache.getInstance();
- this.chargingStationWorkerBroadcastChannel = new ChargingStationWorkerBroadcastChannel(this);
-
+ public readonly index: number
+ public readonly templateFile: string
+ public stationInfo?: ChargingStationInfo
+ public started: boolean
+ public starting: boolean
+ public idTagsCache: IdTagsCache
+ public automaticTransactionGenerator?: AutomaticTransactionGenerator
+ public ocppConfiguration?: ChargingStationOcppConfiguration
+ public wsConnection: WebSocket | null
+ public readonly connectors: Map<number, ConnectorStatus>
+ public readonly evses: Map<number, EvseStatus>
+ public readonly requests: Map<string, CachedRequest>
+ public performanceStatistics?: PerformanceStatistics
+ public heartbeatSetInterval?: NodeJS.Timeout
+ public ocppRequestService!: OCPPRequestService
+ public bootNotificationRequest?: BootNotificationRequest
+ public bootNotificationResponse?: BootNotificationResponse
+ public powerDivider?: number
+ private stopping: boolean
+ private configurationFile!: string
+ private configurationFileHash!: string
+ private connectorsConfigurationHash!: string
+ private evsesConfigurationHash!: string
+ private automaticTransactionGeneratorConfiguration?: AutomaticTransactionGeneratorConfiguration
+ private ocppIncomingRequestService!: OCPPIncomingRequestService
+ private readonly messageBuffer: Set<string>
+ private configuredSupervisionUrl!: URL
+ private wsConnectionRetried: boolean
+ private wsConnectionRetryCount: number
+ private templateFileWatcher?: FSWatcher
+ private templateFileHash!: string
+ private readonly sharedLRUCache: SharedLRUCache
+ private wsPingSetInterval?: NodeJS.Timeout
+ private readonly chargingStationWorkerBroadcastChannel: ChargingStationWorkerBroadcastChannel
+ private flushMessageBufferSetInterval?: NodeJS.Timeout
+
+ constructor (index: number, templateFile: string, options?: ChargingStationOptions) {
+ super()
+ this.started = false
+ this.starting = false
+ this.stopping = false
+ this.wsConnection = null
+ this.wsConnectionRetried = false
+ this.wsConnectionRetryCount = 0
+ this.index = index
+ this.templateFile = templateFile
+ this.connectors = new Map<number, ConnectorStatus>()
+ this.evses = new Map<number, EvseStatus>()
+ this.requests = new Map<string, CachedRequest>()
+ this.messageBuffer = new Set<string>()
+ this.sharedLRUCache = SharedLRUCache.getInstance()
+ this.idTagsCache = IdTagsCache.getInstance()
+ this.chargingStationWorkerBroadcastChannel = new ChargingStationWorkerBroadcastChannel(this)
+
+ this.on(ChargingStationEvents.added, () => {
+ parentPort?.postMessage(buildAddedMessage(this))
+ })
+ this.on(ChargingStationEvents.deleted, () => {
+ parentPort?.postMessage(buildDeletedMessage(this))
+ })