issue for another day..

This commit is contained in:
Robin Müller 2023-07-10 01:27:37 +02:00
parent 8b420a5218
commit dbcb1fb350
Signed by: muellerr
GPG Key ID: A649FB78196E3849
21 changed files with 68 additions and 68 deletions

View File

@ -64,7 +64,7 @@ optional = true
# version = "0.6" # version = "0.6"
# path = "../spacepackets" # path = "../spacepackets"
git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git" git = "https://egit.irs.uni-stuttgart.de/rust/spacepackets.git"
rev = "784564a20ed" rev = "b553cdc2eccd2"
default-features = false default-features = false
[dev-dependencies] [dev-dependencies]

View File

@ -22,7 +22,7 @@ use std::vec::Vec;
/// use satrs_core::hal::host::udp_server::UdpTcServer; /// use satrs_core::hal::host::udp_server::UdpTcServer;
/// use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; /// use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore};
/// use spacepackets::SpHeader; /// use spacepackets::SpHeader;
/// use spacepackets::tc::PusTc; /// use spacepackets::ecss::tc::PusTc;
/// ///
/// #[derive (Default)] /// #[derive (Default)]
/// struct PingReceiver {} /// struct PingReceiver {}
@ -142,8 +142,8 @@ impl<E: 'static> UdpTcServer<E> {
mod tests { mod tests {
use crate::hal::host::udp_server::{ReceiveResult, UdpTcServer}; use crate::hal::host::udp_server::{ReceiveResult, UdpTcServer};
use crate::tmtc::ReceivesTcCore; use crate::tmtc::ReceivesTcCore;
use spacepackets::ecss::tc::PusTc;
use spacepackets::ecss::SerializablePusPacket; use spacepackets::ecss::SerializablePusPacket;
use spacepackets::tc::PusTc;
use spacepackets::SpHeader; use spacepackets::SpHeader;
use std::boxed::Box; use std::boxed::Box;
use std::collections::VecDeque; use std::collections::VecDeque;

View File

@ -1,7 +1,7 @@
use crate::pus::{source_buffer_large_enough, EcssTmtcError}; 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::ecss::{EcssEnumeration, PusError};
use spacepackets::tm::PusTm;
use spacepackets::tm::PusTmSecondaryHeader;
use spacepackets::{SpHeader, MAX_APID}; use spacepackets::{SpHeader, MAX_APID};
use crate::pus::EcssTmSenderCore; use crate::pus::EcssTmSenderCore;
@ -121,7 +121,7 @@ impl EventReporterBase {
time_stamp: &'a [u8], time_stamp: &'a [u8],
event_id: impl EcssEnumeration, event_id: impl EcssEnumeration,
aux_data: Option<&[u8]>, aux_data: Option<&[u8]>,
) -> Result<PusTm, EcssTmtcError> { ) -> Result<PusTmCreator, EcssTmtcError> {
let mut src_data_len = event_id.size(); let mut src_data_len = event_id.size();
if let Some(aux_data) = aux_data { if let Some(aux_data) = aux_data {
src_data_len += aux_data.len(); 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); buf[current_idx..current_idx + aux_data.len()].copy_from_slice(aux_data);
current_idx += aux_data.len(); current_idx += aux_data.len();
} }
Ok(PusTm::new( Ok(PusTmCreator::new(
&mut sp_header, &mut sp_header,
sec_header, sec_header,
Some(&buf[0..current_idx]), Some(&buf[0..current_idx]),

View File

@ -9,8 +9,8 @@ use crate::pus::{
PusPacketHandlingError, PusServiceBase, PusServiceHandler, PusPacketHandlingError, PusServiceBase, PusServiceHandler,
}; };
use spacepackets::ecss::event::Subservice; use spacepackets::ecss::event::Subservice;
use spacepackets::ecss::tc::PusTc;
use spacepackets::ecss::PusPacket; use spacepackets::ecss::PusPacket;
use spacepackets::tc::PusTc;
use std::boxed::Box; use std::boxed::Box;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;

View File

@ -8,9 +8,9 @@ use core::fmt::{Display, Formatter};
use downcast_rs::{impl_downcast, Downcast}; use downcast_rs::{impl_downcast, Downcast};
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
use dyn_clone::DynClone; use dyn_clone::DynClone;
use spacepackets::ecss::tc::{PusTcCreator, PusTcReader};
use spacepackets::ecss::tm::PusTmCreator;
use spacepackets::ecss::PusError; use spacepackets::ecss::PusError;
use spacepackets::tc::PusTc;
use spacepackets::tm::PusTm;
use spacepackets::{ByteConversionError, SizeMissmatch, SpHeader}; use spacepackets::{ByteConversionError, SizeMissmatch, SpHeader};
use std::error::Error; use std::error::Error;
@ -36,7 +36,7 @@ pub use std_mod::*;
#[derive(Debug, PartialEq, Eq, Clone)] #[derive(Debug, PartialEq, Eq, Clone)]
pub enum PusTmWrapper<'tm> { pub enum PusTmWrapper<'tm> {
InStore(StoreAddr), InStore(StoreAddr),
Direct(PusTm<'tm>), Direct(PusTmCreator<'tm>),
} }
impl From<StoreAddr> for PusTmWrapper<'_> { impl From<StoreAddr> for PusTmWrapper<'_> {
@ -45,8 +45,8 @@ impl From<StoreAddr> for PusTmWrapper<'_> {
} }
} }
impl<'tm> From<PusTm<'tm>> for PusTmWrapper<'tm> { impl<'tm> From<PusTmCreator<'tm>> for PusTmWrapper<'tm> {
fn from(value: PusTm<'tm>) -> Self { fn from(value: PusTmCreator<'tm>) -> Self {
Self::Direct(value) 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 /// 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. /// telecommand can optionally have a token which contains its verification state.
pub trait EcssTcSenderCore: EcssChannel { pub trait EcssTcSenderCore: EcssChannel {
fn send_tc(&self, tc: PusTc, token: Option<TcStateToken>) -> Result<(), EcssTmtcError>; fn send_tc(&self, tc: PusTcCreator, token: Option<TcStateToken>) -> Result<(), EcssTmtcError>;
} }
pub struct ReceivedTcWrapper { pub struct ReceivedTcWrapper {
@ -235,7 +235,7 @@ pub trait EcssTcReceiverCore: EcssChannel {
/// packets into it. /// packets into it.
pub trait ReceivesEcssPusTc { pub trait ReceivesEcssPusTc {
type Error; 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")] #[cfg(feature = "alloc")]
@ -317,11 +317,11 @@ pub mod std_mod {
use crate::ChannelId; use crate::ChannelId;
use alloc::boxed::Box; use alloc::boxed::Box;
use alloc::vec::Vec; use alloc::vec::Vec;
use spacepackets::ecss::tm::{PusTm, PusTmCreator};
use spacepackets::ecss::PusError; use spacepackets::ecss::PusError;
use spacepackets::time::cds::TimeProvider; use spacepackets::time::cds::TimeProvider;
use spacepackets::time::StdTimestampError; use spacepackets::time::StdTimestampError;
use spacepackets::time::TimeWriter; use spacepackets::time::TimeWriter;
use spacepackets::tm::PusTm;
use std::cell::RefCell; use std::cell::RefCell;
use std::string::String; use std::string::String;
use std::sync::mpsc; use std::sync::mpsc;
@ -353,7 +353,7 @@ pub mod std_mod {
} }
} }
impl MpscTmInStoreSender { 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)?; let addr = self.shared_tm_store.add_pus_tm(&tm)?;
self.sender self.sender
.send(addr) .send(addr)
@ -641,7 +641,7 @@ pub(crate) fn source_buffer_large_enough(cap: usize, len: usize) -> Result<(), E
#[cfg(test)] #[cfg(test)]
pub(crate) mod tests { pub(crate) mod tests {
use spacepackets::tm::{GenericPusTmSecondaryHeader, PusTm}; use spacepackets::ecss::tm::{GenericPusTmSecondaryHeader, PusTm};
use spacepackets::CcsdsPacket; use spacepackets::CcsdsPacket;
#[derive(Debug, Eq, PartialEq, Clone)] #[derive(Debug, Eq, PartialEq, Clone)]

View File

@ -8,8 +8,8 @@ use core::time::Duration;
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use spacepackets::ecss::scheduling::TimeWindowType; use spacepackets::ecss::scheduling::TimeWindowType;
use spacepackets::ecss::tc::{GenericPusTcSecondaryHeader, PusTc};
use spacepackets::ecss::PusError; use spacepackets::ecss::PusError;
use spacepackets::tc::{GenericPusTcSecondaryHeader, PusTc};
use spacepackets::time::{CcsdsTimeProvider, TimestampError, UnixTimestamp}; use spacepackets::time::{CcsdsTimeProvider, TimestampError, UnixTimestamp};
use spacepackets::CcsdsPacket; use spacepackets::CcsdsPacket;
#[cfg(feature = "std")] #[cfg(feature = "std")]
@ -239,8 +239,8 @@ pub mod alloc_mod {
use alloc::vec::Vec; use alloc::vec::Vec;
use core::time::Duration; use core::time::Duration;
use spacepackets::ecss::scheduling::TimeWindowType; use spacepackets::ecss::scheduling::TimeWindowType;
use spacepackets::ecss::tc::PusTc;
use spacepackets::ecss::PusPacket; use spacepackets::ecss::PusPacket;
use spacepackets::tc::PusTc;
use spacepackets::time::cds::DaysLen24Bits; use spacepackets::time::cds::DaysLen24Bits;
use spacepackets::time::{cds, CcsdsTimeProvider, TimeReader, UnixTimestamp}; use spacepackets::time::{cds, CcsdsTimeProvider, TimeReader, UnixTimestamp};
@ -641,8 +641,8 @@ mod tests {
use super::*; use super::*;
use crate::pool::{LocalPool, PoolCfg, PoolProvider, StoreAddr, StoreError}; use crate::pool::{LocalPool, PoolCfg, PoolProvider, StoreAddr, StoreError};
use alloc::collections::btree_map::Range; use alloc::collections::btree_map::Range;
use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader};
use spacepackets::ecss::SerializablePusPacket; use spacepackets::ecss::SerializablePusPacket;
use spacepackets::tc::{PusTc, PusTcSecondaryHeader};
use spacepackets::time::{cds, TimeWriter, UnixTimestamp}; use spacepackets::time::{cds, TimeWriter, UnixTimestamp};
use spacepackets::SpHeader; use spacepackets::SpHeader;
use std::time::Duration; use std::time::Duration;

View File

@ -5,8 +5,8 @@ use crate::pus::{
EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase,
PusServiceHandler, PusServiceHandler,
}; };
use spacepackets::ecss::tc::PusTc;
use spacepackets::ecss::{scheduling, PusPacket}; use spacepackets::ecss::{scheduling, PusPacket};
use spacepackets::tc::PusTc;
use spacepackets::time::cds::TimeProvider; use spacepackets::time::cds::TimeProvider;
use std::boxed::Box; use std::boxed::Box;

View File

@ -4,9 +4,9 @@ use crate::pus::{
EcssTcReceiver, EcssTmSender, PartialPusHandlingError, PusPacketHandlerResult, EcssTcReceiver, EcssTmSender, PartialPusHandlingError, PusPacketHandlerResult,
PusPacketHandlingError, PusServiceBase, PusServiceHandler, PusTmWrapper, PusPacketHandlingError, PusServiceBase, PusServiceHandler, PusTmWrapper,
}; };
use spacepackets::ecss::tc::PusTc;
use spacepackets::ecss::tm::{PusTm, PusTmCreator, PusTmSecondaryHeader};
use spacepackets::ecss::PusPacket; use spacepackets::ecss::PusPacket;
use spacepackets::tc::PusTc;
use spacepackets::tm::{PusTm, PusTmSecondaryHeader};
use spacepackets::SpHeader; use spacepackets::SpHeader;
use std::boxed::Box; use std::boxed::Box;
@ -72,7 +72,7 @@ impl PusServiceHandler for PusService17TestHandler {
// Sequence count will be handled centrally in TM funnel. // Sequence count will be handled centrally in TM funnel.
let mut reply_header = SpHeader::tm_unseg(self.psb.tm_apid, 0, 0).unwrap(); 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 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 let result = self
.psb .psb
.tm_sender .tm_sender
@ -116,9 +116,9 @@ mod tests {
}; };
use crate::pus::{MpscTcInStoreReceiver, MpscTmInStoreSender, PusServiceHandler}; use crate::pus::{MpscTcInStoreReceiver, MpscTmInStoreSender, PusServiceHandler};
use crate::tmtc::tm_helper::SharedTmStore; use crate::tmtc::tm_helper::SharedTmStore;
use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader};
use spacepackets::ecss::tm::PusTm;
use spacepackets::ecss::{PusPacket, SerializablePusPacket}; use spacepackets::ecss::{PusPacket, SerializablePusPacket};
use spacepackets::tc::{PusTc, PusTcSecondaryHeader};
use spacepackets::tm::PusTm;
use spacepackets::{SequenceFlags, SpHeader}; use spacepackets::{SequenceFlags, SpHeader};
use std::boxed::Box; use std::boxed::Box;
use std::sync::{mpsc, RwLock}; use std::sync::{mpsc, RwLock};

View File

@ -22,8 +22,8 @@
//! use satrs_core::tmtc::tm_helper::SharedTmStore; //! use satrs_core::tmtc::tm_helper::SharedTmStore;
//! use spacepackets::ecss::PusPacket; //! use spacepackets::ecss::PusPacket;
//! use spacepackets::SpHeader; //! use spacepackets::SpHeader;
//! use spacepackets::tc::{PusTc, PusTcSecondaryHeader}; //! use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader};
//! use spacepackets::tm::PusTm; //! use spacepackets::ecss::tm::PusTm;
//! //!
//! const EMPTY_STAMP: [u8; 7] = [0; 7]; //! const EMPTY_STAMP: [u8; 7] = [0; 7];
//! const TEST_APID: u16 = 0x02; //! const TEST_APID: u16 = 0x02;
@ -85,9 +85,9 @@ use core::mem::size_of;
use delegate::delegate; use delegate::delegate;
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use spacepackets::ecss::tc::PusTc;
use spacepackets::ecss::tm::{PusTm, PusTmCreator, PusTmSecondaryHeader};
use spacepackets::ecss::{EcssEnumeration, PusError, SerializablePusPacket}; use spacepackets::ecss::{EcssEnumeration, PusError, SerializablePusPacket};
use spacepackets::tc::PusTc;
use spacepackets::tm::{PusTm, PusTmSecondaryHeader};
use spacepackets::{CcsdsPacket, PacketId, PacketSequenceCtrl}; use spacepackets::{CcsdsPacket, PacketId, PacketSequenceCtrl};
use spacepackets::{SpHeader, MAX_APID}; use spacepackets::{SpHeader, MAX_APID};
@ -332,19 +332,19 @@ pub enum VerifFailure {}
/// This struct generally mutably borrows the source data buffer. /// This struct generally mutably borrows the source data buffer.
pub struct VerificationSendable<'src_data, State, SuccessOrFailure> { pub struct VerificationSendable<'src_data, State, SuccessOrFailure> {
token: Option<VerificationToken<State>>, token: Option<VerificationToken<State>>,
pus_tm: Option<PusTm<'src_data>>, pus_tm: Option<PusTmCreator<'src_data>>,
phantom: PhantomData<SuccessOrFailure>, phantom: PhantomData<SuccessOrFailure>,
} }
impl<'src_data, State, SuccessOrFailure> VerificationSendable<'src_data, State, SuccessOrFailure> { impl<'src_data, State, SuccessOrFailure> VerificationSendable<'src_data, State, SuccessOrFailure> {
pub(crate) fn new(pus_tm: PusTm<'src_data>, token: VerificationToken<State>) -> Self { pub(crate) fn new(pus_tm: PusTmCreator<'src_data>, token: VerificationToken<State>) -> Self {
Self { Self {
token: Some(token), token: Some(token),
pus_tm: Some(pus_tm), pus_tm: Some(pus_tm),
phantom: PhantomData, 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 { Self {
token: None, token: None,
pus_tm: Some(pus_tm), 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() 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() 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() 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> { impl<'src_data, State> VerificationSendable<'src_data, State, VerifFailure> {
pub fn send_failure(self) -> (PusTm<'src_data>, VerificationToken<State>) { pub fn send_failure(self) -> (PusTmCreator<'src_data>, VerificationToken<State>) {
(self.pus_tm.unwrap(), self.token.unwrap()) (self.pus_tm.unwrap(), self.token.unwrap())
} }
} }
@ -787,7 +787,7 @@ impl VerificationReporterCore {
req_id: &RequestId, req_id: &RequestId,
time_stamp: Option<&'src_data [u8]>, time_stamp: Option<&'src_data [u8]>,
step: Option<&(impl EcssEnumeration + ?Sized)>, step: Option<&(impl EcssEnumeration + ?Sized)>,
) -> Result<PusTm<'src_data>, EcssTmtcError> { ) -> Result<PusTmCreator<'src_data>, EcssTmtcError> {
let mut source_data_len = size_of::<u32>(); let mut source_data_len = size_of::<u32>();
if let Some(step) = step { if let Some(step) = step {
source_data_len += step.size(); source_data_len += step.size();
@ -823,7 +823,7 @@ impl VerificationReporterCore {
req_id: &RequestId, req_id: &RequestId,
step: Option<&(impl EcssEnumeration + ?Sized)>, step: Option<&(impl EcssEnumeration + ?Sized)>,
params: &FailParams<'src_data, '_>, params: &FailParams<'src_data, '_>,
) -> Result<PusTm<'src_data>, EcssTmtcError> { ) -> Result<PusTmCreator<'src_data>, EcssTmtcError> {
let mut idx = 0; let mut idx = 0;
let mut source_data_len = RequestId::SIZE_AS_BYTES + params.failure_code.size(); let mut source_data_len = RequestId::SIZE_AS_BYTES + params.failure_code.size();
if let Some(step) = step { if let Some(step) = step {
@ -868,10 +868,10 @@ impl VerificationReporterCore {
sp_header: &mut SpHeader, sp_header: &mut SpHeader,
time_stamp: Option<&'src_data [u8]>, time_stamp: Option<&'src_data [u8]>,
source_data_len: usize, source_data_len: usize,
) -> PusTm<'src_data> { ) -> PusTmCreator<'src_data> {
let tm_sec_header = let tm_sec_header =
PusTmSecondaryHeader::new(1, subservice, msg_counter, self.dest_id, time_stamp); PusTmSecondaryHeader::new(1, subservice, msg_counter, self.dest_id, time_stamp);
PusTm::new( PusTmCreator::new(
sp_header, sp_header,
tm_sec_header, tm_sec_header,
Some(&src_data_buf[0..source_data_len]), Some(&src_data_buf[0..source_data_len]),
@ -1506,9 +1506,9 @@ mod tests {
use crate::ChannelId; use crate::ChannelId;
use alloc::boxed::Box; use alloc::boxed::Box;
use alloc::format; use alloc::format;
use spacepackets::ecss::tc::{PusTc, PusTcSecondaryHeader};
use spacepackets::ecss::tm::PusTm;
use spacepackets::ecss::{EcssEnumU16, EcssEnumU32, EcssEnumU8, PusError, PusPacket}; use spacepackets::ecss::{EcssEnumU16, EcssEnumU32, EcssEnumU8, PusError, PusPacket};
use spacepackets::tc::{PusTc, PusTcSecondaryHeader};
use spacepackets::tm::PusTm;
use spacepackets::util::UnsignedEnum; use spacepackets::util::UnsignedEnum;
use spacepackets::{ByteConversionError, CcsdsPacket, SpHeader}; use spacepackets::{ByteConversionError, CcsdsPacket, SpHeader};
use std::cell::RefCell; use std::cell::RefCell;

View File

@ -22,7 +22,7 @@
//! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; //! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore};
//! use spacepackets::{CcsdsPacket, SpHeader}; //! use spacepackets::{CcsdsPacket, SpHeader};
//! use spacepackets::ecss::SerializablePusPacket; //! use spacepackets::ecss::SerializablePusPacket;
//! use spacepackets::tc::PusTc; //! use spacepackets::ecss::tc::PusTc;
//! //!
//! #[derive (Default)] //! #[derive (Default)]
//! struct ConcreteApidHandler { //! struct ConcreteApidHandler {
@ -225,8 +225,8 @@ impl<E: 'static> CcsdsDistributor<E> {
pub(crate) mod tests { pub(crate) mod tests {
use super::*; use super::*;
use crate::tmtc::ccsds_distrib::{CcsdsDistributor, CcsdsPacketHandler}; use crate::tmtc::ccsds_distrib::{CcsdsDistributor, CcsdsPacketHandler};
use spacepackets::ecss::tc::PusTc;
use spacepackets::ecss::SerializablePusPacket; use spacepackets::ecss::SerializablePusPacket;
use spacepackets::tc::PusTc;
use spacepackets::CcsdsPacket; use spacepackets::CcsdsPacket;
use std::collections::VecDeque; use std::collections::VecDeque;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};

View File

@ -21,7 +21,7 @@
//! use satrs_core::tmtc::pus_distrib::{PusDistributor, PusServiceProvider}; //! use satrs_core::tmtc::pus_distrib::{PusDistributor, PusServiceProvider};
//! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore}; //! use satrs_core::tmtc::{ReceivesTc, ReceivesTcCore};
//! use spacepackets::SpHeader; //! use spacepackets::SpHeader;
//! use spacepackets::tc::PusTc; //! use spacepackets::ecss::tc::PusTc;
//! struct ConcretePusHandler { //! struct ConcretePusHandler {
//! handler_call_count: u32 //! handler_call_count: u32
//! } //! }
@ -66,8 +66,8 @@ use crate::tmtc::{ReceivesCcsdsTc, ReceivesTcCore};
use alloc::boxed::Box; use alloc::boxed::Box;
use core::fmt::{Display, Formatter}; use core::fmt::{Display, Formatter};
use downcast_rs::Downcast; use downcast_rs::Downcast;
use spacepackets::ecss::tc::{PusTc, PusTcReader};
use spacepackets::ecss::{PusError, PusPacket}; use spacepackets::ecss::{PusError, PusPacket};
use spacepackets::tc::PusTc;
use spacepackets::SpHeader; use spacepackets::SpHeader;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use std::error::Error; use std::error::Error;
@ -78,7 +78,7 @@ pub trait PusServiceProvider: Downcast {
&mut self, &mut self,
service: u8, service: u8,
header: &SpHeader, header: &SpHeader,
pus_tc: &PusTc, pus_tc: &PusTcReader,
) -> Result<(), Self::Error>; ) -> Result<(), Self::Error>;
} }
downcast_rs::impl_downcast!(PusServiceProvider assoc Error); downcast_rs::impl_downcast!(PusServiceProvider assoc Error);
@ -141,14 +141,14 @@ impl<E: 'static> ReceivesTcCore for PusDistributor<E> {
impl<E: 'static> ReceivesCcsdsTc for PusDistributor<E> { impl<E: 'static> ReceivesCcsdsTc for PusDistributor<E> {
type Error = PusDistribError<E>; type Error = PusDistribError<E>;
fn pass_ccsds(&mut self, header: &SpHeader, tm_raw: &[u8]) -> Result<(), Self::Error> { 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) self.pass_pus_tc(header, &tc)
} }
} }
impl<E: 'static> ReceivesEcssPusTc for PusDistributor<E> { impl<E: 'static> ReceivesEcssPusTc for PusDistributor<E> {
type Error = PusDistribError<E>; type Error = PusDistribError<E>;
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 self.service_provider
.handle_pus_tc_packet(pus_tc.service(), header, pus_tc) .handle_pus_tc_packet(pus_tc.service(), header, pus_tc)
.map_err(|e| PusDistribError::CustomError(e)) .map_err(|e| PusDistribError::CustomError(e))
@ -175,8 +175,8 @@ mod tests {
}; };
use crate::tmtc::ccsds_distrib::{CcsdsDistributor, CcsdsPacketHandler}; use crate::tmtc::ccsds_distrib::{CcsdsDistributor, CcsdsPacketHandler};
use alloc::vec::Vec; use alloc::vec::Vec;
use spacepackets::ecss::tc::PusTc;
use spacepackets::ecss::PusError; use spacepackets::ecss::PusError;
use spacepackets::tc::PusTc;
use spacepackets::CcsdsPacket; use spacepackets::CcsdsPacket;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use std::collections::VecDeque; use std::collections::VecDeque;

View File

@ -1,6 +1,6 @@
use spacepackets::ecss::tm::{PusTm, PusTmSecondaryHeader};
use spacepackets::time::cds::TimeProvider; use spacepackets::time::cds::TimeProvider;
use spacepackets::time::TimeWriter; use spacepackets::time::TimeWriter;
use spacepackets::tm::{PusTm, PusTmSecondaryHeader};
use spacepackets::SpHeader; use spacepackets::SpHeader;
#[cfg(feature = "std")] #[cfg(feature = "std")]
@ -10,8 +10,8 @@ pub use std_mod::*;
pub mod std_mod { pub mod std_mod {
use crate::pool::{ShareablePoolProvider, SharedPool, StoreAddr}; use crate::pool::{ShareablePoolProvider, SharedPool, StoreAddr};
use crate::pus::EcssTmtcError; use crate::pus::EcssTmtcError;
use spacepackets::ecss::tm::{PusTm, PusTmCreator};
use spacepackets::ecss::SerializablePusPacket; use spacepackets::ecss::SerializablePusPacket;
use spacepackets::tm::PusTm;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
#[derive(Clone)] #[derive(Clone)]
@ -30,7 +30,7 @@ pub mod std_mod {
self.pool.clone() self.pool.clone()
} }
pub fn add_pus_tm(&self, pus_tm: &PusTm) -> Result<StoreAddr, EcssTmtcError> { pub fn add_pus_tm(&self, pus_tm: &PusTmCreator) -> Result<StoreAddr, EcssTmtcError> {
let mut pg = self.pool.write().map_err(|_| EcssTmtcError::StoreLock)?; let mut pg = self.pool.write().map_err(|_| EcssTmtcError::StoreLock)?;
let (addr, buf) = pg.free_element(pus_tm.len_packed())?; let (addr, buf) = pg.free_element(pus_tm.len_packed())?;
pus_tm pus_tm

View File

@ -8,8 +8,8 @@ use satrs_core::pus::event_man::{
DefaultPusMgmtBackendProvider, EventReporter, PusEventDispatcher, DefaultPusMgmtBackendProvider, EventReporter, PusEventDispatcher,
}; };
use satrs_core::pus::MpscTmAsVecSender; use satrs_core::pus::MpscTmAsVecSender;
use spacepackets::ecss::tm::PusTm;
use spacepackets::ecss::{PusError, PusPacket}; use spacepackets::ecss::{PusError, PusPacket};
use spacepackets::tm::PusTm;
use std::sync::mpsc::{channel, SendError, TryRecvError}; use std::sync::mpsc::{channel, SendError, TryRecvError};
use std::thread; use std::thread;

View File

@ -9,9 +9,9 @@ pub mod crossbeam_test {
}; };
use satrs_core::pus::MpscTmInStoreSender; use satrs_core::pus::MpscTmInStoreSender;
use satrs_core::tmtc::tm_helper::SharedTmStore; 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::ecss::{EcssEnumU16, EcssEnumU8, PusPacket, SerializablePusPacket};
use spacepackets::tc::{PusTc, PusTcSecondaryHeader};
use spacepackets::tm::PusTm;
use spacepackets::SpHeader; use spacepackets::SpHeader;
use std::sync::{mpsc, Arc, RwLock}; use std::sync::{mpsc, Arc, RwLock};
use std::thread; use std::thread;

View File

@ -1,8 +1,8 @@
use satrs_core::pus::verification::RequestId; use satrs_core::pus::verification::RequestId;
use satrs_core::{ use satrs_core::{
spacepackets::ecss::tc::PusTc,
spacepackets::ecss::tm::PusTm,
spacepackets::ecss::{PusPacket, SerializablePusPacket}, spacepackets::ecss::{PusPacket, SerializablePusPacket},
spacepackets::tc::PusTc,
spacepackets::tm::PusTm,
spacepackets::SpHeader, spacepackets::SpHeader,
}; };
use satrs_example::{OBSW_SERVER_ADDR, SERVER_PORT}; use satrs_example::{OBSW_SERVER_ADDR, SERVER_PORT};

View File

@ -37,11 +37,11 @@ use satrs_core::pus::verification::{
}; };
use satrs_core::pus::{MpscTcInStoreReceiver, MpscTmInStoreSender}; use satrs_core::pus::{MpscTcInStoreReceiver, MpscTmInStoreSender};
use satrs_core::seq_count::{CcsdsSimpleSeqCountProvider, SequenceCountProviderCore}; use satrs_core::seq_count::{CcsdsSimpleSeqCountProvider, SequenceCountProviderCore};
use satrs_core::spacepackets::tm::PusTmZeroCopyWriter; use satrs_core::spacepackets::ecss::tm::PusTmZeroCopyWriter;
use satrs_core::spacepackets::{ use satrs_core::spacepackets::{
ecss::tm::{PusTm, PusTmSecondaryHeader},
time::cds::TimeProvider, time::cds::TimeProvider,
time::TimeWriter, time::TimeWriter,
tm::{PusTm, PusTmSecondaryHeader},
SequenceFlags, SpHeader, SequenceFlags, SpHeader,
}; };
use satrs_core::tmtc::tm_helper::SharedTmStore; use satrs_core::tmtc::tm_helper::SharedTmStore;

View File

@ -8,8 +8,8 @@ use satrs_core::pus::{
EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase,
PusServiceHandler, PusServiceHandler,
}; };
use satrs_core::spacepackets::ecss::tc::PusTc;
use satrs_core::spacepackets::ecss::PusPacket; use satrs_core::spacepackets::ecss::PusPacket;
use satrs_core::spacepackets::tc::PusTc;
use satrs_core::tmtc::TargetId; use satrs_core::tmtc::TargetId;
use satrs_example::tmtc_err; use satrs_example::tmtc_err;
use std::collections::HashMap; use std::collections::HashMap;

View File

@ -9,8 +9,8 @@ use satrs_core::pus::{
EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, EcssTcReceiver, EcssTmSender, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase,
PusServiceHandler, PusServiceHandler,
}; };
use satrs_core::spacepackets::ecss::tc::PusTc;
use satrs_core::spacepackets::ecss::{hk, PusPacket}; use satrs_core::spacepackets::ecss::{hk, PusPacket};
use satrs_core::spacepackets::tc::PusTc;
use satrs_core::tmtc::{AddressableId, TargetId}; use satrs_core::tmtc::{AddressableId, TargetId};
use satrs_example::{hk_err, tmtc_err}; use satrs_example::{hk_err, tmtc_err};
use std::collections::HashMap; use std::collections::HashMap;

View File

@ -3,8 +3,8 @@ use log::warn;
use satrs_core::pool::StoreAddr; use satrs_core::pool::StoreAddr;
use satrs_core::pus::verification::{FailParams, StdVerifReporterWithSender}; use satrs_core::pus::verification::{FailParams, StdVerifReporterWithSender};
use satrs_core::pus::{PusPacketHandlerResult, TcAddrWithToken}; use satrs_core::pus::{PusPacketHandlerResult, TcAddrWithToken};
use satrs_core::spacepackets::ecss::tc::PusTc;
use satrs_core::spacepackets::ecss::PusServiceId; use satrs_core::spacepackets::ecss::PusServiceId;
use satrs_core::spacepackets::tc::PusTc;
use satrs_core::spacepackets::time::cds::TimeProvider; use satrs_core::spacepackets::time::cds::TimeProvider;
use satrs_core::spacepackets::time::TimeWriter; use satrs_core::spacepackets::time::TimeWriter;
use satrs_example::{tmtc_err, CustomPusServiceId}; use satrs_example::{tmtc_err, CustomPusServiceId};

View File

@ -4,8 +4,8 @@ use satrs_core::params::Params;
use satrs_core::pus::test::PusService17TestHandler; use satrs_core::pus::test::PusService17TestHandler;
use satrs_core::pus::verification::FailParams; use satrs_core::pus::verification::FailParams;
use satrs_core::pus::{PusPacketHandlerResult, PusServiceHandler}; use satrs_core::pus::{PusPacketHandlerResult, PusServiceHandler};
use satrs_core::spacepackets::ecss::tc::PusTc;
use satrs_core::spacepackets::ecss::PusPacket; use satrs_core::spacepackets::ecss::PusPacket;
use satrs_core::spacepackets::tc::PusTc;
use satrs_core::spacepackets::time::cds::TimeProvider; use satrs_core::spacepackets::time::cds::TimeProvider;
use satrs_core::spacepackets::time::TimeWriter; use satrs_core::spacepackets::time::TimeWriter;
use satrs_example::{tmtc_err, TEST_EVENT}; use satrs_example::{tmtc_err, TEST_EVENT};

View File

@ -11,8 +11,8 @@ use crate::pus::{PusReceiver, PusTcMpscRouter};
use satrs_core::pool::{SharedPool, StoreAddr, StoreError}; use satrs_core::pool::{SharedPool, StoreAddr, StoreError};
use satrs_core::pus::verification::StdVerifReporterWithSender; use satrs_core::pus::verification::StdVerifReporterWithSender;
use satrs_core::pus::{ReceivesEcssPusTc, TcAddrWithToken}; 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::ecss::{PusPacket, SerializablePusPacket};
use satrs_core::spacepackets::tc::PusTc;
use satrs_core::spacepackets::SpHeader; use satrs_core::spacepackets::SpHeader;
use satrs_core::tmtc::tm_helper::SharedTmStore; use satrs_core::tmtc::tm_helper::SharedTmStore;
use satrs_core::tmtc::{CcsdsDistributor, CcsdsError, ReceivesCcsdsTc}; use satrs_core::tmtc::{CcsdsDistributor, CcsdsError, ReceivesCcsdsTc};
@ -53,7 +53,7 @@ pub struct TcStore {
} }
impl TcStore { impl TcStore {
pub fn add_pus_tc(&mut self, pus_tc: &PusTc) -> Result<StoreAddr, StoreError> { pub fn add_pus_tc(&mut self, pus_tc: &PusTcCreator) -> Result<StoreAddr, StoreError> {
let mut pg = self.pool.write().expect("error locking TC store"); let mut pg = self.pool.write().expect("error locking TC store");
let (addr, buf) = pg.free_element(pus_tc.len_packed())?; let (addr, buf) = pg.free_element(pus_tc.len_packed())?;
pus_tc pus_tc
@ -83,7 +83,7 @@ pub struct PusTcSource {
impl ReceivesEcssPusTc for PusTcSource { impl ReceivesEcssPusTc for PusTcSource {
type Error = MpscStoreAndSendError; 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)?; let addr = self.tc_store.add_pus_tc(pus_tc)?;
self.tc_source.send(addr)?; self.tc_source.send(addr)?;
Ok(()) Ok(())