pub struct Advertiser { /* private fields */ }Expand description
HIVE Beacon Advertiser
Manages building and updating BLE advertisements containing HIVE beacons.
Implementations§
Source§impl Advertiser
impl Advertiser
Sourcepub fn new(config: DiscoveryConfig, node_id: NodeId) -> Self
pub fn new(config: DiscoveryConfig, node_id: NodeId) -> Self
Create a new advertiser with the given configuration and node ID
Sourcepub fn hive_lite(config: DiscoveryConfig, node_id: NodeId) -> Self
pub fn hive_lite(config: DiscoveryConfig, node_id: NodeId) -> Self
Create an advertiser for a HIVE-Lite node
Sourcepub fn set_time_ms(&mut self, time_ms: u64)
pub fn set_time_ms(&mut self, time_ms: u64)
Set the current time (call periodically from platform)
Sourcepub fn with_tx_power(self, tx_power: i8) -> Self
pub fn with_tx_power(self, tx_power: i8) -> Self
Set TX power level
Sourcepub fn with_extended_advertising(self, enabled: bool) -> Self
pub fn with_extended_advertising(self, enabled: bool) -> Self
Enable extended advertising
Sourcepub fn state(&self) -> AdvertiserState
pub fn state(&self) -> AdvertiserState
Get current state
Sourcepub fn beacon(&self) -> &HiveBeacon
pub fn beacon(&self) -> &HiveBeacon
Get the current beacon
Sourcepub fn beacon_mut(&mut self) -> &mut HiveBeacon
pub fn beacon_mut(&mut self) -> &mut HiveBeacon
Get mutable access to the beacon
Sourcepub fn set_hierarchy_level(&mut self, level: HierarchyLevel)
pub fn set_hierarchy_level(&mut self, level: HierarchyLevel)
Update hierarchy level
Sourcepub fn set_capabilities(&mut self, caps: u16)
pub fn set_capabilities(&mut self, caps: u16)
Update capabilities
Sourcepub fn set_battery(&mut self, percent: u8)
pub fn set_battery(&mut self, percent: u8)
Update battery percentage
Sourcepub fn set_geohash(&mut self, geohash: u32)
pub fn set_geohash(&mut self, geohash: u32)
Update geohash
Sourcepub fn advertising_duration_ms(&self) -> Option<u64>
pub fn advertising_duration_ms(&self) -> Option<u64>
Get duration of current advertising session in milliseconds
Sourcepub fn increment_sequence(&mut self)
pub fn increment_sequence(&mut self)
Increment sequence number and invalidate cache
Sourcepub fn build_packet(&mut self) -> &AdvertisingPacket
pub fn build_packet(&mut self) -> &AdvertisingPacket
Build the advertising packet
Uses cached packet if available and not dirty.
Sourcepub fn rebuild_packet(&mut self) -> &AdvertisingPacket
pub fn rebuild_packet(&mut self) -> &AdvertisingPacket
Force rebuild of advertising packet
Sourcepub fn advertising_data(&mut self) -> Vec<u8> ⓘ
pub fn advertising_data(&mut self) -> Vec<u8> ⓘ
Get raw advertising data bytes
Sourcepub fn scan_response_data(&mut self) -> Option<Vec<u8>>
pub fn scan_response_data(&mut self) -> Option<Vec<u8>>
Get raw scan response bytes
Auto Trait Implementations§
impl Freeze for Advertiser
impl RefUnwindSafe for Advertiser
impl Send for Advertiser
impl Sync for Advertiser
impl Unpin for Advertiser
impl UnwindSafe for Advertiser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more