| 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)] |