From dbcb1fb350d06aa1504c067e27274dc4747d25f1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 10 Jul 2023 01:27:37 +0200 Subject: [PATCH] issue for another day.. --- satrs-core/Cargo.toml | 2 +- satrs-core/src/hal/host/udp_server.rs | 4 ++-- satrs-core/src/pus/event.rs | 8 +++---- satrs-core/src/pus/event_srv.rs | 2 +- satrs-core/src/pus/mod.rs | 20 ++++++++--------- satrs-core/src/pus/scheduler.rs | 6 ++--- satrs-core/src/pus/scheduler_srv.rs | 2 +- satrs-core/src/pus/test.rs | 10 ++++----- satrs-core/src/pus/verification.rs | 32 +++++++++++++-------------- satrs-core/src/tmtc/ccsds_distrib.rs | 4 ++-- satrs-core/src/tmtc/pus_distrib.rs | 12 +++++----- satrs-core/src/tmtc/tm_helper.rs | 6 ++--- satrs-core/tests/pus_events.rs | 2 +- satrs-core/tests/pus_verification.rs | 4 ++-- satrs-example/src/bin/simpleclient.rs | 4 ++-- satrs-example/src/main.rs | 4 ++-- satrs-example/src/pus/action.rs | 2 +- satrs-example/src/pus/hk.rs | 2 +- satrs-example/src/pus/mod.rs | 2 +- satrs-example/src/pus/test.rs | 2 +- satrs-example/src/tmtc.rs | 6 ++--- 21 files changed, 68 insertions(+), 68 deletions(-) diff --git a/satrs-core/Cargo.toml b/satrs-core/Cargo.toml index 22e9d5b..ef7bbf0 100644 --- a/satrs-core/Cargo.toml +++ b/satrs-core/Cargo.toml @@ -64,7 +64,7 @@ optional = true # version = "0.6" # path = "../spacepackets" git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git" -rev = "784564a20ed" +rev = "b553cdc2eccd2" default-features = false [dev-dependencies] diff --git a/satrs-core/src/hal/host/udp_server.rs b/satrs-core/src/hal/host/udp_server.rs index 8f80eb7..24be835 100644 --- a/satrs-core/src/hal/host/udp_server.rs +++ b/satrs-core/src/hal/host/udp_server.rs @@ -22,7 +22,7 @@ use std::vec::Vec; /// use satrs_core::hal::host::udp_server::UdpTcServer; /// use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; /// use spacepackets::SpHeader; -/// use spacepackets::tc::PusTc; +/// use spacepackets::ecss::tc::PusTc; /// /// #[derive (Default)] /// struct PingReceiver {} @@ -142,8 +142,8 @@ impl UdpTcServer { mod tests { use crate::hal::host::udp_server::{ReceiveResult, UdpTcServer}; use crate::tmtc::ReceivesTcCore; + use spacepackets::ecss::tc::PusTc; use spacepackets::ecss::SerializablePusPacket; - use spacepackets::tc::PusTc; use spacepackets::SpHeader; use std::boxed::Box; use std::collections::VecDeque; diff --git a/satrs-core/src/pus/event.rs b/satrs-core/src/pus/event.rs index c1dfc5d..f48ba29 100644 --- a/satrs-core/src/pus/event.rs +++ b/satrs-core/src/pus/event.rs @@ -1,7 +1,7 @@ use crate::pus::{source_buffer_large_enough, EcssTmtcError}; +use spacepackets::ecss::tm::PusTmCreator; +use spacepackets::ecss::tm::PusTmSecondaryHeader; use spacepackets::ecss::{EcssEnumeration, PusError}; -use spacepackets::tm::PusTm; -use spacepackets::tm::PusTmSecondaryHeader; use spacepackets::{SpHeader, MAX_APID}; use crate::pus::EcssTmSenderCore; @@ -121,7 +121,7 @@ impl EventReporterBase { time_stamp: &'a [u8], event_id: impl EcssEnumeration, aux_data: Option<&[u8]>, - ) -> Result { + ) -> Result { let mut src_data_len = event_id.size(); if let Some(aux_data) = aux_data { src_data_len += aux_data.len(); @@ -144,7 +144,7 @@ impl EventReporterBase { buf[current_idx..current_idx + aux_data.len()].copy_from_slice(aux_data); current_idx += aux_data.len(); } - Ok(PusTm::new( + Ok(PusTmCreator::new( &mut sp_header, sec_header, Some(&buf[0..current_idx]), diff --git a/satrs-core/src/pus/event_srv.rs b/satrs-core/src/pus/event_srv.rs index 8f3abb4..69ee867 100644 --- a/satrs-core/src/pus/event_srv.rs +++ b/satrs-core/src/pus/event_srv.rs @@ -9,8 +9,8 @@ use crate::pus::{ PusPacketHandlingError, PusServiceBase, PusServiceHandler, }; use spacepackets::ecss::event::Subservice; +use spacepackets::ecss::tc::PusTc; use spacepackets::ecss::PusPacket; -use spacepackets::tc::PusTc; use std::boxed::Box; use std::sync::mpsc::Sender; diff --git a/satrs-core/src/pus/mod.rs b/satrs-core/src/pus/mod.rs index 7325b43..fa21ea2 100644 --- a/satrs-core/src/pus/mod.rs +++ b/satrs-core/src/pus/mod.rs @@ -8,9 +8,9 @@ use core::fmt::{Display, Formatter}; use downcast_rs::{impl_downcast, Downcast}; #[cfg(feature = "alloc")] use dyn_clone::DynClone; +use spacepackets::ecss::tc::{PusTcCreator, PusTcReader}; +use spacepackets::ecss::tm::PusTmCreator; use spacepackets::ecss::PusError; -use spacepackets::tc::PusTc; -use spacepackets::tm::PusTm; use spacepackets::{ByteConversionError, SizeMissmatch, SpHeader}; use std::error::Error; @@ -36,7 +36,7 @@ pub use std_mod::*; #[derive(Debug, PartialEq, Eq, Clone)] pub enum PusTmWrapper<'tm> { InStore(StoreAddr), - Direct(PusTm<'tm>), + Direct(PusTmCreator<'tm>), } impl From for PusTmWrapper<'_> { @@ -45,8 +45,8 @@ impl From for PusTmWrapper<'_> { } } -impl<'tm> From> for PusTmWrapper<'tm> { - fn from(value: PusTm<'tm>) -> Self { +impl<'tm> From> for PusTmWrapper<'tm> { + fn from(value: PusTmCreator<'tm>) -> Self { Self::Direct(value) } } @@ -193,7 +193,7 @@ pub trait EcssTmSenderCore: EcssChannel { /// This sender object is responsible for sending PUS telecommands to a TC recipient. Each /// telecommand can optionally have a token which contains its verification state. pub trait EcssTcSenderCore: EcssChannel { - fn send_tc(&self, tc: PusTc, token: Option) -> Result<(), EcssTmtcError>; + fn send_tc(&self, tc: PusTcCreator, token: Option) -> Result<(), EcssTmtcError>; } pub struct ReceivedTcWrapper { @@ -235,7 +235,7 @@ pub trait EcssTcReceiverCore: EcssChannel { /// packets into it. pub trait ReceivesEcssPusTc { type Error; - fn pass_pus_tc(&mut self, header: &SpHeader, pus_tc: &PusTc) -> Result<(), Self::Error>; + fn pass_pus_tc(&mut self, header: &SpHeader, pus_tc: &PusTcReader) -> Result<(), Self::Error>; } #[cfg(feature = "alloc")] @@ -317,11 +317,11 @@ pub mod std_mod { use crate::ChannelId; use alloc::boxed::Box; use alloc::vec::Vec; + use spacepackets::ecss::tm::{PusTm, PusTmCreator}; use spacepackets::ecss::PusError; use spacepackets::time::cds::TimeProvider; use spacepackets::time::StdTimestampError; use spacepackets::time::TimeWriter; - use spacepackets::tm::PusTm; use std::cell::RefCell; use std::string::String; use std::sync::mpsc; @@ -353,7 +353,7 @@ pub mod std_mod { } } impl MpscTmInStoreSender { - pub fn send_direct_tm(&self, tm: PusTm) -> Result<(), EcssTmtcError> { + pub fn send_direct_tm(&self, tm: PusTmCreator) -> Result<(), EcssTmtcError> { let addr = self.shared_tm_store.add_pus_tm(&tm)?; self.sender .send(addr) @@ -641,7 +641,7 @@ pub(crate) fn source_buffer_large_enough(cap: usize, len: usize) -> Result<(), E #[cfg(test)] pub(crate) mod tests { - use spacepackets::tm::{GenericPusTmSecondaryHeader, PusTm}; + use spacepackets::ecss::tm::{GenericPusTmSecondaryHeader, PusTm}; use spacepackets::CcsdsPacket; #[derive(Debug, Eq, PartialEq, Clone)] diff --git a/satrs-core/src/pus/scheduler.rs b/satrs-core/src/pus/scheduler.rs index 0406f83..8f67a94 100644 --- a/satrs-core/src/pus/scheduler.rs +++ b/satrs-core/src/pus/scheduler.rs @@ -8,8 +8,8 @@ use core::time::Duration; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use spacepackets::ecss::scheduling::TimeWindowType; +use spacepackets::ecss::tc::{GenericPusTcSecondaryHeader, PusTc}; use spacepackets::ecss::PusError; -use spacepackets::tc::{GenericPusTcSecondaryHeader, PusTc}; use spacepackets::time::{CcsdsTimeProvider, TimestampError, UnixTimestamp}; use spacepackets::CcsdsPacket; #[cfg(feature = "std")] @@ -239,8 +239,8 @@ pub mod alloc_mod { use alloc::vec::Vec; use core::time::Duration; use spacepackets::ecss::scheduling::TimeWindowType; + use spacepackets::ecss::tc::PusTc; use spacepackets::ecss::PusPacket; - use spacepackets::tc::PusTc; use spacepackets::time::cds::DaysLen24Bits; use spacepackets::time::{cds, CcsdsTimeProvider, TimeReader, UnixTimestamp}; @@ -641,8 +641,8 @@ mod tests { use super::*; use crate::pool::{LocalPool, PoolCfg, PoolProvider, StoreAddr, StoreError}; use alloc::collections::btree_map::Range; + use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader}; use spacepackets::ecss::SerializablePusPacket; - use spacepackets::tc::{PusTc, PusTcSecondaryHeader}; use spacepackets::time::{cds, TimeWriter, UnixTimestamp}; use spacepackets::SpHeader; use std::time::Duration; diff --git a/satrs-core/src/pus/scheduler_srv.rs b/satrs-core/src/pus/scheduler_srv.rs index 52fc33a..4b4ed79 100644 --- a/satrs-core/src/pus/scheduler_srv.rs +++ b/satrs-core/src/pus/scheduler_srv.rs @@ -5,8 +5,8 @@ use crate::pus::{ EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, PusServiceHandler, }; +use spacepackets::ecss::tc::PusTc; use spacepackets::ecss::{scheduling, PusPacket}; -use spacepackets::tc::PusTc; use spacepackets::time::cds::TimeProvider; use std::boxed::Box; diff --git a/satrs-core/src/pus/test.rs b/satrs-core/src/pus/test.rs index 178493b..fcf0c97 100644 --- a/satrs-core/src/pus/test.rs +++ b/satrs-core/src/pus/test.rs @@ -4,9 +4,9 @@ use crate::pus::{ EcssTcReceiver, EcssTmSender, PartialPusHandlingError, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, PusServiceHandler, PusTmWrapper, }; +use spacepackets::ecss::tc::PusTc; +use spacepackets::ecss::tm::{PusTm, PusTmCreator, PusTmSecondaryHeader}; use spacepackets::ecss::PusPacket; -use spacepackets::tc::PusTc; -use spacepackets::tm::{PusTm, PusTmSecondaryHeader}; use spacepackets::SpHeader; use std::boxed::Box; @@ -72,7 +72,7 @@ impl PusServiceHandler for PusService17TestHandler { // Sequence count will be handled centrally in TM funnel. let mut reply_header = SpHeader::tm_unseg(self.psb.tm_apid, 0, 0).unwrap(); let tc_header = PusTmSecondaryHeader::new_simple(17, 2, &time_stamp); - let ping_reply = PusTm::new(&mut reply_header, tc_header, None, true); + let ping_reply = PusTmCreator::new(&mut reply_header, tc_header, None, true); let result = self .psb .tm_sender @@ -116,9 +116,9 @@ mod tests { }; use crate::pus::{MpscTcInStoreReceiver, MpscTmInStoreSender, PusServiceHandler}; use crate::tmtc::tm_helper::SharedTmStore; + use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader}; + use spacepackets::ecss::tm::PusTm; use spacepackets::ecss::{PusPacket, SerializablePusPacket}; - use spacepackets::tc::{PusTc, PusTcSecondaryHeader}; - use spacepackets::tm::PusTm; use spacepackets::{SequenceFlags, SpHeader}; use std::boxed::Box; use std::sync::{mpsc, RwLock}; diff --git a/satrs-core/src/pus/verification.rs b/satrs-core/src/pus/verification.rs index 1f25c90..4e3a9e3 100644 --- a/satrs-core/src/pus/verification.rs +++ b/satrs-core/src/pus/verification.rs @@ -22,8 +22,8 @@ //! use satrs_core::tmtc::tm_helper::SharedTmStore; //! use spacepackets::ecss::PusPacket; //! use spacepackets::SpHeader; -//! use spacepackets::tc::{PusTc, PusTcSecondaryHeader}; -//! use spacepackets::tm::PusTm; +//! use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader}; +//! use spacepackets::ecss::tm::PusTm; //! //! const EMPTY_STAMP: [u8; 7] = [0; 7]; //! const TEST_APID: u16 = 0x02; @@ -85,9 +85,9 @@ use core::mem::size_of; use delegate::delegate; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; +use spacepackets::ecss::tc::PusTc; +use spacepackets::ecss::tm::{PusTm, PusTmCreator, PusTmSecondaryHeader}; use spacepackets::ecss::{EcssEnumeration, PusError, SerializablePusPacket}; -use spacepackets::tc::PusTc; -use spacepackets::tm::{PusTm, PusTmSecondaryHeader}; use spacepackets::{CcsdsPacket, PacketId, PacketSequenceCtrl}; use spacepackets::{SpHeader, MAX_APID}; @@ -332,19 +332,19 @@ pub enum VerifFailure {} /// This struct generally mutably borrows the source data buffer. pub struct VerificationSendable<'src_data, State, SuccessOrFailure> { token: Option>, - pus_tm: Option>, + pus_tm: Option>, phantom: PhantomData, } impl<'src_data, State, SuccessOrFailure> VerificationSendable<'src_data, State, SuccessOrFailure> { - pub(crate) fn new(pus_tm: PusTm<'src_data>, token: VerificationToken) -> Self { + pub(crate) fn new(pus_tm: PusTmCreator<'src_data>, token: VerificationToken) -> Self { Self { token: Some(token), pus_tm: Some(pus_tm), phantom: PhantomData, } } - pub(crate) fn new_no_token(pus_tm: PusTm<'src_data>) -> Self { + pub(crate) fn new_no_token(pus_tm: PusTmCreator<'src_data>) -> Self { Self { token: None, pus_tm: Some(pus_tm), @@ -356,11 +356,11 @@ impl<'src_data, State, SuccessOrFailure> VerificationSendable<'src_data, State, self.pus_tm.as_ref().unwrap().len_packed() } - pub fn pus_tm(&self) -> &PusTm<'src_data> { + pub fn pus_tm(&self) -> &PusTmCreator<'src_data> { self.pus_tm.as_ref().unwrap() } - pub fn pus_tm_mut(&mut self) -> &mut PusTm<'src_data> { + pub fn pus_tm_mut(&mut self) -> &mut PusTmCreator<'src_data> { self.pus_tm.as_mut().unwrap() } } @@ -370,7 +370,7 @@ impl<'src_data, State> VerificationSendable<'src_data, State, VerifFailure> { } impl<'src_data, State> VerificationSendable<'src_data, State, VerifFailure> { - pub fn send_failure(self) -> (PusTm<'src_data>, VerificationToken) { + pub fn send_failure(self) -> (PusTmCreator<'src_data>, VerificationToken) { (self.pus_tm.unwrap(), self.token.unwrap()) } } @@ -787,7 +787,7 @@ impl VerificationReporterCore { req_id: &RequestId, time_stamp: Option<&'src_data [u8]>, step: Option<&(impl EcssEnumeration + ?Sized)>, - ) -> Result, EcssTmtcError> { + ) -> Result, EcssTmtcError> { let mut source_data_len = size_of::(); if let Some(step) = step { source_data_len += step.size(); @@ -823,7 +823,7 @@ impl VerificationReporterCore { req_id: &RequestId, step: Option<&(impl EcssEnumeration + ?Sized)>, params: &FailParams<'src_data, '_>, - ) -> Result, EcssTmtcError> { + ) -> Result, EcssTmtcError> { let mut idx = 0; let mut source_data_len = RequestId::SIZE_AS_BYTES + params.failure_code.size(); if let Some(step) = step { @@ -868,10 +868,10 @@ impl VerificationReporterCore { sp_header: &mut SpHeader, time_stamp: Option<&'src_data [u8]>, source_data_len: usize, - ) -> PusTm<'src_data> { + ) -> PusTmCreator<'src_data> { let tm_sec_header = PusTmSecondaryHeader::new(1, subservice, msg_counter, self.dest_id, time_stamp); - PusTm::new( + PusTmCreator::new( sp_header, tm_sec_header, Some(&src_data_buf[0..source_data_len]), @@ -1506,9 +1506,9 @@ mod tests { use crate::ChannelId; use alloc::boxed::Box; use alloc::format; + use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader}; + use spacepackets::ecss::tm::PusTm; use spacepackets::ecss::{EcssEnumU16, EcssEnumU32, EcssEnumU8, PusError, PusPacket}; - use spacepackets::tc::{PusTc, PusTcSecondaryHeader}; - use spacepackets::tm::PusTm; use spacepackets::util::UnsignedEnum; use spacepackets::{ByteConversionError, CcsdsPacket, SpHeader}; use std::cell::RefCell; diff --git a/satrs-core/src/tmtc/ccsds_distrib.rs b/satrs-core/src/tmtc/ccsds_distrib.rs index eefed54..d08604c 100644 --- a/satrs-core/src/tmtc/ccsds_distrib.rs +++ b/satrs-core/src/tmtc/ccsds_distrib.rs @@ -22,7 +22,7 @@ //! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; //! use spacepackets::{CcsdsPacket, SpHeader}; //! use spacepackets::ecss::SerializablePusPacket; -//! use spacepackets::tc::PusTc; +//! use spacepackets::ecss::tc::PusTc; //! //! #[derive (Default)] //! struct ConcreteApidHandler { @@ -225,8 +225,8 @@ impl CcsdsDistributor { pub(crate) mod tests { use super::*; use crate::tmtc::ccsds_distrib::{CcsdsDistributor, CcsdsPacketHandler}; + use spacepackets::ecss::tc::PusTc; use spacepackets::ecss::SerializablePusPacket; - use spacepackets::tc::PusTc; use spacepackets::CcsdsPacket; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; diff --git a/satrs-core/src/tmtc/pus_distrib.rs b/satrs-core/src/tmtc/pus_distrib.rs index b6a5eab..a670f96 100644 --- a/satrs-core/src/tmtc/pus_distrib.rs +++ b/satrs-core/src/tmtc/pus_distrib.rs @@ -21,7 +21,7 @@ //! use satrs_core::tmtc::pus_distrib::{PusDistributor, PusServiceProvider}; //! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; //! use spacepackets::SpHeader; -//! use spacepackets::tc::PusTc; +//! use spacepackets::ecss::tc::PusTc; //! struct ConcretePusHandler { //! handler_call_count: u32 //! } @@ -66,8 +66,8 @@ use crate::tmtc::{ReceivesCcsdsTc, ReceivesTcCore}; use alloc::boxed::Box; use core::fmt::{Display, Formatter}; use downcast_rs::Downcast; +use spacepackets::ecss::tc::{PusTc, PusTcReader}; use spacepackets::ecss::{PusError, PusPacket}; -use spacepackets::tc::PusTc; use spacepackets::SpHeader; #[cfg(feature = "std")] use std::error::Error; @@ -78,7 +78,7 @@ pub trait PusServiceProvider: Downcast { &mut self, service: u8, header: &SpHeader, - pus_tc: &PusTc, + pus_tc: &PusTcReader, ) -> Result<(), Self::Error>; } downcast_rs::impl_downcast!(PusServiceProvider assoc Error); @@ -141,14 +141,14 @@ impl ReceivesTcCore for PusDistributor { impl ReceivesCcsdsTc for PusDistributor { type Error = PusDistribError; fn pass_ccsds(&mut self, header: &SpHeader, tm_raw: &[u8]) -> Result<(), Self::Error> { - let (tc, _) = PusTc::from_bytes(tm_raw).map_err(|e| PusDistribError::PusError(e))?; + let (tc, _) = PusTcReader::new(tm_raw).map_err(|e| PusDistribError::PusError(e))?; self.pass_pus_tc(header, &tc) } } impl ReceivesEcssPusTc for PusDistributor { type Error = PusDistribError; - fn pass_pus_tc(&mut self, header: &SpHeader, pus_tc: &PusTc) -> Result<(), Self::Error> { + fn pass_pus_tc(&mut self, header: &SpHeader, pus_tc: &PusTcReader) -> Result<(), Self::Error> { self.service_provider .handle_pus_tc_packet(pus_tc.service(), header, pus_tc) .map_err(|e| PusDistribError::CustomError(e)) @@ -175,8 +175,8 @@ mod tests { }; use crate::tmtc::ccsds_distrib::{CcsdsDistributor, CcsdsPacketHandler}; use alloc::vec::Vec; + use spacepackets::ecss::tc::PusTc; use spacepackets::ecss::PusError; - use spacepackets::tc::PusTc; use spacepackets::CcsdsPacket; #[cfg(feature = "std")] use std::collections::VecDeque; diff --git a/satrs-core/src/tmtc/tm_helper.rs b/satrs-core/src/tmtc/tm_helper.rs index da2bc1e..93d12c8 100644 --- a/satrs-core/src/tmtc/tm_helper.rs +++ b/satrs-core/src/tmtc/tm_helper.rs @@ -1,6 +1,6 @@ +use spacepackets::ecss::tm::{PusTm, PusTmSecondaryHeader}; use spacepackets::time::cds::TimeProvider; use spacepackets::time::TimeWriter; -use spacepackets::tm::{PusTm, PusTmSecondaryHeader}; use spacepackets::SpHeader; #[cfg(feature = "std")] @@ -10,8 +10,8 @@ pub use std_mod::*; pub mod std_mod { use crate::pool::{ShareablePoolProvider, SharedPool, StoreAddr}; use crate::pus::EcssTmtcError; + use spacepackets::ecss::tm::{PusTm, PusTmCreator}; use spacepackets::ecss::SerializablePusPacket; - use spacepackets::tm::PusTm; use std::sync::{Arc, RwLock}; #[derive(Clone)] @@ -30,7 +30,7 @@ pub mod std_mod { self.pool.clone() } - pub fn add_pus_tm(&self, pus_tm: &PusTm) -> Result { + pub fn add_pus_tm(&self, pus_tm: &PusTmCreator) -> Result { let mut pg = self.pool.write().map_err(|_| EcssTmtcError::StoreLock)?; let (addr, buf) = pg.free_element(pus_tm.len_packed())?; pus_tm diff --git a/satrs-core/tests/pus_events.rs b/satrs-core/tests/pus_events.rs index 8030bb9..ff1f499 100644 --- a/satrs-core/tests/pus_events.rs +++ b/satrs-core/tests/pus_events.rs @@ -8,8 +8,8 @@ use satrs_core::pus::event_man::{ DefaultPusMgmtBackendProvider, EventReporter, PusEventDispatcher, }; use satrs_core::pus::MpscTmAsVecSender; +use spacepackets::ecss::tm::PusTm; use spacepackets::ecss::{PusError, PusPacket}; -use spacepackets::tm::PusTm; use std::sync::mpsc::{channel, SendError, TryRecvError}; use std::thread; diff --git a/satrs-core/tests/pus_verification.rs b/satrs-core/tests/pus_verification.rs index a533dbc..5317e4d 100644 --- a/satrs-core/tests/pus_verification.rs +++ b/satrs-core/tests/pus_verification.rs @@ -9,9 +9,9 @@ pub mod crossbeam_test { }; use satrs_core::pus::MpscTmInStoreSender; use satrs_core::tmtc::tm_helper::SharedTmStore; + use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader}; + use spacepackets::ecss::tm::PusTm; use spacepackets::ecss::{EcssEnumU16, EcssEnumU8, PusPacket, SerializablePusPacket}; - use spacepackets::tc::{PusTc, PusTcSecondaryHeader}; - use spacepackets::tm::PusTm; use spacepackets::SpHeader; use std::sync::{mpsc, Arc, RwLock}; use std::thread; diff --git a/satrs-example/src/bin/simpleclient.rs b/satrs-example/src/bin/simpleclient.rs index d28eeb8..9c540ee 100644 --- a/satrs-example/src/bin/simpleclient.rs +++ b/satrs-example/src/bin/simpleclient.rs @@ -1,8 +1,8 @@ use satrs_core::pus::verification::RequestId; use satrs_core::{ + spacepackets::ecss::tc::PusTc, + spacepackets::ecss::tm::PusTm, spacepackets::ecss::{PusPacket, SerializablePusPacket}, - spacepackets::tc::PusTc, - spacepackets::tm::PusTm, spacepackets::SpHeader, }; use satrs_example::{OBSW_SERVER_ADDR, SERVER_PORT}; diff --git a/satrs-example/src/main.rs b/satrs-example/src/main.rs index e6a4241..dfc726a 100644 --- a/satrs-example/src/main.rs +++ b/satrs-example/src/main.rs @@ -37,11 +37,11 @@ use satrs_core::pus::verification::{ }; use satrs_core::pus::{MpscTcInStoreReceiver, MpscTmInStoreSender}; use satrs_core::seq_count::{CcsdsSimpleSeqCountProvider, SequenceCountProviderCore}; -use satrs_core::spacepackets::tm::PusTmZeroCopyWriter; +use satrs_core::spacepackets::ecss::tm::PusTmZeroCopyWriter; use satrs_core::spacepackets::{ + ecss::tm::{PusTm, PusTmSecondaryHeader}, time::cds::TimeProvider, time::TimeWriter, - tm::{PusTm, PusTmSecondaryHeader}, SequenceFlags, SpHeader, }; use satrs_core::tmtc::tm_helper::SharedTmStore; diff --git a/satrs-example/src/pus/action.rs b/satrs-example/src/pus/action.rs index 4dd3e55..0d25934 100644 --- a/satrs-example/src/pus/action.rs +++ b/satrs-example/src/pus/action.rs @@ -8,8 +8,8 @@ use satrs_core::pus::{ EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, PusServiceHandler, }; +use satrs_core::spacepackets::ecss::tc::PusTc; use satrs_core::spacepackets::ecss::PusPacket; -use satrs_core::spacepackets::tc::PusTc; use satrs_core::tmtc::TargetId; use satrs_example::tmtc_err; use std::collections::HashMap; diff --git a/satrs-example/src/pus/hk.rs b/satrs-example/src/pus/hk.rs index b7e70c2..f455633 100644 --- a/satrs-example/src/pus/hk.rs +++ b/satrs-example/src/pus/hk.rs @@ -9,8 +9,8 @@ use satrs_core::pus::{ EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, PusServiceHandler, }; +use satrs_core::spacepackets::ecss::tc::PusTc; use satrs_core::spacepackets::ecss::{hk, PusPacket}; -use satrs_core::spacepackets::tc::PusTc; use satrs_core::tmtc::{AddressableId, TargetId}; use satrs_example::{hk_err, tmtc_err}; use std::collections::HashMap; diff --git a/satrs-example/src/pus/mod.rs b/satrs-example/src/pus/mod.rs index d8b1c5b..746ba10 100644 --- a/satrs-example/src/pus/mod.rs +++ b/satrs-example/src/pus/mod.rs @@ -3,8 +3,8 @@ use log::warn; use satrs_core::pool::StoreAddr; use satrs_core::pus::verification::{FailParams, StdVerifReporterWithSender}; use satrs_core::pus::{PusPacketHandlerResult, TcAddrWithToken}; +use satrs_core::spacepackets::ecss::tc::PusTc; use satrs_core::spacepackets::ecss::PusServiceId; -use satrs_core::spacepackets::tc::PusTc; use satrs_core::spacepackets::time::cds::TimeProvider; use satrs_core::spacepackets::time::TimeWriter; use satrs_example::{tmtc_err, CustomPusServiceId}; diff --git a/satrs-example/src/pus/test.rs b/satrs-example/src/pus/test.rs index 5edae74..2db0930 100644 --- a/satrs-example/src/pus/test.rs +++ b/satrs-example/src/pus/test.rs @@ -4,8 +4,8 @@ use satrs_core::params::Params; use satrs_core::pus::test::PusService17TestHandler; use satrs_core::pus::verification::FailParams; use satrs_core::pus::{PusPacketHandlerResult, PusServiceHandler}; +use satrs_core::spacepackets::ecss::tc::PusTc; use satrs_core::spacepackets::ecss::PusPacket; -use satrs_core::spacepackets::tc::PusTc; use satrs_core::spacepackets::time::cds::TimeProvider; use satrs_core::spacepackets::time::TimeWriter; use satrs_example::{tmtc_err, TEST_EVENT}; diff --git a/satrs-example/src/tmtc.rs b/satrs-example/src/tmtc.rs index 2a18dd3..bb0d07b 100644 --- a/satrs-example/src/tmtc.rs +++ b/satrs-example/src/tmtc.rs @@ -11,8 +11,8 @@ use crate::pus::{PusReceiver, PusTcMpscRouter}; use satrs_core::pool::{SharedPool, StoreAddr, StoreError}; use satrs_core::pus::verification::StdVerifReporterWithSender; use satrs_core::pus::{ReceivesEcssPusTc, TcAddrWithToken}; +use satrs_core::spacepackets::ecss::tc::{PusTc, PusTcCreator, PusTcReader}; use satrs_core::spacepackets::ecss::{PusPacket, SerializablePusPacket}; -use satrs_core::spacepackets::tc::PusTc; use satrs_core::spacepackets::SpHeader; use satrs_core::tmtc::tm_helper::SharedTmStore; use satrs_core::tmtc::{CcsdsDistributor, CcsdsError, ReceivesCcsdsTc}; @@ -53,7 +53,7 @@ pub struct TcStore { } impl TcStore { - pub fn add_pus_tc(&mut self, pus_tc: &PusTc) -> Result { + pub fn add_pus_tc(&mut self, pus_tc: &PusTcCreator) -> Result { let mut pg = self.pool.write().expect("error locking TC store"); let (addr, buf) = pg.free_element(pus_tc.len_packed())?; pus_tc @@ -83,7 +83,7 @@ pub struct PusTcSource { impl ReceivesEcssPusTc for PusTcSource { type Error = MpscStoreAndSendError; - fn pass_pus_tc(&mut self, _: &SpHeader, pus_tc: &PusTc) -> Result<(), Self::Error> { + fn pass_pus_tc(&mut self, _: &SpHeader, pus_tc: &PusTcReader) -> Result<(), Self::Error> { let addr = self.tc_store.add_pus_tc(pus_tc)?; self.tc_source.send(addr)?; Ok(())