beaconc
Async Rust client library for the obscurity-beacond signal daemon.
beaconc is an async Rust client library for interacting with the beacond signal daemon via DBus. It provides a type-safe abstraction over the DBus interface, handling connection management and signal marshaling.
Features
The library provides access to all beacond operations:
- Activate and deactivate signals
- Query signal information and status
- Monitor real-time events (state changes, timeouts)
- Connect to session, system, or custom DBus addresses
The API uses async/await syntax and integrates with tokio-based applications.
Basic Usage
use obscurity_beaconc::{BeaconClient, SignalEvent, Result};
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let client = BeaconClient::new().await?;
// Activate a signal
client.activate_signal("warning").await?;
// Monitor events
let mut rx = client.subscribe_signals().await?;
while let Some(event) = rx.recv().await {
match event {
SignalEvent::StateChange(sc) =>
println!("{} is {}", sc.signal_name,
if sc.is_active { "active" } else { "inactive" }),
SignalEvent::Timeout(st) =>
println!("{} timed out", st.signal_name),
}
}
Ok(())
}Design
The library is built around these principles:
- Minimal dependencies: Only tokio, zbus, and futures-util
- Single-threaded runtime support: Works with tokio's
current_threadflavor - Type safety: Leverage Rust's type system to catch errors at compile time
- Simple API: Common operations are straightforward function calls
Current Status
✅ Feature-complete - All beacond operations are implemented and tested. The library supports signal control, event monitoring, and all connection types.
Implementation Details
The library abstracts DBus complexity by:
- Managing connection lifecycle automatically
- Handling signal subscriptions and event streaming
- Providing typed interfaces for all daemon operations
- Supporting flexible connection options (session/system/custom bus)
Links
- Repository: codeberg.org/obscurity-de/obscurity-beaconc
- Documentation: Architecture docs, ADRs, and requirements in the repository
- Related: beacond daemon, beaconctl CLI tool
- License: EUPL-1.2
Tech Stack
- Rust with async/await (tokio)
- zbus for DBus integration
- futures-util for stream handling
- Target: Embedded Linux environments
Suitable for IoT applications, embedded system interfaces, and industrial control software that needs to interact with beacond.