pub struct ParsedAdvertisement {
pub address: String,
pub rssi: i8,
pub beacon: Option<HiveBeacon>,
pub encrypted_service_data: Option<Vec<u8>>,
pub local_name: Option<String>,
pub tx_power: Option<i8>,
pub connectable: bool,
}Expand description
Parsed advertising data from a discovered device
Fields§
§address: StringDevice address (MAC or platform-specific)
rssi: i8RSSI in dBm
beacon: Option<HiveBeacon>Parsed HIVE beacon (if this is a HIVE device with plaintext beacon)
encrypted_service_data: Option<Vec<u8>>Raw encrypted beacon service data (if version 0x02 beacon detected)
Platform code should populate this when it detects service data starting with version byte 0x02 (encrypted beacon format). The Scanner will attempt decryption if a beacon key is configured.
local_name: Option<String>Device local name
tx_power: Option<i8>TX power level (if advertised)
connectable: boolWhether the device is connectable
Implementations§
Source§impl ParsedAdvertisement
impl ParsedAdvertisement
Sourcepub fn is_hive_device(&self) -> bool
pub fn is_hive_device(&self) -> bool
Check if this is a HIVE device
Returns true if either a plaintext beacon is present or encrypted service data is available (which may be decryptable by the Scanner).
Sourcepub fn estimated_distance_meters(&self) -> Option<f32>
pub fn estimated_distance_meters(&self) -> Option<f32>
Estimate distance based on RSSI and TX power
Uses the log-distance path loss model: distance = 10 ^ ((tx_power - rssi) / (10 * n)) where n is the path loss exponent (typically 2-4)
Note: Requires std feature for floating point math.
Trait Implementations§
Source§impl Clone for ParsedAdvertisement
impl Clone for ParsedAdvertisement
Source§fn clone(&self) -> ParsedAdvertisement
fn clone(&self) -> ParsedAdvertisement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more