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

Function struct_to_measurements

chirpstack/src/integration/influxdb.rs:353–377  ·  view source on GitHub ↗
(
    tags: &HashMap<String, String>,
    s: &pbjson_types::Struct,
)

Source from the content-addressed store, hash-verified

351}
352
353fn struct_to_measurements(
354 tags: &HashMap<String, String>,
355 s: &pbjson_types::Struct,
356) -> Vec<Measurement> {
357 let mut out: Vec<Measurement> = Vec::new();
358
359 out.append(&mut struct_values_to_location(
360 tags,
361 "device_frmpayload_data",
362 &s.fields,
363 ));
364
365 for (k, v) in &s.fields {
366 if k == "latitude" || k == "longitude" {
367 continue;
368 }
369 out.append(&mut struct_value_to_measurements(
370 tags,
371 &format!("device_frmpayload_data_{}", k),
372 v,
373 ))
374 }
375
376 out
377}
378
379fn struct_values_to_location(
380 tags: &HashMap<String, String>,

Callers 1

uplink_eventMethod · 0.85

Calls 2

Tested by

no test coverage detected