Crates.io | hciraw |
lib.rs | hciraw |
version | 1.0.1 |
source | src |
created_at | 2020-03-30 16:57:34.456986 |
updated_at | 2020-03-30 16:57:34.456986 |
description | The interface to HCI Raw Sockets |
homepage | |
repository | https://gitlab.com/kzapalowicz/hciraw |
max_upload_size | |
id | 224471 |
size | 15,144 |
The Rust interface to the HCI raw sockets. It is useful for anybody who wants to have a direct access to the Bluetooth controller.
use hciraw::{HciChannel, HciRawSocket, HciSocketAddr};
fn main() -> std::io::Result<()> {
let addr = hciraw::HciSocketAddr::new(None, HciChannel::Control);
let socket = hciraw::HciSocket::bind(addr)?;
let sdata: [u8; 6] = [0x01, 0x00, 0xff, 0x00, 0x00];
let snum = socket.send(&sdata)?;
println!("Send {} bytes", snum);
let mut rbuf = vec![0;128];
rnum = socket.recv(rbuf.as_mut_slice())?;
println!("Read {} bytes", rnum);
}