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

Method location_event

chirpstack/src/integration/thingsboard.rs:222–244  ·  view source on GitHub ↗
(
        &self,
        vars: &HashMap<String, String>,
        pl: &integration::LocationEvent,
    )

Source from the content-addressed store, hash-verified

220 }
221
222 async fn location_event(
223 &self,
224 vars: &HashMap<String, String>,
225 pl: &integration::LocationEvent,
226 ) -> Result<()> {
227 if let Some(loc) = &pl.location {
228 let di = pl.device_info.as_ref().unwrap();
229 let mut telemetry: BTreeMap<String, Value> = BTreeMap::new();
230 telemetry.insert("location_latitude".to_string(), Value::Float(loc.latitude));
231 telemetry.insert(
232 "location_longitude".to_string(),
233 Value::Float(loc.longitude),
234 );
235 telemetry.insert("location_altitude".to_string(), Value::Float(loc.altitude));
236
237 let telemetry = Payload(telemetry);
238
239 info!(dev_eui = %di.dev_eui, server = %self.server, "Sending device telemetry");
240 self.send_telemetry(vars, &telemetry).await?;
241 }
242
243 Ok(())
244 }
245}
246
247#[derive(Clone)]

Callers 1

test_thingsboardFunction · 0.45

Calls 6

unwrapMethod · 0.80
as_refMethod · 0.80
insertMethod · 0.80
to_stringMethod · 0.80
send_telemetryMethod · 0.80
PayloadClass · 0.70

Tested by 1

test_thingsboardFunction · 0.36