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

Function get_region_config_id

chirpstack/src/region.rs:91–103  ·  view source on GitHub ↗

This returns the (first) region-name, based on the given common-name. This function is used for roaming, as within the context of roaming, only the common-name is given by the other party.

(common_name: region::CommonName)

Source from the content-addressed store, hash-verified

89/// This function is used for roaming, as within the context of roaming, only
90/// the common-name is given by the other party.
91pub fn get_region_config_id(common_name: region::CommonName) -> Result<String> {
92 let regions_r = REGIONS.read().unwrap();
93 for (k, v) in &*regions_r {
94 if v.get_name() == common_name {
95 return Ok(k.clone());
96 }
97 }
98
99 Err(anyhow!(
100 "No region configured with common-name: {}",
101 common_name
102 ))
103}

Callers 4

_handleMethod · 0.85
_handle_xmit_data_reqFunction · 0.85

Calls 2

unwrapMethod · 0.80
get_nameMethod · 0.45

Tested by

no test coverage detected