mirror of
https://github.com/chirpstack/chirpstack.git
synced 2025-06-13 04:58:09 +00:00
Re-generate API + update code.
This commit is contained in:
47
api/rust/src/gw.rs
vendored
47
api/rust/src/gw.rs
vendored
@ -127,58 +127,13 @@ impl UplinkFrame {
|
||||
antenna: rx_info.antenna,
|
||||
location: rx_info.location.clone(),
|
||||
context: rx_info.context.clone(),
|
||||
metadata: Some(pbjson_types::Struct {
|
||||
fields: rx_info
|
||||
.metadata
|
||||
.iter()
|
||||
.map(|(k, v)| {
|
||||
(
|
||||
k.to_string(),
|
||||
pbjson_types::Value {
|
||||
kind: Some(pbjson_types::value::Kind::StringValue(
|
||||
v.to_string(),
|
||||
)),
|
||||
},
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
}),
|
||||
metadata: rx_info.metadata.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl UplinkRxInfo {
|
||||
pub fn get_metadata_string(&self, k: &str) -> Option<String> {
|
||||
if let Some(v) = &self.metadata {
|
||||
if let Some(v) = v.fields.get(k) {
|
||||
if let Some(pbjson_types::value::Kind::StringValue(v)) = &v.kind {
|
||||
return Some(v.clone());
|
||||
}
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn set_metadata_string(&mut self, k: &str, v: &str) {
|
||||
if self.metadata.is_none() {
|
||||
self.metadata = Some(pbjson_types::Struct {
|
||||
..Default::default()
|
||||
});
|
||||
}
|
||||
|
||||
if let Some(md) = &mut self.metadata {
|
||||
md.fields.insert(
|
||||
k.to_string(),
|
||||
pbjson_types::Value {
|
||||
kind: Some(pbjson_types::value::Kind::StringValue(v.to_string())),
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DownlinkFrame {
|
||||
pub fn v4_migrate(&mut self) {
|
||||
self.gateway_id_legacy = hex::decode(&self.gateway_id).unwrap();
|
||||
|
Reference in New Issue
Block a user