Expand description
Shared monitoring primitives for device connectivity and config file changes.
Both the TUI main loop (sync, crossterm event loop) and the dashboard API (async, tokio) need to detect when audio devices appear/disappear and when the config file is edited on disk. This module provides the two polling / watching primitives they share, so neither consumer re-implements the logic.
Both types are synchronous and runtime-agnostic:
DevicePollerwraps a rate-limited CPAL enumeration loop and exposes a simplepoll() -> Option<Vec<String>>interface.ConfigFileWatcherspawns an OS-native file watcher thread (notify) and exposespoll() -> bool, matching the existing TUI contract.
Structsยง
- Config
File Watcher - Watches the config file for changes using OS-native file notifications.
- Device
Poller - Polls the system audio device inventory at a fixed interval and reports connectivity changes as human-readable event strings.