[][src]Trait dw1000::ranging::Message

pub trait Message: Sized + for<'de> Deserialize<'de> + Serialize {
    const PRELUDE: Prelude;
    const PRELUDE_LEN: usize;
    const LEN: usize;
    fn decode<SPI, CS>(
        message: &Message
    ) -> Result<Option<RxMessage<Self>>, Error<SPI, CS>>
    where
        SPI: Transfer<u8> + Write<u8>,
        CS: OutputPin
, { ... } }

Implemented by all ranging messages

Associated Constants

const PRELUDE: Prelude

A prelude that identifies the message

const PRELUDE_LEN: usize

The length of the message's prelude

This is a bit of a hack that we need until slice::<impl [T]>::len is stable as a const fn.

const LEN: usize

The length of the whole message, including prelude and data

Loading content...

Provided methods

fn decode<SPI, CS>(
    message: &Message
) -> Result<Option<RxMessage<Self>>, Error<SPI, CS>> where
    SPI: Transfer<u8> + Write<u8>,
    CS: OutputPin

Decodes a received message of this type

The user is responsible for receiving a message using DW1000::receive. Once a message has been received, this method can be used to check what type of message this is.

Returns Ok(None), if the message is not of the right type. Otherwise, returns `Ok(Some(RxMessage)), if the message is of the right type, and no error occured.

Loading content...

Implementors

impl Message for Ping[src]

impl Message for Request[src]

impl Message for Response[src]

Loading content...