diff options
Diffstat (limited to 'embassy-net-nrf91')
| -rw-r--r-- | embassy-net-nrf91/src/context.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/embassy-net-nrf91/src/context.rs b/embassy-net-nrf91/src/context.rs index 8b45919ef..2dda615c1 100644 --- a/embassy-net-nrf91/src/context.rs +++ b/embassy-net-nrf91/src/context.rs | |||
| @@ -21,6 +21,8 @@ pub struct Config<'a> { | |||
| 21 | pub auth_prot: AuthProt, | 21 | pub auth_prot: AuthProt, |
| 22 | /// Credentials. | 22 | /// Credentials. |
| 23 | pub auth: Option<(&'a [u8], &'a [u8])>, | 23 | pub auth: Option<(&'a [u8], &'a [u8])>, |
| 24 | /// SIM pin | ||
| 25 | pub pin: Option<&'a [u8]>, | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | /// Authentication protocol. | 28 | /// Authentication protocol. |
| @@ -133,6 +135,16 @@ impl<'a> Control<'a> { | |||
| 133 | // info!("RES2: {}", unsafe { core::str::from_utf8_unchecked(&buf[..n]) }); | 135 | // info!("RES2: {}", unsafe { core::str::from_utf8_unchecked(&buf[..n]) }); |
| 134 | CommandParser::parse(&buf[..n]).expect_identifier(b"OK").finish()?; | 136 | CommandParser::parse(&buf[..n]).expect_identifier(b"OK").finish()?; |
| 135 | 137 | ||
| 138 | if let Some(pin) = config.pin { | ||
| 139 | let op = CommandBuilder::create_set(&mut cmd, true) | ||
| 140 | .named("+CPIN") | ||
| 141 | .with_string_parameter(pin) | ||
| 142 | .finish() | ||
| 143 | .map_err(|_| Error::BufferTooSmall)?; | ||
| 144 | let _ = self.control.at_command(op, &mut buf).await; | ||
| 145 | // Ignore ERROR which means no pin required | ||
| 146 | } | ||
| 147 | |||
| 136 | Ok(()) | 148 | Ok(()) |
| 137 | } | 149 | } |
| 138 | 150 | ||
