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

Function is_roaming_dev_addr

chirpstack/src/backend/roaming.rs:181–210  ·  view source on GitHub ↗
(dev_addr: DevAddr)

Source from the content-addressed store, hash-verified

179}
180
181pub fn is_roaming_dev_addr(dev_addr: DevAddr) -> bool {
182 let conf = config::get();
183
184 if !is_enabled() {
185 return false;
186 }
187
188 for net_id in &[
189 // Configured NetID.
190 conf.network.net_id,
191 // Test NetIDs. For roaming it is expected that non-testing NetIDs will be used. These are
192 // included as non-roaming NetIDs as one might start with a test-NetID and then acquires an
193 // official NetID to setup roaming. Not including these would mean that all devices must
194 // re-join to obtain a new DevAddr.
195 NetID::from_be_bytes([0, 0, 0]),
196 NetID::from_be_bytes([0, 0, 1]),
197 ] {
198 if dev_addr.is_net_id(*net_id) {
199 return false;
200 }
201 }
202
203 for net_id in &conf.network.secondary_net_ids {
204 if dev_addr.is_net_id(*net_id) {
205 return false;
206 }
207 }
208
209 true
210}
211
212pub fn get_net_ids_for_dev_addr(dev_addr: DevAddr) -> Vec<NetID> {
213 let mut out: Vec<NetID> = Vec::new();

Callers 1

Calls 3

is_enabledFunction · 0.85
is_net_idMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected