MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / get_device_keys_or_js_client

Method get_device_keys_or_js_client

chirpstack/src/uplink/join.rs:242–262  ·  view source on GitHub ↗

We need to get either the device-keys or a JS client. In any other case, this must return an error.

(&mut self)

Source from the content-addressed store, hash-verified

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");

Callers 2

_handleMethod · 0.45
_handle_relayedMethod · 0.45

Calls 3

unwrapMethod · 0.80
as_refMethod · 0.80
getFunction · 0.50

Tested by

no test coverage detected