A modern, asynchronous TUI (Terminal User Interface) client for browsing, reading, and writing OPC DA (Data Access) tags on Windows.
The project is structured as a Cargo workspace with two crates:
opc-cli: The interactive TUI application built withratatui+crossterm.opc-da-client: A native Windows COM library (usingwindows-rs) that abstracts OPC DA communication through an async trait (OpcProvider). Generic overServerConnectorfor easy mocking.
See architecture.md for the full design, state machine, and data flow diagrams.
- Server Discovery: Enumerate OPC DA servers on local or remote hosts.
- Hierarchical Browsing: Recursive exploration of complex server namespaces with partial-result harvesting on timeout.
- Real-time Monitoring: Live tag value updates with 1-second auto-refresh.
- Tag Write Support: Write typed values (int, float, bool, string) to individual tags.
- Search & Filter: Substring search with
Tab/Shift+Tabcycling through matches. - Rich Error Hints: Human-readable explanations for cryptic Windows COM/DCOM HRESULT codes.
- RAII COM Guard: Safe COM initialization/teardown via
ComGuard— no manualCoUninitialize. - Mockable Backend: Unit-test the TUI on any OS without a live OPC server.
- Windows OS: This application uses Windows COM/DCOM.
- OPC Core Components: Must be installed on the system to resolve OPC ProgIDs.
- Rust 1.93+: Edition 2024.
# Run the TUI
cargo run --bin opc-cli
# Run the full verification gate (format → lint → test)
pwsh -File scripts/verify.ps1| Key | Action | Screen |
|---|---|---|
Enter |
Navigate forward / Confirm input | All |
Esc |
Navigate back | All |
Space |
Toggle tag selection | Tag List |
s |
Enter search/filter mode | Tag List |
Tab / Shift+Tab |
Cycle through search matches | Tag List (search) |
w |
Enter write mode for selected tag | Tag Values |
↑ / ↓ |
Navigate lists | All lists |
PgUp / PgDn |
Page through lists (20 items) | All lists |
q / Q |
Quit application | Home |
This project is licensed under the MIT License — see the LICENSE file for details.