diff options
| author | Ulf Lilleengen <[email protected]> | 2024-08-05 12:09:58 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2024-08-21 12:44:07 +0200 |
| commit | 86a45b47e529864ac5a203b4ad26b9ee62127a1e (patch) | |
| tree | 24cee48d3295329a1709fe131639da8204285c69 | |
| parent | bc67cc22aa1461e6bce19b663b00bdccc818a998 (diff) | |
add at command file
| -rw-r--r-- | embassy-net-nrf91/src/at.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/embassy-net-nrf91/src/at.rs b/embassy-net-nrf91/src/at.rs new file mode 100644 index 000000000..04cbf3876 --- /dev/null +++ b/embassy-net-nrf91/src/at.rs | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | use crate::{Error, Control}; | ||
| 2 | |||
| 3 | // Drives the control loop of the modem based on declarative configuration. | ||
| 4 | pub struct AtDriver<'a> { | ||
| 5 | control: Control<'a>, | ||
| 6 | config: Config, | ||
| 7 | } | ||
| 8 | |||
| 9 | pub struct Config { | ||
| 10 | pub network: NetworkConfig, | ||
| 11 | } | ||
| 12 | |||
| 13 | pub struct NetworkConfig { | ||
| 14 | pub apn: &'static str, | ||
| 15 | pub prot: AuthProtection, | ||
| 16 | pub userid: &'static str, | ||
| 17 | pub password: &'static str, | ||
| 18 | } | ||
| 19 | |||
| 20 | #[repr(u8)] | ||
| 21 | pub enum AuthProtection { | ||
| 22 | None = 0, | ||
| 23 | Pap = 1, | ||
| 24 | Chap = 2, | ||
| 25 | } | ||
| 26 | |||
| 27 | impl<'a> AtDriver<'a> { | ||
| 28 | pub async fn new(control: Control<'a>, config: Config) -> Result<Self, Error> { | ||
| 29 | control.wait_init().await; | ||
| 30 | Ok(Self { | ||
| 31 | control, | ||
| 32 | config, | ||
| 33 | }) | ||
| 34 | } | ||
| 35 | |||
| 36 | async fn setup(&self) -> Result<(), Error> { | ||
| 37 | |||
| 38 | } | ||
| 39 | |||
| 40 | pub fn run(&self, stack: Stack<crate::NetDriver<'static>>) -> ! { | ||
| 41 | loop { | ||
| 42 | |||
| 43 | } | ||
| 44 | } | ||
| 45 | } | ||
