aboutsummaryrefslogtreecommitdiff
path: root/embassy-net-nrf91/src/context.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-net-nrf91/src/context.rs')
-rw-r--r--embassy-net-nrf91/src/context.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/embassy-net-nrf91/src/context.rs b/embassy-net-nrf91/src/context.rs
index b936e5f87..d5d088ec0 100644
--- a/embassy-net-nrf91/src/context.rs
+++ b/embassy-net-nrf91/src/context.rs
@@ -92,11 +92,22 @@ impl<'a> Control<'a> {
92 } 92 }
93 93
94 /// Configures the modem with the provided config. 94 /// Configures the modem with the provided config.
95 ///
96 /// NOTE: This will disconnect the modem from any current APN and should not
97 /// be called if the configuration has not been changed.
95 pub async fn configure(&self, config: &Config<'_>) -> Result<(), Error> { 98 pub async fn configure(&self, config: &Config<'_>) -> Result<(), Error> {
96 let mut cmd: [u8; 256] = [0; 256]; 99 let mut cmd: [u8; 256] = [0; 256];
97 let mut buf: [u8; 256] = [0; 256]; 100 let mut buf: [u8; 256] = [0; 256];
98 101
99 let op = CommandBuilder::create_set(&mut cmd, true) 102 let op = CommandBuilder::create_set(&mut cmd, true)
103 .named("+CFUN")
104 .with_int_parameter(0)
105 .finish()
106 .map_err(|_| Error::BufferTooSmall)?;
107 let n = self.control.at_command(op, &mut buf).await;
108 CommandParser::parse(&buf[..n]).expect_identifier(b"OK").finish()?;
109
110 let op = CommandBuilder::create_set(&mut cmd, true)
100 .named("+CGDCONT") 111 .named("+CGDCONT")
101 .with_int_parameter(self.cid) 112 .with_int_parameter(self.cid)
102 .with_string_parameter("IP") 113 .with_string_parameter("IP")
@@ -104,6 +115,7 @@ impl<'a> Control<'a> {
104 .finish() 115 .finish()
105 .map_err(|_| Error::BufferTooSmall)?; 116 .map_err(|_| Error::BufferTooSmall)?;
106 let n = self.control.at_command(op, &mut buf).await; 117 let n = self.control.at_command(op, &mut buf).await;
118 // info!("RES1: {}", unsafe { core::str::from_utf8_unchecked(&buf[..n]) });
107 CommandParser::parse(&buf[..n]).expect_identifier(b"OK").finish()?; 119 CommandParser::parse(&buf[..n]).expect_identifier(b"OK").finish()?;
108 120
109 let mut op = CommandBuilder::create_set(&mut cmd, true) 121 let mut op = CommandBuilder::create_set(&mut cmd, true)
@@ -116,6 +128,7 @@ impl<'a> Control<'a> {
116 let op = op.finish().map_err(|_| Error::BufferTooSmall)?; 128 let op = op.finish().map_err(|_| Error::BufferTooSmall)?;
117 129
118 let n = self.control.at_command(op, &mut buf).await; 130 let n = self.control.at_command(op, &mut buf).await;
131 // info!("RES2: {}", unsafe { core::str::from_utf8_unchecked(&buf[..n]) });
119 CommandParser::parse(&buf[..n]).expect_identifier(b"OK").finish()?; 132 CommandParser::parse(&buf[..n]).expect_identifier(b"OK").finish()?;
120 133
121 let op = CommandBuilder::create_set(&mut cmd, true) 134 let op = CommandBuilder::create_set(&mut cmd, true)