pub struct LteLink(/* private fields */);
Expand description
An object that keeps the modem connected. As long as there is an instance, the modem will be kept on. The drop function disables the modem if there is no link left.
Everything will work even if the user doesn’t use this directly. Every API that requires a network connection uses this internally.
However, this can lead to inefficiencies. For example, if you do a dns request and then make a socket to connect to the IP, the link will fall away in between.
The user can prevent this by creating his own instance that the user only drops when all network tasks are done.
Implementations§
source§impl LteLink
impl LteLink
sourcepub async fn wait_for_link(&self) -> Result<(), Error>
pub async fn wait_for_link(&self) -> Result<(), Error>
While there is an instance of the LteLink, the modem is active. But that does not mean that there is access to the network.
Call this function to wait until there is a connection.
sourcepub async fn wait_for_link_with_cancellation(
&self,
token: &CancellationToken,
) -> Result<(), Error>
pub async fn wait_for_link_with_cancellation( &self, token: &CancellationToken, ) -> Result<(), Error>
While there is an instance of the LteLink, the modem is active. But that does not mean that there is access to the network.
Call this function to wait until there is a connection.
sourcepub async fn deactivate(self) -> Result<(), Error>
pub async fn deactivate(self) -> Result<(), Error>
Deactivates Lte. This does the same as dropping the instance, but in an async manner.