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

Method _start_pr

chirpstack/src/uplink/join_sns.rs:56–108  ·  view source on GitHub ↗
(
        ufs: UplinkFrameSet,
        pr_start_req: PRStartReqPayload,
    )

Source from the content-addressed store, hash-verified

54 }
55
56 async fn _start_pr(
57 ufs: UplinkFrameSet,
58 pr_start_req: PRStartReqPayload,
59 ) -> Result<PRStartAnsPayload> {
60 let mut ctx = JoinRequest {
61 uplink_frame_set: ufs,
62 pr_start_req,
63
64 pr_start_ans: None,
65 join_request: None,
66 join_accept: None,
67 device: None,
68 js_client: None,
69 application: None,
70 tenant: None,
71 device_profile: None,
72 device_keys: None,
73 device_info: None,
74 dev_addr: None,
75 f_nwk_s_int_key: None,
76 s_nwk_s_int_key: None,
77 nwk_s_enc_key: None,
78 app_s_key: None,
79 js_session_key_id: "".to_string(),
80 };
81
82 ctx.get_join_request_payload()?;
83 ctx.get_device_data().await?;
84 ctx.check_roaming_allowed()?;
85 ctx.get_device_keys_or_js_client().await?;
86 ctx.set_device_info()?;
87 ctx.abort_on_device_is_disabled()?;
88 ctx.abort_on_otaa_is_disabled()?;
89 ctx.get_random_dev_addr()?;
90 if ctx.js_client.is_some() {
91 // Using join-server
92 ctx.get_join_accept_from_js().await?;
93 } else {
94 // Using internal keys
95 ctx.validate_mic().await?;
96 ctx.validate_dev_nonce_and_get_device_keys().await?;
97 ctx.construct_join_accept_and_set_keys()?;
98 }
99 ctx.log_uplink_meta().await?;
100 ctx.set_device_session().await?;
101 ctx.flush_device_queue().await?;
102 ctx.update_device().await?;
103 ctx.send_join_event().await?;
104 ctx.set_pr_start_ans_payload()?;
105
106 ctx.pr_start_ans
107 .ok_or_else(|| anyhow!("PRStartAnsPayload is not set"))
108 }
109
110 fn get_join_request_payload(&mut self) -> Result<()> {
111 trace!("Getting JoinRequestPayload");

Callers

nothing calls this directly

Calls 15

to_stringMethod · 0.80
get_device_dataMethod · 0.45
check_roaming_allowedMethod · 0.45
set_device_infoMethod · 0.45
get_random_dev_addrMethod · 0.45
validate_micMethod · 0.45

Tested by

no test coverage detected