[][src]Struct plm::Modem

pub struct Modem { /* fields omitted */ }

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

impl Modem[src]

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

Constructs a new Modem given a path to a serial port

Arguments

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

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

Constructs a new Modem from an arbitrary I/O modem

Arguments

  • handle - An async readable, writable modem

pub async fn send_message<'_>(
    &'_ mut self,
    message: Message
) -> Result<Message, Error>
[src]

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

Returns an acknowledged Message or an error.

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

Sends a Message with the specified timeout duration.

Returns an acknowledged Message or an error.

pub async fn get_info<'_>(&'_ mut self) -> Result<ModemInfo, Error>[src]

Retrieve information about the attached modem.

Return the link database stored in the modem.

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

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

Link a new device to the modem.

Auto Trait Implementations

impl !RefUnwindSafe for Modem

impl Send for Modem

impl Sync for Modem

impl Unpin for Modem

impl !UnwindSafe for Modem

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.