Advertiser

Struct Advertiser 

Source
pub struct Advertiser { /* private fields */ }
Expand description

HIVE Beacon Advertiser

Manages building and updating BLE advertisements containing HIVE beacons.

Implementations§

Source§

impl Advertiser

Source

pub fn new(config: DiscoveryConfig, node_id: NodeId) -> Self

Create a new advertiser with the given configuration and node ID

Source

pub fn hive_lite(config: DiscoveryConfig, node_id: NodeId) -> Self

Create an advertiser for a HIVE-Lite node

Source

pub fn set_time_ms(&mut self, time_ms: u64)

Set the current time (call periodically from platform)

Source

pub fn with_tx_power(self, tx_power: i8) -> Self

Set TX power level

Source

pub fn with_name(self, name: String) -> Self

Set device name

Source

pub fn with_extended_advertising(self, enabled: bool) -> Self

Enable extended advertising

Source

pub fn state(&self) -> AdvertiserState

Get current state

Source

pub fn beacon(&self) -> &HiveBeacon

Get the current beacon

Source

pub fn beacon_mut(&mut self) -> &mut HiveBeacon

Get mutable access to the beacon

Source

pub fn set_hierarchy_level(&mut self, level: HierarchyLevel)

Update hierarchy level

Source

pub fn set_capabilities(&mut self, caps: u16)

Update capabilities

Source

pub fn set_battery(&mut self, percent: u8)

Update battery percentage

Source

pub fn set_geohash(&mut self, geohash: u32)

Update geohash

Source

pub fn start(&mut self)

Start advertising

Source

pub fn pause(&mut self)

Pause advertising

Source

pub fn resume(&mut self)

Resume advertising

Source

pub fn stop(&mut self)

Stop advertising

Source

pub fn advertising_duration_ms(&self) -> Option<u64>

Get duration of current advertising session in milliseconds

Source

pub fn increment_sequence(&mut self)

Increment sequence number and invalidate cache

Source

pub fn build_packet(&mut self) -> &AdvertisingPacket

Build the advertising packet

Uses cached packet if available and not dirty.

Source

pub fn rebuild_packet(&mut self) -> &AdvertisingPacket

Force rebuild of advertising packet

Source

pub fn advertising_data(&mut self) -> Vec<u8>

Get raw advertising data bytes

Source

pub fn scan_response_data(&mut self) -> Option<Vec<u8>>

Get raw scan response bytes

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.