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

Method set_dev_addr_prefix

lrwn/src/devaddr.rs:237–249  ·  view source on GitHub ↗
(&mut self, prefix: DevAddrPrefix)

Source from the content-addressed store, hash-verified

235 }
236
237 pub fn set_dev_addr_prefix(&mut self, prefix: DevAddrPrefix) {
238 // convert devaddr to u32
239 let mut devaddr = u32::from_be_bytes(self.0);
240
241 // clean the prefix bits
242 let mask = u32::MAX; // all u32 bits to 1
243 devaddr &= !(mask << (32 - prefix.size()));
244
245 // set the prefix
246 devaddr |= u32::from_be_bytes(prefix.prefix());
247
248 self.0 = devaddr.to_be_bytes();
249 }
250
251 fn get_nwkid(&self, prefix_length: u32, nwkid_bits: u32) -> Vec<u8> {
252 // convert devaddr to u32

Callers 8

get_random_dev_addrFunction · 0.80
test_fns_uplinkFunction · 0.80
test_sns_uplinkFunction · 0.80
test_sns_dev_not_foundFunction · 0.80
test_deviceFunction · 0.80
is_net_idMethod · 0.80

Calls 3

sizeMethod · 0.45
prefixMethod · 0.45
to_be_bytesMethod · 0.45

Tested by 6

test_fns_uplinkFunction · 0.64
test_sns_uplinkFunction · 0.64
test_sns_dev_not_foundFunction · 0.64
test_deviceFunction · 0.64