项目作者: Roba1993

项目描述 :
Rusty Z-Wave - A native Z-Wave library in Rust
高级语言: Rust
项目地址: git://github.com/Roba1993/rzw.git
创建时间: 2016-06-26T14:07:11Z
项目社区:https://github.com/Roba1993/rzw

开源协议:MIT License

下载


Rusty Z-Wave

The rzw crate provides a native functionality to control a Z-Wave network over a USB Z-Wave dongle. It’s completely written in Rust to ensure safety and performance.


Compatibility

The rzw crate depends on the serial create, which is compatible with Windows and any Unix operating system that implements the termios API. The following platforms are confirmed to be compatible:

  • Linux (x86_64, armv6l)
  • OS X (x86_64)
  • FreeBSD (amd64)
  • OpenBSD (amd64)
  • Windows (x86_64)
    Compiling the rzw crate requires Rust 1.9 or later.

Usage

Add rzw as a dependency in Cargo.toml:

  1. [dependencies]
  2. rzw = { git = "https://github.com/Roba1993/rzw" }

Use the rzw::Controller as starting point to communicate, with the Z-Wave network.

  1. extern crate rzw;
  2. fn main() {
  3. // Access the zwave network
  4. let zwave = rzw::open("/dev/tty.usbmodem1411").unwrap();
  5. // get all node ids
  6. let nodes = zwave.nodes();
  7. // loop over the nodes
  8. for node in nodes {
  9. // print the available command classes for each node
  10. println!("{:?}" zwave.node(node).map(|n| n.get_commands()));
  11. // set the basic value on all nodes
  12. // for binary switch this means, turn them on
  13. zwave.node(node_id).map(|n| n.basic_set(0xFF)).unwrap();
  14. }
  15. }

Resources


Thanks

  • To the serial-rs team - who made this crate possible.

License

Copyright © 2016 Robert Schütte

Distributed under the MIT License.