Struct radio::mock::Radio

source ·
pub struct Radio<St: Debug + Clone + PartialEq, Reg: Debug + Clone + PartialEq, Ch: Debug + Clone + PartialEq, Inf: Debug + Clone + PartialEq, Irq: Debug + Clone + PartialEq, E: Debug + Clone + PartialEq> { /* private fields */ }
Expand description

Generic mock radio

Based on embedded_hal_mock::common::Generic

Implementations§

source§

impl<St, Reg, Ch, Inf, Irq, E> Radio<St, Reg, Ch, Inf, Irq, E>
where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, Ch: PartialEq + Debug + Clone, Inf: PartialEq + Debug + Clone, Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone,

source

pub fn new(expectations: &[Transaction<St, Reg, Ch, Inf, Irq, E>]) -> Self

source

pub fn expect(&mut self, expectations: &[Transaction<St, Reg, Ch, Inf, Irq, E>])

source

pub fn next(&mut self) -> Option<Transaction<St, Reg, Ch, Inf, Irq, E>>

source

pub fn done(&mut self)

Trait Implementations§

source§

impl<St, Reg, Ch, Inf, Irq, E> Busy for Radio<St, Reg, Ch, Inf, Irq, E>
where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, Ch: PartialEq + Debug + Clone, Inf: PartialEq + Debug + Clone, Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone,

§

type Error = E

Radio error type
source§

fn is_busy(&mut self) -> Result<bool, Self::Error>

Indicates the radio is busy in the current state (for example, currently transmitting or receiving)
source§

impl<St, Reg, Ch, Inf, Irq, E> Channel for Radio<St, Reg, Ch, Inf, Irq, E>
where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, Ch: PartialEq + Debug + Clone, Inf: PartialEq + Debug + Clone, Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone,

§

type Channel = Ch

Channel information
§

type Error = E

Radio error type
source§

fn set_channel(&mut self, channel: &Self::Channel) -> Result<(), Self::Error>

Set the radio channel for future transmit and receive operations
source§

impl<St: Clone + Debug + Clone + PartialEq, Reg: Clone + Debug + Clone + PartialEq, Ch: Clone + Debug + Clone + PartialEq, Inf: Clone + Debug + Clone + PartialEq, Irq: Clone + Debug + Clone + PartialEq, E: Clone + Debug + Clone + PartialEq> Clone for Radio<St, Reg, Ch, Inf, Irq, E>

source§

fn clone(&self) -> Radio<St, Reg, Ch, Inf, Irq, E>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<St: Debug + Debug + Clone + PartialEq, Reg: Debug + Debug + Clone + PartialEq, Ch: Debug + Debug + Clone + PartialEq, Inf: Debug + Debug + Clone + PartialEq, Irq: Debug + Debug + Clone + PartialEq, E: Debug + Debug + Clone + PartialEq> Debug for Radio<St, Reg, Ch, Inf, Irq, E>

source§

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

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

impl<St, Reg, Ch, Inf, Irq, E> DelayNs for Radio<St, Reg, Ch, Inf, Irq, E>
where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, Ch: PartialEq + Debug + Clone, Inf: PartialEq + Debug + Clone, Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone,

source§

fn delay_ns(&mut self, ns: u32)

Pauses execution for at minimum ns nanoseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

fn delay_us(&mut self, us: u32)

Pauses execution for at minimum us microseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

fn delay_ms(&mut self, ms: u32)

Pauses execution for at minimum ms milliseconds. Pause can be longer if the implementation requires it due to precision/timing issues.
source§

impl<St, Reg, Ch, Inf, Irq, E> Interrupts for Radio<St, Reg, Ch, Inf, Irq, E>
where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, Ch: PartialEq + Debug + Clone, Inf: PartialEq + Debug + Clone, Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone,

§

type Error = E

Radio error
§

type Irq = Irq

Interrupt object
source§

fn get_interrupts(&mut self, clear: bool) -> Result<Self::Irq, Self::Error>

Fetch any pending interrupts from the device If the clear option is set, this will also clear any returned flags
source§

impl<St, Reg, Ch, Inf, Irq, E> Power for Radio<St, Reg, Ch, Inf, Irq, E>
where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, Ch: PartialEq + Debug + Clone, Inf: PartialEq + Debug + Clone, Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone,

§

type Error = E

Radio error type
source§

fn set_power(&mut self, power: i8) -> Result<(), Self::Error>

Set the radio power in dBm
source§

impl<St, Reg, Ch, Inf, Irq, E> Receive for Radio<St, Reg, Ch, Inf, Irq, E>

§

type Info = Inf

Packet received info
§

type Error = E

Radio error
source§

fn start_receive(&mut self) -> Result<(), Self::Error>

Set receiving on the specified channel Read more
source§

fn check_receive(&mut self, restart: bool) -> Result<bool, Self::Error>

Check for reception Read more
source§

fn get_received( &mut self, buff: &mut [u8] ) -> Result<(usize, Self::Info), Self::Error>

Fetch a received packet if rx is complete Read more
source§

impl<St, Reg, Ch, Inf, Irq, E> Rssi for Radio<St, Reg, Ch, Inf, Irq, E>
where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, Ch: PartialEq + Debug + Clone, Inf: PartialEq + Debug + Clone, Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone,

§

type Error = E

Radio error
source§

fn poll_rssi(&mut self) -> Result<i16, Self::Error>

Fetch the current RSSI value from the radio Note that the radio MUST be in RX mode (or capable of measuring RSSI) when this is called or an error should be returned
source§

impl<St, Reg, Ch, Inf, Irq, E> State for Radio<St, Reg, Ch, Inf, Irq, E>

§

type State = St

Radio state
§

type Error = E

Radio error type
source§

fn set_state(&mut self, state: Self::State) -> Result<(), Self::Error>

Set the radio to a specified state
source§

fn get_state(&mut self) -> Result<Self::State, Self::Error>

Fetch the current radio state
source§

impl<St, Reg, Ch, Inf, Irq, E> Transmit for Radio<St, Reg, Ch, Inf, Irq, E>
where St: PartialEq + Debug + Clone, Reg: PartialEq + Debug + Clone, Ch: PartialEq + Debug + Clone, Inf: PartialEq + Debug + Clone, Irq: PartialEq + Debug + Clone, E: PartialEq + Debug + Clone,

§

type Error = E

Radio error
source§

fn start_transmit(&mut self, data: &[u8]) -> Result<(), Self::Error>

Start sending a packet on the provided channel Read more
source§

fn check_transmit(&mut self) -> Result<bool, Self::Error>

Check for send completion Read more

Auto Trait Implementations§

§

impl<St, Reg, Ch, Inf, Irq, E> Freeze for Radio<St, Reg, Ch, Inf, Irq, E>

§

impl<St, Reg, Ch, Inf, Irq, E> RefUnwindSafe for Radio<St, Reg, Ch, Inf, Irq, E>

§

impl<St, Reg, Ch, Inf, Irq, E> Send for Radio<St, Reg, Ch, Inf, Irq, E>
where St: Send, Reg: Send, Ch: Send, Irq: Send, Inf: Send, E: Send,

§

impl<St, Reg, Ch, Inf, Irq, E> Sync for Radio<St, Reg, Ch, Inf, Irq, E>
where St: Send, Reg: Send, Ch: Send, Irq: Send, Inf: Send, E: Send,

§

impl<St, Reg, Ch, Inf, Irq, E> Unpin for Radio<St, Reg, Ch, Inf, Irq, E>

§

impl<St, Reg, Ch, Inf, Irq, E> UnwindSafe for Radio<St, Reg, Ch, Inf, Irq, E>

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<'a, T, I, E> AsyncReceive<'a, I, E> for T
where T: Receive<Error = E, Info = I> + 'a, I: ReceiveInfo + Unpin + 'a, E: Debug + Unpin,

§

type Output = ReceiveFuture<'a, T, I, E>

source§

fn async_receive( &'a mut self, buff: &'a mut [u8], rx_options: AsyncOptions ) -> Result<<T as AsyncReceive<'a, I, E>>::Output, E>

source§

impl<'a, T, E> AsyncTransmit<'a, E> for T
where T: Transmit<Error = E> + Power<Error = E> + 'a, E: Debug + Unpin,

§

type Output = TransmitFuture<'a, T, E>

source§

fn async_transmit( &'a mut self, data: &'a [u8], tx_options: AsyncOptions ) -> Result<<T as AsyncTransmit<'a, E>>::Output, E>

source§

impl<T, I, E> BlockingReceive<I, E> for T
where T: Receive<Info = I, Error = E> + DelayNs, <T as Receive>::Info: Debug, I: Debug, E: Debug,

source§

fn do_receive( &mut self, buff: &mut [u8], rx_options: BlockingOptions ) -> Result<(usize, I), BlockingError<E>>

source§

impl<T, S, E> BlockingSetState<S, E> for T
where T: State<State = S, Error = E> + DelayNs, S: Debug + PartialEq + Copy, E: Debug,

source§

fn set_state_checked( &mut self, state: S, options: BlockingOptions ) -> Result<(), BlockingError<E>>

source§

impl<T, E> BlockingTransmit<E> for T
where T: Transmit<Error = E> + DelayNs, E: Debug,

source§

fn do_transmit( &mut self, data: &[u8], tx_options: BlockingOptions ) -> Result<(), BlockingError<E>>

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.