[−][src]Struct rubble::link::LinkLayer
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
: ATimer
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]
&mut self,
interval: Duration,
data: &[AdStructure],
transmitter: &mut HW::Tx,
tx: Consumer,
rx: Producer
) -> Result<NextUpdate, Error>
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]
&mut self,
rx_end: Instant,
tx: &mut HW::Tx,
header: Header,
payload: &[u8],
crc_ok: bool
) -> Cmd
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]
&mut self,
rx_end: Instant,
tx: &mut HW::Tx,
header: Header,
payload: &[u8],
crc_ok: bool
) -> Cmd
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
: ATransmitter
for sending packets.elapsed
: Time since the lastupdate
call or creation of thisLinkLayer
.
pub fn is_advertising(&self) -> bool
[src]
Auto Trait Implementations
impl<HW> Send for LinkLayer<HW> where
HW: Send,
<HW as HardwareInterface>::Timer: Send,
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]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> From for T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,