add some more missing docs
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit

This commit is contained in:
Robin Müller 2024-02-16 17:59:35 +01:00
parent 8ad21018f4
commit 3cb34cef58
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 47 additions and 11 deletions

View File

@ -75,14 +75,16 @@ pub mod std_mod {
/// 1. Retrieve the next TC packet from the [PusServiceHelper]. The [EcssTcInMemConverter] /// 1. Retrieve the next TC packet from the [PusServiceHelper]. The [EcssTcInMemConverter]
/// allows to configure the used telecommand memory backend. /// allows to configure the used telecommand memory backend.
/// 2. Convert the TC to a targeted action request using the provided /// 2. Convert the TC to a targeted action request using the provided
/// [PusActionToRequestConverter]. /// [PusActionToRequestConverter]. The generic error type is constrained to the
/// [PusPacketHandlingError] for the concrete implementation which offers a packet handler.
/// 3. Route the action request using the provided [PusActionRequestRouter]. /// 3. Route the action request using the provided [PusActionRequestRouter].
/// 4. Handle all routing errors using the provided [PusRoutingErrorHandler]. /// 4. Handle all routing errors using the provided [PusRoutingErrorHandler].
pub struct PusService8ActionHandler< pub struct PusService8ActionHandler<
TcInMemConverter: EcssTcInMemConverter, TcInMemConverter: EcssTcInMemConverter,
RequestConverter: PusActionToRequestConverter, RequestConverter: PusActionToRequestConverter,
RequestRouter: PusActionRequestRouter, RequestRouter: PusActionRequestRouter<Error=RoutingError>,
RoutingErrorHandler: PusRoutingErrorHandler, RoutingErrorHandler: PusRoutingErrorHandler<Error=RoutingError>,
RoutingError = GenericRoutingError
> { > {
service_helper: PusServiceHelper<TcInMemConverter>, service_helper: PusServiceHelper<TcInMemConverter>,
request_converter: RequestConverter, request_converter: RequestConverter,
@ -93,14 +95,16 @@ pub mod std_mod {
impl< impl<
TcInMemConverter: EcssTcInMemConverter, TcInMemConverter: EcssTcInMemConverter,
RequestConverter: PusActionToRequestConverter<Error = PusPacketHandlingError>, RequestConverter: PusActionToRequestConverter<Error = PusPacketHandlingError>,
RequestRouter: PusActionRequestRouter<Error = GenericRoutingError>, RequestRouter: PusActionRequestRouter<Error = RoutingError>,
RoutingErrorHandler: PusRoutingErrorHandler<Error = GenericRoutingError>, RoutingErrorHandler: PusRoutingErrorHandler<Error = RoutingError>,
RoutingError
> >
PusService8ActionHandler< PusService8ActionHandler<
TcInMemConverter, TcInMemConverter,
RequestConverter, RequestConverter,
RequestRouter, RequestRouter,
RoutingErrorHandler, RoutingErrorHandler,
RoutingError
> >
{ {
pub fn new( pub fn new(

View File

@ -12,6 +12,8 @@ use crate::{hk::HkRequest, TargetId};
use super::verification::{TcStateAccepted, VerificationToken}; use super::verification::{TcStateAccepted, VerificationToken};
/// This trait is an abstraction for the routing of PUS service 3 housekeeping requests to a
/// dedicated recipient using the generic [TargetId].
pub trait PusHkRequestRouter { pub trait PusHkRequestRouter {
type Error; type Error;
fn route( fn route(
@ -31,6 +33,21 @@ pub mod alloc_mod {
use super::*; use super::*;
/// This trait is an abstraction for the conversion of a PUS service 8 action telecommand into
/// a [HkRequest].
///
/// Having a dedicated trait for this allows maximum flexiblity and tailoring of the standard.
/// The only requirement is that a valid [TargetId] and a [HkRequest] are returned by the
/// core conversion function.
///
/// The user should take care of performing the error handling as well. Some of the following
/// aspects might be relevant:
///
/// - Checking the validity of the APID, service ID, subservice ID.
/// - Checking the validity of the user data.
///
/// A [VerificationReporterWithSender] instance is passed to the user to also allow handling
/// of the verification process as part of the PUS standard requirements.
pub trait PusHkToRequestConverter { pub trait PusHkToRequestConverter {
type Error; type Error;
fn convert( fn convert(
@ -53,11 +70,25 @@ pub mod std_mod {
use super::*; use super::*;
/// This is a generic high-level handler for the PUS service 3 housekeeping service.
///
/// It performs the following handling steps:
///
/// 1. Retrieve the next TC packet from the [PusServiceHelper]. The [EcssTcInMemConverter]
/// allows to configure the used telecommand memory backend.
/// 2. Convert the TC to a targeted action request using the provided
/// [PusActionToRequestConverter]. The generic error type is constrained to the
/// [PusPacketHandlerResult] for the concrete implementation which offers a packet handler.
/// 3. Route the action request using the provided [PusActionRequestRouter]. The generic error
/// type is constrained to the [GenericRoutingError] for the concrete implementation.
/// 4. Handle all routing errors using the provided [PusRoutingErrorHandler]. The generic error
/// type is constrained to the [GenericRoutingError] for the concrete implementation.
pub struct PusService3HkHandler< pub struct PusService3HkHandler<
TcInMemConverter: EcssTcInMemConverter, TcInMemConverter: EcssTcInMemConverter,
RequestConverter: PusHkToRequestConverter, RequestConverter: PusHkToRequestConverter,
RequestRouter: PusHkRequestRouter, RequestRouter: PusHkRequestRouter<Error=RoutingError>,
RoutingErrorHandler: PusRoutingErrorHandler, RoutingErrorHandler: PusRoutingErrorHandler<Error=RoutingError>,
RoutingError = GenericRoutingError
> { > {
service_helper: PusServiceHelper<TcInMemConverter>, service_helper: PusServiceHelper<TcInMemConverter>,
request_converter: RequestConverter, request_converter: RequestConverter,
@ -68,10 +99,11 @@ pub mod std_mod {
impl< impl<
TcInMemConverter: EcssTcInMemConverter, TcInMemConverter: EcssTcInMemConverter,
RequestConverter: PusHkToRequestConverter<Error = PusPacketHandlingError>, RequestConverter: PusHkToRequestConverter<Error = PusPacketHandlingError>,
RequestRouter: PusHkRequestRouter<Error = GenericRoutingError>, RequestRouter: PusHkRequestRouter<Error = RoutingError>,
RoutingErrorHandler: PusRoutingErrorHandler<Error = GenericRoutingError>, RoutingErrorHandler: PusRoutingErrorHandler<Error = RoutingError>,
RoutingError,
> >
PusService3HkHandler<TcInMemConverter, RequestConverter, RequestRouter, RoutingErrorHandler> PusService3HkHandler<TcInMemConverter, RequestConverter, RequestRouter, RoutingErrorHandler, RoutingError>
{ {
pub fn new( pub fn new(
service_helper: PusServiceHelper<TcInMemConverter>, service_helper: PusServiceHelper<TcInMemConverter>,

View File

@ -353,7 +353,7 @@ mod alloc_mod {
target_id: TargetId, target_id: TargetId,
token: VerificationToken<TcStateAccepted>, token: VerificationToken<TcStateAccepted>,
tc: &PusTcReader, tc: &PusTcReader,
error: GenericRoutingError, error: Self::Error,
time_stamp: &[u8], time_stamp: &[u8],
verif_reporter: &mut VerificationReporterWithSender, verif_reporter: &mut VerificationReporterWithSender,
); );