import { EventEmitter } from "node:events"; import { LinuxCNCStat, LinuxCNCStatPaths, StatPropertyWatchCallback, ToolEntry, StatChange } from "@linuxcnc-node/types"; export declare const DEFAULT_STAT_POLL_INTERVAL = 50; export type { StatDeltaResult } from "./native_type_interfaces"; export interface StatWatcherOptions { pollInterval?: number; } export declare class StatChannel extends EventEmitter { private nativeInstance; private pollInterval; private poller; private isPolling; private cursor; private currentStat; private watchedProperties; constructor(options?: StatWatcherOptions); private startPolling; private stopPolling; private performPoll; /** * Ensures that a property path is being tracked for changes. * This initializes the lastValue for comparing changes. */ private ensureWatched; /** * Registers a listener for changes to a specific property path. * @param propertyPath A dot-separated path to the property (e.g., "task.motionLine", "motion.joint.0.homed"). * @param listener The function to call when the property's value changes. * @returns this (for chaining) */ on(event: "delta", listener: (changes: StatChange[]) => void): this; on

(propertyPath: P, listener: StatPropertyWatchCallback

): this; /** * Registers a one-time listener for changes to a specific property path. * The listener will be removed after it fires once. * @param propertyPath A dot-separated path to the property. * @param listener The function to call when the property's value changes. * @returns this (for chaining) */ once

(propertyPath: P, listener: StatPropertyWatchCallback

): this; /** * Removes a listener for a specific property path. * @param propertyPath The property path. * @param listener The listener function to remove. * @returns this (for chaining) */ off(event: "delta", listener: (changes: StatChange[]) => void): this; off

(propertyPath: P, listener: StatPropertyWatchCallback

): this; /** * Removes a listener for a specific property path. * Alias for off(). * @param propertyPath The property path. * @param listener The listener function to remove. * @returns this (for chaining) */ removeListener

(propertyPath: P, listener: StatPropertyWatchCallback

): this; /** * Sets the polling interval for status updates. * @param interval The new interval in milliseconds. */ setPollInterval(interval: number): void; /** * Gets the current polling interval. * @returns The interval in milliseconds. */ getPollInterval(): number; /** * Retrieves the most recent full status object. * @returns The current LinuxCNCStat object, or null if not yet available. */ get(): LinuxCNCStat | null; /** * Forces a full resync of the stat object from native. * Use this if cursor gaps are detected or for initial sync scenarios. */ sync(): void; /** * Gets the current cursor value for sync verification. * The cursor increments each time the native layer detects changes. * @returns The current cursor value. */ getCursor(): number; /** * Cleans up resources, stopping the polling timer. */ destroy(): void; get task(): LinuxCNCStat["task"] | undefined; get motion(): LinuxCNCStat["motion"] | undefined; get io(): LinuxCNCStat["io"] | undefined; get toolTable(): ToolEntry[] | undefined; }