bluetooth-adv 0.2.0

Bluetooth LE advertising data: every AD type parsed, and beacon formats (iBeacon, Eddystone, AltBeacon, BTHome v2 with encryption, KKM, Ruuvi) decoded
Documentation

bluetooth-adv

crates.io docs.rs

Bluetooth LE advertising data, parsed and decoded.

cargo add bluetooth-adv

Advertisement::parse reads the AD structures of an advertisement or scan response (Core Specification Supplement, Part A) into typed fields, naming companies, UUIDs and appearance from the SIG's assigned numbers (bluetooth_numbers). beacon::decode then recognises beacon and sensor formats inside it.

Nothing here panics on any input: advertisements come off the air from devices nobody vetted, and every parser is fuzzed.

use bluetooth_adv::{Advertisement, beacon};
// Flags, then an iBeacon.
let data = hex::decode(
    "0201061aff4c000215e2c56db5dffb48d2b060d0f5a71096e000010002c5",
).unwrap();
let adv = Advertisement::parse(&data);
let beacons = beacon::decode(&adv, &beacon::Context::default());
assert!(matches!(beacons[0], beacon::Beacon::IBeacon(_)));

Part of bluetooth-bridge, maintained by Pulzar. See the user guide, the library guide and the API documentation.

License: MIT.