hciraw

Crates.iohciraw
lib.rshciraw
version1.0.1
sourcesrc
created_at2020-03-30 16:57:34.456986
updated_at2020-03-30 16:57:34.456986
descriptionThe interface to HCI Raw Sockets
homepage
repositoryhttps://gitlab.com/kzapalowicz/hciraw
max_upload_size
id224471
size15,144
Konrad Zapalowicz (bergotorino)

documentation

README

hciraw

The Rust interface to the HCI raw sockets. It is useful for anybody who wants to have a direct access to the Bluetooth controller.

Example

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);
}
Commit count: 21

cargo fmt