| 485 | } |
| 486 | |
| 487 | async fn handle_retransmission_reset(&self) -> Result<(), Error> { |
| 488 | trace!("Handle retransmission and reset"); |
| 489 | let dev = self.device.as_ref().unwrap(); |
| 490 | |
| 491 | if (!self.retransmission && !self.reset) || dev.skip_fcnt_check { |
| 492 | return Ok(()); |
| 493 | } |
| 494 | |
| 495 | let app = self.application.as_ref().unwrap(); |
| 496 | let ts: DateTime<Utc> = |
| 497 | helpers::get_rx_timestamp(&self.uplink_frame_set.rx_info_set).into(); |
| 498 | |
| 499 | if self.retransmission { |
| 500 | let pl = integration_pb::LogEvent { |
| 501 | time: Some(ts.into()), |
| 502 | device_info: self.device_info.clone(), |
| 503 | level: integration_pb::LogLevel::Warning.into(), |
| 504 | code: integration_pb::LogCode::UplinkFCntRetransmission.into(), |
| 505 | description: |
| 506 | "Uplink was flagged as re-transmission / frame-counter did not increment".into(), |
| 507 | context: [ |
| 508 | ( |
| 509 | "deduplication_id".to_string(), |
| 510 | self.uplink_frame_set.uplink_set_id.to_string(), |
| 511 | ), |
| 512 | ("f_cnt_up".to_string(), self.f_cnt_up_full.to_string()), |
| 513 | ] |
| 514 | .iter() |
| 515 | .cloned() |
| 516 | .collect(), |
| 517 | }; |
| 518 | integration::log_event(app.id.into(), &dev.variables, &pl).await; |
| 519 | } |
| 520 | |
| 521 | if self.reset { |
| 522 | let pl = integration_pb::LogEvent { |
| 523 | time: Some(ts.into()), |
| 524 | device_info: self.device_info.clone(), |
| 525 | level: integration_pb::LogLevel::Warning.into(), |
| 526 | code: integration_pb::LogCode::UplinkFCntReset.into(), |
| 527 | description: "Frame-counter reset or rollover detected".into(), |
| 528 | context: [ |
| 529 | ( |
| 530 | "deduplication_id".to_string(), |
| 531 | self.uplink_frame_set.uplink_set_id.to_string(), |
| 532 | ), |
| 533 | ("f_cnt_up".to_string(), self.f_cnt_up_full.to_string()), |
| 534 | ] |
| 535 | .iter() |
| 536 | .cloned() |
| 537 | .collect(), |
| 538 | }; |
| 539 | integration::log_event(app.id.into(), &dev.variables, &pl).await; |
| 540 | } |
| 541 | |
| 542 | Err(Error::Abort) |
| 543 | } |
| 544 | |