| 440 | } |
| 441 | |
| 442 | async fn log_tx_ack_error(&self) -> Result<()> { |
| 443 | trace!("Logging tx ack error"); |
| 444 | |
| 445 | let tenant = self.tenant.as_ref().unwrap(); |
| 446 | let app = self.application.as_ref().unwrap(); |
| 447 | let dp = self.device_profile.as_ref().unwrap(); |
| 448 | let dev = self.device.as_ref().unwrap(); |
| 449 | |
| 450 | let mut tags = (*app.tags).clone(); |
| 451 | tags.extend((*dp.tags).clone()); |
| 452 | tags.extend((*dev.tags).clone()); |
| 453 | |
| 454 | let pl = integration_pb::LogEvent { |
| 455 | time: Some(Utc::now().into()), |
| 456 | device_info: Some(integration_pb::DeviceInfo { |
| 457 | tenant_id: tenant.id.to_string(), |
| 458 | tenant_name: tenant.name.clone(), |
| 459 | application_id: app.id.to_string(), |
| 460 | application_name: app.name.to_string(), |
| 461 | device_profile_id: dp.id.to_string(), |
| 462 | device_profile_name: dp.name.clone(), |
| 463 | device_name: dev.name.clone(), |
| 464 | device_class_enabled: dev.enabled_class.to_proto().into(), |
| 465 | dev_eui: dev.dev_eui.to_string(), |
| 466 | tags, |
| 467 | }), |
| 468 | level: integration_pb::LogLevel::Error.into(), |
| 469 | code: integration_pb::LogCode::DownlinkGateway.into(), |
| 470 | description: self.downlink_tx_ack_status.into(), |
| 471 | ..Default::default() |
| 472 | }; |
| 473 | |
| 474 | integration::log_event(app.id.into(), &dev.variables, &pl).await; |
| 475 | |
| 476 | Ok(()) |
| 477 | } |
| 478 | |
| 479 | async fn send_tx_ack_event(&self) -> Result<()> { |
| 480 | trace!("Sending tx ack event"); |