moved a trait

This commit is contained in:
Robin Müller 2023-07-09 18:38:09 +02:00
parent 16d495aa5c
commit 180e770392
Signed by: muellerr
GPG Key ID: A649FB78196E3849
4 changed files with 13 additions and 13 deletions

View File

@ -11,7 +11,7 @@ use dyn_clone::DynClone;
use spacepackets::ecss::PusError; use spacepackets::ecss::PusError;
use spacepackets::tc::PusTc; use spacepackets::tc::PusTc;
use spacepackets::tm::PusTm; use spacepackets::tm::PusTm;
use spacepackets::{ByteConversionError, SizeMissmatch}; use spacepackets::{ByteConversionError, SizeMissmatch, SpHeader};
use std::error::Error; use std::error::Error;
pub mod event; pub mod event;
@ -202,6 +202,14 @@ mod alloc_mod {
impl_downcast!(EcssTcSender); impl_downcast!(EcssTcSender);
} }
/// Generic trait for objects which can receive ECSS PUS telecommands. This trait is
/// implemented by the [crate::tmtc::pus_distrib::PusDistributor] objects to allow passing PUS TC
/// packets into it.
pub trait ReceivesEcssPusTc {
type Error;
fn pass_pus_tc(&mut self, header: &SpHeader, pus_tc: &PusTc) -> Result<(), Self::Error>;
}
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub mod std_mod { pub mod std_mod {
use crate::pool::{ShareablePoolProvider, SharedPool, StoreAddr, StoreError}; use crate::pool::{ShareablePoolProvider, SharedPool, StoreAddr, StoreError};

View File

@ -9,7 +9,6 @@
use downcast_rs::{impl_downcast, Downcast}; use downcast_rs::{impl_downcast, Downcast};
#[cfg(feature = "serde")] #[cfg(feature = "serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use spacepackets::tc::PusTc;
use spacepackets::{ByteConversionError, SizeMissmatch, SpHeader}; use spacepackets::{ByteConversionError, SizeMissmatch, SpHeader};
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
@ -93,11 +92,3 @@ pub trait ReceivesCcsdsTc {
type Error; type Error;
fn pass_ccsds(&mut self, header: &SpHeader, tc_raw: &[u8]) -> Result<(), Self::Error>; fn pass_ccsds(&mut self, header: &SpHeader, tc_raw: &[u8]) -> Result<(), Self::Error>;
} }
/// Generic trait for objects which can receive ECSS PUS telecommands. This trait is
/// implemented by the [crate::tmtc::pus_distrib::PusDistributor] objects to allow passing PUS TC
/// packets into it.
pub trait ReceivesEcssPusTc {
type Error;
fn pass_pus_tc(&mut self, header: &SpHeader, pus_tc: &PusTc) -> Result<(), Self::Error>;
}

View File

@ -61,7 +61,8 @@
//! .expect("Casting back to concrete type failed"); //! .expect("Casting back to concrete type failed");
//! assert_eq!(concrete_handler_ref.handler_call_count, 1); //! assert_eq!(concrete_handler_ref.handler_call_count, 1);
//! ``` //! ```
use crate::tmtc::{ReceivesCcsdsTc, ReceivesEcssPusTc, ReceivesTcCore}; use crate::pus::ReceivesEcssPusTc;
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;

View File

@ -10,12 +10,12 @@ use crate::ccsds::CcsdsReceiver;
use crate::pus::{PusReceiver, PusTcMpscRouter}; 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::AcceptedTc; use satrs_core::pus::{AcceptedTc, ReceivesEcssPusTc};
use satrs_core::spacepackets::ecss::{PusPacket, SerializablePusPacket}; use satrs_core::spacepackets::ecss::{PusPacket, SerializablePusPacket};
use satrs_core::spacepackets::tc::PusTc; 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, ReceivesEcssPusTc}; use satrs_core::tmtc::{CcsdsDistributor, CcsdsError, ReceivesCcsdsTc};
pub const PUS_APID: u16 = 0x02; pub const PUS_APID: u16 = 0x02;