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
impl Modem
Sourcepub fn from_path(path: impl AsRef<Path> + Send + 'static) -> Result<Self>
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.
Sourcepub fn new(
handle: impl AsyncReadExt + AsyncWriteExt + Unpin + Send + 'static,
) -> Modem
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
Sourcepub async fn send_message(&mut self, message: Message) -> Result<Message, Error>
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.
Sourcepub async fn send_message_with_timeout(
&mut self,
message: Message,
duration: Duration,
) -> Result<Message, Error>
pub async fn send_message_with_timeout( &mut self, message: Message, duration: Duration, ) -> Result<Message, Error>
Sourcepub async fn get_info(&mut self) -> Result<ModemInfo, Error>
pub async fn get_info(&mut self) -> Result<ModemInfo, Error>
Retrieve information about the attached modem.
Sourcepub async fn get_links(
&mut self,
) -> Result<impl Iterator<Item = AllLinkRecord>, Error>
pub async fn get_links( &mut self, ) -> Result<impl Iterator<Item = AllLinkRecord>, Error>
Return the link database stored in the modem.
Sourcepub async fn listen(
&mut self,
) -> Result<impl Stream<Item = Message> + Sync + Send + Unpin, Error>
pub async fn listen( &mut self, ) -> Result<impl Stream<Item = Message> + Sync + Send + Unpin, Error>
Sourcepub async fn link_device(
&mut self,
address: Option<Address>,
mode: AllLinkMode,
group: u8,
) -> Result<AllLinkComplete, Error>
pub async fn link_device( &mut self, address: Option<Address>, mode: AllLinkMode, group: u8, ) -> Result<AllLinkComplete, Error>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more