MobileVirtualRadio

Struct MobileVirtualRadio 

Source
pub struct MobileVirtualRadio { /* private fields */ }
Expand description

A running virtual radio. Dropping it, or calling Self::stop, stops the device and releases its state directory.

Implementations§

Source§

impl MobileVirtualRadio

Source

pub fn start( state_dir: String, enable_phy: bool, listener: Arc<dyn MobileVirtualRadioListener>, ) -> Result<Arc<Self>, MobileVirtualRadioError>

Start a virtual radio keeping its saved configuration under state_dir, for a host in this process.

With enable_phy, the device comes up listening whatever it saved: starting it is choosing the LAN. Without, its saved state decides, so a host that turned the PHY off and saved keeps it off across restarts.

Source

pub fn serve( state_dir: String, socket_path: String, enable_phy: bool, listener: Arc<dyn MobileVirtualRadioListener>, ) -> Result<Arc<Self>, MobileVirtualRadioError>

Start a virtual radio as Self::start does, for hosts that connect to the local socket at socket_path: connecting attaches, closing detaches, and a new connection replaces the current one. The socket is placed where only processes entitled to the radio can reach it, and is removed when the radio stops.

Source

pub fn attach(&self, sink: Arc<dyn MobileWireSink>)

A host in this process attached, taking replies at sink: the device starts a session, announcing it with CMD_SESSION_RESET.

Source

pub fn receive(&self, bytes: Vec<u8>)

Bytes from the attached host, in HDLC-Lite, in any chunking.

Source

pub fn detach(&self)

The host went away: the device carries on detached.

Source

pub fn stop(&self)

Stop the device. It cannot be started again; make another.

Trait Implementations§

Source§

impl<UT> LiftRef<UT> for MobileVirtualRadio

Source§

impl<UT> LowerError<UT> for MobileVirtualRadio

Source§

fn lower_error(obj: Self) -> RustBuffer

Lower this value for scaffolding function return Read more
Source§

impl<UT> LowerReturn<UT> for MobileVirtualRadio

Source§

type ReturnType = <Arc<MobileVirtualRadio> as LowerReturn<UniFfiTag>>::ReturnType

The type that should be returned by scaffolding functions for this type. Read more
Source§

fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>

Lower the return value from an scaffolding call Read more
Source§

fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>

Lower the return value for failed argument lifts Read more
Source§

impl<UT> TypeId<UT> for MobileVirtualRadio

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
Source§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
§

impl<T, U> Into<U> for T
where U: From<T>,

§

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> Same for T

Source§

type Output = T

Should always be Self
§

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

Performs the conversion.
§

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.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.