| 338 | } |
| 339 | |
| 340 | async fn log_event( |
| 341 | &self, |
| 342 | _vars: &HashMap<String, String>, |
| 343 | pl: &integration::LogEvent, |
| 344 | ) -> Result<()> { |
| 345 | let dev_info = pl |
| 346 | .device_info |
| 347 | .as_ref() |
| 348 | .ok_or_else(|| anyhow!("device_info is None"))?; |
| 349 | |
| 350 | let topic = self.get_event_topic(&dev_info.application_id, &dev_info.dev_eui, "log")?; |
| 351 | let b = match self.json { |
| 352 | true => serde_json::to_vec(&pl)?, |
| 353 | false => pl.encode_to_vec(), |
| 354 | }; |
| 355 | |
| 356 | self.publish_event(&topic, b).await |
| 357 | } |
| 358 | |
| 359 | async fn status_event( |
| 360 | &self, |