From e47523a7346e88e50e2bd198802244339061454e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 29 Apr 2024 21:18:32 +0200 Subject: [PATCH] move generic struct --- src/interface/udp_server.rs | 3 +-- src/lib.rs | 6 ++++++ src/pus/mod.rs | 9 +-------- src/tmtc/tc_source.rs | 3 ++- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/interface/udp_server.rs b/src/interface/udp_server.rs index 9a6cfb8..858ce27 100644 --- a/src/interface/udp_server.rs +++ b/src/interface/udp_server.rs @@ -2,12 +2,11 @@ use std::net::{SocketAddr, UdpSocket}; use std::sync::mpsc; use log::{info, warn}; +use ops_sat_rs::HandlingStatus; use satrs::hal::std::udp_server::{ReceiveResult, UdpTcServer}; use satrs::queue::GenericSendError; use satrs::tmtc::PacketAsVec; -use crate::pus::HandlingStatus; - pub trait UdpTmHandler { fn send_tm_to_udp_client(&mut self, socket: &UdpSocket, recv_addr: &SocketAddr); } diff --git a/src/lib.rs b/src/lib.rs index 2b6f688..698da0b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -3,6 +3,12 @@ use satrs::spacepackets::time::TimeWriter; pub mod config; +#[derive(Debug, PartialEq, Eq, Copy, Clone)] +pub enum HandlingStatus { + Empty, + HandledOne, +} + #[derive(Debug)] pub struct TimeStampHelper { stamper: CdsTime, diff --git a/src/pus/mod.rs b/src/pus/mod.rs index b8fc9c7..a2b1020 100644 --- a/src/pus/mod.rs +++ b/src/pus/mod.rs @@ -10,7 +10,7 @@ use crate::requests::GenericRequestRouter; use log::warn; use ops_sat_rs::config::components::PUS_ROUTING_SERVICE; use ops_sat_rs::config::{tmtc_err, CustomPusServiceId}; -use ops_sat_rs::TimeStampHelper; +use ops_sat_rs::{HandlingStatus, TimeStampHelper}; use satrs::pus::verification::{ self, FailParams, TcStateAccepted, TcStateStarted, VerificationReporter, VerificationReporterCfg, VerificationReportingProvider, VerificationToken, @@ -30,13 +30,6 @@ use satrs::ComponentId; use std::fmt::Debug; use std::sync::mpsc::{self, Sender}; -#[derive(Debug, PartialEq, Eq, Copy, Clone)] -#[allow(dead_code)] -pub enum HandlingStatus { - Empty, - HandledOne, -} - pub fn create_verification_reporter(owner_id: ComponentId, apid: Apid) -> VerificationReporter { let verif_cfg = VerificationReporterCfg::new(apid, 1, 2, 8).unwrap(); // Every software component which needs to generate verification telemetry, gets a cloned diff --git a/src/tmtc/tc_source.rs b/src/tmtc/tc_source.rs index 02cf5d0..055628e 100644 --- a/src/tmtc/tc_source.rs +++ b/src/tmtc/tc_source.rs @@ -1,8 +1,9 @@ use std::sync::mpsc::{self, TryRecvError}; +use ops_sat_rs::HandlingStatus; use satrs::{pus::MpscTmAsVecSender, tmtc::PacketAsVec}; -use crate::pus::{HandlingStatus, PusTcDistributor}; +use crate::pus::PusTcDistributor; // TC source components where the heap is the backing memory of the received telecommands. pub struct TcSourceTaskDynamic {