Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Cross-platform Bluetooth Low Energy library for Rust. Supports Central, Peripheral, Broadcaster and Observer GAP roles.

License

NotificationsYou must be signed in to change notification settings

AndrewGi/btle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crates.iodocs.rslast commit

Cross-platform Bluetooth Low Energy library for Rust. Supports Central, Peripheral, Broadcaster and Observer GAP roles. Also supports custom device drivers to enable platform support for custom platforms (embedded, etc).

Very much WIP.

Supported Platforms so far:

  • Linux (BlueZ)
  • HCI
  • USB (usinglibusb)
  • Proxy
  • Windows 10 / UWP
  • Windows 7 (must uselibusb drivers)
  • macOS
  • iOS
  • Android

Any platforms missings drivers should still be able to compile, just without any built in way to talk to the BLE controller.

Supported GAP Roles so far:

  • Observer (Receiver Advertisements)
  • Broadcaster (Send Advertisements)
  • (WIP) Central (Initiate GATT Connection)
  • (WIP) Peripheral (GATT Connectable)

WIP Example (API may change later):

pubasyncfndump_adapter<A: btle::hci::adapter::Adapter>(adapter:A) ->Result<(),CLIError>{let adapter = btle::hci::adapters::Adapter::new(adapter);letmut le = adapter.le();println!("resetting adapter...");    le.adapter.reset().await?;println!("settings scan parameters...");// Set BLE Scan parameters (when to scan, how long, etc)    le.set_scan_parameters(btle::le::scan::ScanParameters::DEFAULT).await?;// Enable scanning for advertisement packets.    le.set_scan_enable(true,false).await?;println!("waiting for advertisements...");// Create the advertisement stream from the LEAdapter.letmut stream = le.advertisement_stream::<Box<[ReportInfo]>>().await?;// Pin it.letmut stream =unsafe{Pin::new_unchecked(&mut stream)};loop{// Asynchronously iterate through the stream and print each advertisement report.whileletSome(report) = stream.next().await{println!("report: {:?}",&report);}}}

About

Cross-platform Bluetooth Low Energy library for Rust. Supports Central, Peripheral, Broadcaster and Observer GAP roles.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp