| 376 | } |
| 377 | |
| 378 | async fn location_event( |
| 379 | &self, |
| 380 | _vars: &HashMap<String, String>, |
| 381 | pl: &integration::LocationEvent, |
| 382 | ) -> Result<()> { |
| 383 | let dev_info = pl |
| 384 | .device_info |
| 385 | .as_ref() |
| 386 | .ok_or_else(|| anyhow!("device_info is None"))?; |
| 387 | |
| 388 | let topic = |
| 389 | self.get_event_topic(&dev_info.application_id, &dev_info.dev_eui, "location")?; |
| 390 | let b = match self.json { |
| 391 | true => serde_json::to_vec(&pl)?, |
| 392 | false => pl.encode_to_vec(), |
| 393 | }; |
| 394 | |
| 395 | self.publish_event(&topic, b).await |
| 396 | } |
| 397 | } |
| 398 | |
| 399 | async fn message_callback( |