pub struct Modem<'a, AtCl, const N: usize, const L: usize> { /* private fields */ }Expand description
A handle to the modem, providing access to AT command operations and URC subscription handling.
Implementations§
Source§impl<'a, AtCl, const N: usize, const L: usize> Modem<'a, AtCl, N, L>where
AtCl: AtatClient,
impl<'a, AtCl, const N: usize, const L: usize> Modem<'a, AtCl, N, L>where
AtCl: AtatClient,
Sourcepub fn new(client: AtCl, urc_chan: &'a UrcChannel<Urc, N, L>) -> Self
pub fn new(client: AtCl, urc_chan: &'a UrcChannel<Urc, N, L>) -> Self
Constructs a new Modem instance with a client, URC channel, and shared state.
§Arguments
client: An AT command client for communicating with the modem.urc_chan: A reference to the URC channel used to receive asynchronous modem messages.
This method does not initialize the modem; call begin to do so.
Sourcepub fn urc_handler(&self) -> UrcHandler<'a, N, L>
pub fn urc_handler(&self) -> UrcHandler<'a, N, L>
Creates a new URC handler associated with this modem.
The URC handler will subscribe to unsolicited messages from the modem and process them,
updating shared state where necessary. The user must run the UrcHandler to begin handling messages.
§Panics
Panics if the subscription to the URC channel fails (e.g., buffer full or uninitialized).
pub async fn send<Cmd: AtatCmd>( &mut self, cmd: &Cmd, ) -> Result<Cmd::Response, Error>
Sourcepub async fn begin(&mut self) -> Result<(), Error>
pub async fn begin(&mut self) -> Result<(), Error>
Initializes the modem by sending basic configuration commands.
This method must be called once before other modem operations are invoked. It is safe to call multiple times; subsequent calls will be no-ops.
- Enables numeric CME error reporting.
- Enables network registration URC reporting.
pub async fn get_operation_mode(&mut self) -> Result<RAT, Error>
pub async fn set_opeartion_mode(&mut self, mode: RAT) -> Result<(), Error>
pub async fn ping(&mut self) -> Result<(), Error>
pub async fn define_pdp_context(&mut self) -> Result<(), Error>
pub async fn set_op_state(&mut self, mode: FunctionalMode) -> Result<(), Error>
pub fn get_network_registration_state(&self) -> NetworkRegistrationState
Source§impl<'sub, AtCl, const N: usize, const L: usize> Modem<'sub, AtCl, N, L>where
AtCl: AtatClient,
impl<'sub, AtCl, const N: usize, const L: usize> Modem<'sub, AtCl, N, L>where
AtCl: AtatClient,
Sourcepub async fn lte_connect(&mut self) -> Result<(), Error>
pub async fn lte_connect(&mut self) -> Result<(), Error>
Connect to the LTE network.
This function will connect the modem to the LTE network. This function will block until the modem is attached.
Sourcepub async fn lte_disconnect(&mut self) -> Result<(), Error>
pub async fn lte_disconnect(&mut self) -> Result<(), Error>
Disconnect from the LTE network.
This function will disconnect the modem from the LTE network and block until the network is actually disconnected. After the network is disconnected the GNSS subsystem can be used.