pub struct Locked<'invoker, 'buffer, B> { /* private fields */ }
Expand description
A network card on which methods can be invoked.
This type combined a network card address, and Invoker
that can be used to make method
calls, and a scratch buffer used to perform CBOR encoding and decoding. A value of this type
can be created by calling Modem::lock
, and it can be dropped to return the borrow of the
invoker and buffer to the caller so they can be reused for other purposes.
The 'invoker
lifetime is the lifetime of the invoker. The 'buffer
lifetime is the lifetime
of the buffer. The B
type is the type of scratch buffer to use.
Implementations§
Source§impl<'invoker, 'buffer, B: Buffer> Locked<'invoker, 'buffer, B>
impl<'invoker, 'buffer, B: Buffer> Locked<'invoker, 'buffer, B>
Sourcepub async fn is_wireless(&mut self) -> Result<bool, Error>
pub async fn is_wireless(&mut self) -> Result<bool, Error>
Sourcepub async fn open(&mut self, port: NonZeroU16) -> Result<bool, Error>
pub async fn open(&mut self, port: NonZeroU16) -> Result<bool, Error>
Starts accepting packets on a port number.
Returns true
if the port was previously closed and is now open, or false
if it was
already open.
§Errors
Sourcepub async fn close(&mut self, port: NonZeroU16) -> Result<bool, Error>
pub async fn close(&mut self, port: NonZeroU16) -> Result<bool, Error>
Stops accepting packets on a port number.
Returns true
if the port was previously open and is now closed, or false
if it was
previously closed.
§Errors
Sourcepub async fn close_all(&mut self) -> Result<bool, Error>
pub async fn close_all(&mut self) -> Result<bool, Error>
Stops accepting packets on all ports.
Returns true
if any ports were previously open and are now closed, or false
if all
ports were previously closed.
§Errors
Sourcepub async fn send(
&mut self,
destination: Address,
port: NonZeroU16,
parts: &[PacketPart<'_>],
) -> Result<(), Error>
pub async fn send( &mut self, destination: Address, port: NonZeroU16, parts: &[PacketPart<'_>], ) -> Result<(), Error>
Sends a unicast packet.
§Errors
Sourcepub async fn broadcast(
&mut self,
port: NonZeroU16,
parts: &[PacketPart<'_>],
) -> Result<(), Error>
pub async fn broadcast( &mut self, port: NonZeroU16, parts: &[PacketPart<'_>], ) -> Result<(), Error>
Sends a broadcast packet.
§Errors
Sourcepub async fn get_strength(&mut self) -> Result<f64, Error>
pub async fn get_strength(&mut self) -> Result<f64, Error>
Returns the current wireless transmit strength.
§Errors
BadComponent
is returned if the component is not a wireless network card, including if it is an ordinary wired network card.TooManyDescriptors
Sourcepub async fn set_strength(&mut self, strength: f64) -> Result<f64, Error>
pub async fn set_strength(&mut self, strength: f64) -> Result<f64, Error>
Sets the wireless transmit strength.
Returns the new transmit strength, after clamping to the range permitted by the card.
§Errors
BadComponent
is returned if the component is not a wireless network card, including if it is an ordinary wired network card.TooManyDescriptors