added new marker traits for PUS TC and PUS TM
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit

This commit is contained in:
Robin Müller 2023-07-10 23:36:27 +02:00
parent c0e70daf58
commit 6eb3cbbd84
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 13 additions and 0 deletions

View File

@ -57,6 +57,9 @@ pub const PUS_TC_MIN_LEN_WITHOUT_APP_DATA: usize =
CCSDS_HEADER_LEN + PUC_TC_SECONDARY_HEADER_LEN + size_of::<CrcType>();
const PUS_VERSION: PusVersion = PusVersion::PusC;
/// Marker trait for PUS telecommand structures.
pub trait IsPusTelecommand {}
#[derive(Copy, Clone, PartialEq, Debug)]
enum AckOpts {
Acceptance = 0b1000,
@ -736,6 +739,8 @@ impl GenericPusTcSecondaryHeader for PusTcCreator<'_> {
});
}
impl IsPusTelecommand for PusTcCreator<'_> {}
/// This class can be used to read a PUS TC telecommand from raw memory.
///
/// This class also derives the [serde::Serialize] and [serde::Deserialize] trait if the
@ -839,6 +844,8 @@ impl GenericPusTcSecondaryHeader for PusTcReader<'_> {
});
}
impl IsPusTelecommand for PusTcReader<'_> {}
impl PartialEq<PusTcCreator<'_>> for PusTcReader<'_> {
fn eq(&self, other: &PusTcCreator) -> bool {
self.sp_header == other.sp_header

View File

@ -20,6 +20,8 @@ use delegate::delegate;
pub use legacy_tm::*;
pub trait IsPusTelemetry {}
/// Length without timestamp
pub const PUC_TM_MIN_SEC_HEADER_LEN: usize = 7;
pub const PUS_TM_MIN_LEN_WITHOUT_SOURCE_DATA: usize =
@ -754,6 +756,8 @@ impl GenericPusTmSecondaryHeader for PusTmCreator<'_> {
});
}
impl IsPusTelemetry for PusTmCreator<'_> {}
/// This class models the PUS C telemetry packet. It is the primary data structure to read
/// a telemetry packet from raw bytes.
///
@ -871,6 +875,8 @@ impl GenericPusTmSecondaryHeader for PusTmReader<'_> {
});
}
impl IsPusTelemetry for PusTmReader<'_> {}
impl PartialEq<PusTmCreator<'_>> for PusTmReader<'_> {
fn eq(&self, other: &PusTmCreator<'_>) -> bool {
self.sp_header == other.sp_header