diff --git a/satrs/src/pus/mod.rs b/satrs/src/pus/mod.rs index f989cbb..343b8ab 100644 --- a/satrs/src/pus/mod.rs +++ b/satrs/src/pus/mod.rs @@ -804,49 +804,6 @@ pub mod std_mod { pub type MpscTmInSharedPoolSender = TmInSharedPoolSender>; pub type MpscTmInSharedPoolSenderBounded = TmInSharedPoolSender>; - /* - /// This class can be used if frequent heap allocations during run-time are not an issue. - /// PUS TM packets will be sent around as [Vec]s. Please note that the current implementation - /// of this class can not deal with store addresses, so it is assumed that is is always - /// going to be called with direct packets. - #[derive(Clone)] - pub struct TmAsVecSenderWithId { - // id: ComponentId, - //name: &'static str, - sender: Sender, - } - - impl From>> for EcssTmtcError { - fn from(_: mpsc::SendError>) -> Self { - Self::Send(GenericSendError::RxDisconnected) - } - } - - impl TmAsVecSenderWithId { - pub fn new(id: ComponentId, name: &'static str, sender: Sender) -> Self { - Self { id, sender, name } - } - } - - impl ChannelWithId for TmAsVecSenderWithId { - fn id(&self) -> ComponentId { - self.id - } - fn name(&self) -> &'static str { - self.name - } - } - - impl EcssTmSenderCore for TmAsVecSenderWithId { - fn send_tm(&self, tm: PusTmVariant) -> Result<(), EcssTmtcError> { - self.sender.send_tm(tm) - } - } - - pub type TmAsVecSenderWithMpsc = TmAsVecSenderWithId>>; - pub type TmAsVecSenderWithBoundedMpsc = TmAsVecSenderWithId>>; - */ - pub type MpscTcReceiver = mpsc::Receiver; impl EcssTcReceiverCore for MpscTcReceiver { diff --git a/satrs/src/pus/verification.rs b/satrs/src/pus/verification.rs index a890b2e..cd89905 100644 --- a/satrs/src/pus/verification.rs +++ b/satrs/src/pus/verification.rs @@ -17,9 +17,10 @@ //! use std::time::Duration; //! use satrs::pool::{PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig}; //! use satrs::pus::verification::{ -//! VerificationReportingProvider, VerificationReporterCfg +//! VerificationReportingProvider, VerificationReporterCfg, VerificationReporter //! }; //! use satrs::seq_count::SeqCountProviderSimple; +//! use satrs::request::UniqueApidTargetId; //! use satrs::pus::MpscTmInSharedPoolSender; //! use satrs::tmtc::tm_helper::SharedTmPool; //! use spacepackets::ecss::PusPacket; @@ -29,15 +30,16 @@ //! //! const EMPTY_STAMP: [u8; 7] = [0; 7]; //! const TEST_APID: u16 = 0x02; +//! const TEST_COMPONENT_ID: UniqueApidTargetId = UniqueApidTargetId::new(TEST_APID, 0x05); //! //! let pool_cfg = StaticPoolConfig::new(vec![(10, 32), (10, 64), (10, 128), (10, 1024)], false); //! let tm_pool = StaticMemoryPool::new(pool_cfg.clone()); //! let shared_tm_store = SharedTmPool::new(tm_pool); //! let tm_store = shared_tm_store.clone_backing_pool(); //! let (verif_tx, verif_rx) = mpsc::channel(); -//! let sender = MpscTmInSharedPoolSender::new(0, "Test Sender", shared_tm_store, verif_tx); +//! let sender = MpscTmInSharedPoolSender::new(shared_tm_store, verif_tx); //! let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap(); -//! let mut reporter = VerificationReporterWithSender::new(&cfg , sender); +//! let mut reporter = VerificationReporter::new(&cfg); //! //! let mut sph = SpHeader::tc_unseg(TEST_APID, 0, 0).unwrap(); //! let tc_header = PusTcSecondaryHeader::new_simple(17, 1); @@ -45,19 +47,19 @@ //! let init_token = reporter.add_tc(&pus_tc_0); //! //! // Complete success sequence for a telecommand -//! let accepted_token = reporter.acceptance_success(init_token, &EMPTY_STAMP).unwrap(); -//! let started_token = reporter.start_success(accepted_token, &EMPTY_STAMP).unwrap(); -//! reporter.completion_success(started_token, &EMPTY_STAMP).unwrap(); +//! let accepted_token = reporter.acceptance_success(TEST_COMPONENT_ID.id(), &sender, init_token, &EMPTY_STAMP).unwrap(); +//! let started_token = reporter.start_success(TEST_COMPONENT_ID.id(), &sender, accepted_token, &EMPTY_STAMP).unwrap(); +//! reporter.completion_success(TEST_COMPONENT_ID.id(), &sender, started_token, &EMPTY_STAMP).unwrap(); //! //! // Verify it arrives correctly on receiver end //! let mut tm_buf: [u8; 1024] = [0; 1024]; //! let mut packet_idx = 0; //! while packet_idx < 3 { -//! let addr = verif_rx.recv_timeout(Duration::from_millis(10)).unwrap(); +//! let tm_in_store = verif_rx.recv_timeout(Duration::from_millis(10)).unwrap(); //! let tm_len; //! { //! let mut rg = tm_store.write().expect("Error locking shared pool"); -//! let store_guard = rg.read_with_guard(addr); +//! let store_guard = rg.read_with_guard(tm_in_store.store_addr); //! tm_len = store_guard.read(&mut tm_buf).expect("Error reading TM slice"); //! } //! let (pus_tm, _) = PusTmReader::new(&tm_buf[0..tm_len], 7) diff --git a/satrs/tests/pus_verification.rs b/satrs/tests/pus_verification.rs index 46dda69..6f7cc87 100644 --- a/satrs/tests/pus_verification.rs +++ b/satrs/tests/pus_verification.rs @@ -18,7 +18,7 @@ pub mod crossbeam_test { use std::time::Duration; const TEST_APID: u16 = 0x03; - const TEST_ID: TargetAndApidId = TargetAndApidId::new(TEST_APID, 0x05); + const TEST_ID: UniqueApidTargetId = UniqueApidTargetId::new(TEST_APID, 0x05); const FIXED_STAMP: [u8; 7] = [0; 7]; const PACKETS_SENT: u8 = 8;