clean up a bit
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2024-03-13 16:11:33 +01:00
parent 8bdc9686fb
commit f5d768f027
Signed by: muellerr
GPG Key ID: A649FB78196E3849

View File

@ -19,50 +19,36 @@ pub enum Subservice {
TmWrongModeReply = 8, TmWrongModeReply = 8,
} }
/// This trait is an abstraction for the routing of PUS service 8 action requests to a dedicated #[cfg(feature = "alloc")]
/// recipient using the generic [TargetId]. #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
pub trait PusModeRequestRouter { pub mod alloc_mod {}
type Error;
fn route(
&self,
target_id: TargetId,
mode_request: ModeRequest,
token: VerificationToken<TcStateAccepted>,
) -> Result<(), Self::Error>;
}
#[cfg(feature = "alloc")] #[cfg(feature = "alloc")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))] #[cfg_attr(doc_cfg, doc(cfg(feature = "alloc")))]
pub mod alloc_mod { pub mod std_mod {
use spacepackets::ecss::tc::PusTcReader; use crate::{
mode::ModeRequest,
pus::{GenericRoutingError, PusTargetedRequestHandler},
};
use crate::pus::verification::VerificationReportingProvider; pub type PusModeServiceRequestHandler<
TcReceiver,
use super::*; TmSender,
TcInMemConverter,
/// This trait is an abstraction for the conversion of a PUS mode service telecommand into VerificationReporter,
/// an [ModeRequest]. RequestConverter,
/// RequestRouter,
/// Having a dedicated trait for this allows maximum flexiblity and tailoring of the standard. RoutingErrorHandler,
/// The only requirement is that a valid [TargetId] and an [ActionRequest] are returned by the RoutingError = GenericRoutingError,
/// core conversion function. > = PusTargetedRequestHandler<
/// TcReceiver,
/// The user should take care of performing the error handling as well. Some of the following TmSender,
/// aspects might be relevant: TcInMemConverter,
/// VerificationReporter,
/// - Checking the validity of the APID, service ID, subservice ID. RequestConverter,
/// - Checking the validity of the user data. RequestRouter,
/// RoutingErrorHandler,
/// A [VerificationReportingProvider] instance is passed to the user to also allow handling ModeRequest,
/// of the verification process as part of the PUS standard requirements. RoutingError,
pub trait PusModeToRequestConverter { >;
type Error;
fn convert(
&mut self,
token: VerificationToken<TcStateAccepted>,
tc: &PusTcReader,
time_stamp: &[u8],
verif_reporter: &impl VerificationReportingProvider,
) -> Result<(TargetId, ModeRequest), Self::Error>;
}
} }