jimjibone / deconz-sp

Rust library implementing deCONZ Serial Protocol

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deconz-sp

A tokio-based Rust library that implements deCONZ Serial Protocol to interact with deCONZ devices.

Based on Serial Protocol specifications, tested with the ConBee USB gateway.

⚠️ Work in progress, library is not finalized. Do not use in production. ⚠️

Build

cargo build
cargo test

Example

See example/src/main.rs for a working example.

deconz_sp::Client wraps the communication with the device.
The Tokio runtime must be started to use the client.

tokio::run(futures::lazy(|| {
        let (client, notifications) = deconz_sp::Client::new("/dev/tty.usbserial-DM00ZSS9")
            .expect("Cannot initialize deCONZ client");
        // ...
}))

deconz_sp::Client::new returns a tuple (Client, Stream<Item = IncomingPayload>) where Client is used to send requests to device, and Stream is the stream of unsolicited received messages.

Run the example:

RUST_LOG=deconz_sp=TRACE cargo run

Built With

About

Rust library implementing deCONZ Serial Protocol


Languages

Language:Rust 100.0%