We need to get either the device-keys or a JS client. In any other case, this must return an error.
(&mut self)
| 240 | |
| 241 | // We need to get either the device-keys or a JS client. In any other case, this must return an error. |
| 242 | async fn get_device_keys_or_js_client(&mut self) -> Result<()> { |
| 243 | trace!("Getting device keys"); |
| 244 | let jr = self.join_request.as_ref().unwrap(); |
| 245 | self.device_keys = match device_keys::get(&jr.dev_eui).await { |
| 246 | Ok(v) => Some(v), |
| 247 | Err(e) => { |
| 248 | if let StorageError::NotFound(_) = e { |
| 249 | None |
| 250 | } else { |
| 251 | return Err(anyhow::Error::new(e)); |
| 252 | } |
| 253 | } |
| 254 | }; |
| 255 | |
| 256 | if self.device_keys.is_none() { |
| 257 | trace!(join_eui = %jr.join_eui, "Getting Join Server client"); |
| 258 | self.js_client = Some(joinserver::get(jr.join_eui).await?); |
| 259 | } |
| 260 | |
| 261 | Ok(()) |
| 262 | } |
| 263 | |
| 264 | async fn get_device_data_or_try_pr_roaming(&mut self) -> Result<()> { |
| 265 | trace!("Getting device"); |
no test coverage detected