Struct Modem

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

A Modem is a connection to an INSTEON Modem. It can be used to send Messages and manage device links (e.g. Modem::link_device).

Implementations§

Source§

impl Modem

Source

pub fn from_path(path: impl AsRef<Path> + Send + 'static) -> Result<Self>

Constructs a new Modem given a path to a serial port

§Arguments
  • path - The path to a serial port with an INSTEON modem attached.
Source

pub fn new( handle: impl AsyncReadExt + AsyncWriteExt + Unpin + Send + 'static, ) -> Modem

Constructs a new Modem from an arbitrary I/O modem

§Arguments
  • handle - An async readable, writable modem
Source

pub async fn send_message(&mut self, message: Message) -> Result<Message, Error>

Sends a Message. This uses the default timeout duration defined by DEFAULT_TIMEOUT_DURATION.

Returns an acknowledged Message or an error.

Source

pub async fn send_message_with_timeout( &mut self, message: Message, duration: Duration, ) -> Result<Message, Error>

Sends a Message with the specified timeout duration.

Returns an acknowledged Message or an error.

Source

pub async fn get_info(&mut self) -> Result<ModemInfo, Error>

Retrieve information about the attached modem.

Return the link database stored in the modem.

Source

pub async fn listen( &mut self, ) -> Result<impl Stream<Item = Message> + Sync + Send + Unpin, Error>

Listens for incoming Messages and delivers them on the returned Stream.

Link a new device to the modem.

Auto Trait Implementations§

§

impl Freeze for Modem

§

impl !RefUnwindSafe for Modem

§

impl Send for Modem

§

impl Sync for Modem

§

impl Unpin for Modem

§

impl !UnwindSafe for Modem

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

Source§

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

Source§

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.