pub enum Message {
    SendData {
        data: Vec<u8, { crate::MAX_LORA_PAYLOAD_LENGTH }>,
    },
    ReceiveData {
        data: Vec<u8, { crate::MAX_LORA_PAYLOAD_LENGTH }>,
    },
    Configure {
        region: u8,
        spreading_factor: u8,
        network: u16,
    },
    ReportRequest,
    Report {
        sn: u32,
        version_data: Vec<u8, 9>,
        region: u8,
        spreading_factor: u8,
        receive_queue_size: u8,
        transmit_queue_size: u8,
        network: u16,
    },
    Status {
        code: StatusCode,
    },
    UpgradeFirmwareRequest,
    SetTimestamp {
        timestamp: u64,
    },
    GetRawIq,
    RawIq {
        data: Vec<u8, RAWIQ_DATA_LENGTH>,
    },
}
Expand description

Possible commands send over host protocol

This enum contains both messages send exlusively to node or exclusively to host

Variants§

§

SendData

Fields

§data: Vec<u8, { crate::MAX_LORA_PAYLOAD_LENGTH }>

Host sending data to node instructing it to broadcast it to the wireless network

§

ReceiveData

Fields

§data: Vec<u8, { crate::MAX_LORA_PAYLOAD_LENGTH }>

Node sending data to host

§

Configure

Fields

§region: u8
§spreading_factor: u8
§network: u16

Host is recongifuring the node

§

ReportRequest

Host requesting the node status

§

Report

Fields

§sn: u32

BE encoded

§version_data: Vec<u8, 9>

BE encoded

§region: u8
§spreading_factor: u8
§receive_queue_size: u8
§transmit_queue_size: u8
§network: u16

Node reporting information to host

§

Status

Fields

Node reporting some error state to host

§

UpgradeFirmwareRequest

Firmware upgrade will follow

§

SetTimestamp

Fields

§timestamp: u64

Set current time

§

GetRawIq

Get rawIq data

§

RawIq

Fields

§data: Vec<u8, RAWIQ_DATA_LENGTH>

Node returns raw IQ data to host

Implementations§

source§

impl Message

source

pub fn try_from_cobs(buf: &mut [u8]) -> Result<Message, Error>

source

pub fn len(&self) -> usize

source

pub fn as_bytes(&self) -> Result<Vec<u8, MAX_MESSAGE_LENGTH>, Error>

source

pub fn encode(&self) -> Result<HostMessageVec, Error>

source

pub fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<usize, Error>

source

pub fn into_encoded_bytes(self) -> Result<HostMessageVec, Error>

source

pub fn as_frames<C: WireCodec>(&self) -> Result<C::Frames, Error>

Splits COBS encoded self to frames for sending. Frames can be send as is over the wire, it itself is a valid host protocol packet

Trait Implementations§

source§

impl Debug for Message

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromStr for Message

§

type Err = ParseMessageError

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, ParseMessageError>

Parses a string s to return a value of this type. Read more
source§

impl PartialEq for Message

source§

fn eq(&self, other: &Message) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<&[u8]> for Message

§

type Error = Error

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

fn try_from(buf: &[u8]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl StructuralPartialEq for Message

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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.