mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-25 16:23:10 +00:00
add at command file
This commit is contained in:
parent
bc67cc22aa
commit
86a45b47e5
45
embassy-net-nrf91/src/at.rs
Normal file
45
embassy-net-nrf91/src/at.rs
Normal file
@ -0,0 +1,45 @@
|
||||
use crate::{Error, Control};
|
||||
|
||||
// Drives the control loop of the modem based on declarative configuration.
|
||||
pub struct AtDriver<'a> {
|
||||
control: Control<'a>,
|
||||
config: Config,
|
||||
}
|
||||
|
||||
pub struct Config {
|
||||
pub network: NetworkConfig,
|
||||
}
|
||||
|
||||
pub struct NetworkConfig {
|
||||
pub apn: &'static str,
|
||||
pub prot: AuthProtection,
|
||||
pub userid: &'static str,
|
||||
pub password: &'static str,
|
||||
}
|
||||
|
||||
#[repr(u8)]
|
||||
pub enum AuthProtection {
|
||||
None = 0,
|
||||
Pap = 1,
|
||||
Chap = 2,
|
||||
}
|
||||
|
||||
impl<'a> AtDriver<'a> {
|
||||
pub async fn new(control: Control<'a>, config: Config) -> Result<Self, Error> {
|
||||
control.wait_init().await;
|
||||
Ok(Self {
|
||||
control,
|
||||
config,
|
||||
})
|
||||
}
|
||||
|
||||
async fn setup(&self) -> Result<(), Error> {
|
||||
|
||||
}
|
||||
|
||||
pub fn run(&self, stack: Stack<crate::NetDriver<'static>>) -> ! {
|
||||
loop {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user