[][src]Struct rubble::link::LinkLayer

pub struct LinkLayer<HW: HardwareInterface> { /* fields omitted */ }

Implementation of the real-time BLE Link-Layer logic.

Users of this struct must provide an interface to the platform's hardware by implementing HardwareInterface.

Methods

impl<HW: HardwareInterface> LinkLayer<HW>[src]

pub fn new(dev_addr: DeviceAddress, timer: HW::Timer) -> Self[src]

Creates a new Link-Layer.

Parameters

  • dev_addr: The device address to broadcast as.
  • timer: A Timer implementation.
  • tx: Input queue of packets to transmit when connected.
  • rx: Output queue of received packets when connected.

pub fn timer(&mut self) -> &mut HW::Timer[src]

Returns a reference to the timer instance used by the Link-Layer.

pub fn start_advertise(
    &mut self,
    interval: Duration,
    data: &[AdStructure],
    transmitter: &mut HW::Tx,
    tx: Consumer,
    rx: Producer
) -> Result<NextUpdate, Error>
[src]

Starts advertising this device, optionally sending data along with the advertising PDU.

pub fn process_adv_packet(
    &mut self,
    rx_end: Instant,
    tx: &mut HW::Tx,
    header: Header,
    payload: &[u8],
    crc_ok: bool
) -> Cmd
[src]

Process an incoming packet from an advertising channel.

The access address of the packet must be ADVERTISING_ADDRESS.

Parameters

  • rx_end: A timestamp indicating when the packet was fully received.
  • tx: A packet transmitter.
  • header: The header of the received packet.
  • payload: The packet payload following the header.
  • crc_ok: Whether the packet's CRC is correct.

pub fn process_data_packet(
    &mut self,
    rx_end: Instant,
    tx: &mut HW::Tx,
    header: Header,
    payload: &[u8],
    crc_ok: bool
) -> Cmd
[src]

Process an incoming data channel packet.

pub fn update(&mut self, tx: &mut HW::Tx) -> Cmd[src]

Update the Link-Layer state.

This should be called in regular intervals, independent of whether packets were received and processed.

Parameters

  • tx: A Transmitter for sending packets.
  • elapsed: Time since the last update call or creation of this LinkLayer.

pub fn is_advertising(&self) -> bool[src]

Auto Trait Implementations

impl<HW> Send for LinkLayer<HW> where
    HW: Send,
    <HW as HardwareInterface>::Timer: Send

impl<HW> !Sync for LinkLayer<HW>

Blanket Implementations

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> From for T[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]