add some documentation
All checks were successful
Rust/sat-rs/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2024-01-31 15:19:18 +01:00
parent 9759818d94
commit 9bea82ff0e
Signed by: muellerr
GPG Key ID: A649FB78196E3849
3 changed files with 22 additions and 8 deletions

View File

@ -123,4 +123,5 @@ doc-images = []
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "doc_cfg"]
targets = ["x86_64-unknown-linux-gnu"]
rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"]

View File

@ -194,6 +194,9 @@ pub trait EcssTcSenderCore: EcssChannel {
fn send_tc(&self, tc: PusTcCreator, token: Option<TcStateToken>) -> Result<(), EcssTmtcError>;
}
/// A PUS telecommand packet can be stored in memory using different methods. Right now,
/// storage inside a pool structure like [LocalPool], and storage inside a `Vec<u8>` are
/// supported.
#[non_exhaustive]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum TcInMemory {
@ -215,6 +218,7 @@ impl From<alloc::vec::Vec<u8>> for TcInMemory {
}
}
/// Generic structure for an ECSS PUS Telecommand and its correspoding verification token.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct EcssTcAndToken {
pub tc_in_memory: TcInMemory,
@ -363,6 +367,7 @@ mod alloc_mod {
}
#[cfg(feature = "std")]
#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]
pub mod std_mod {
use crate::pool::{SharedPool, StoreAddr};
use crate::pus::verification::{
@ -705,7 +710,7 @@ pub mod std_mod {
}
}
/// Converter structure for PUS telecommands which are stored inside a [Vec<u8>] structure.
/// Converter structure for PUS telecommands which are stored inside a `Vec<u8>` structure.
/// Please note that this structure is not able to convert TCs which are stored inside a
/// [SharedPool].
pub struct EcssTcInVecConverter {
@ -827,12 +832,13 @@ pub mod std_mod {
}
}
/// Base class for handlers which can handle PUS TC packets. Right now, the verification
/// reporter is constrained to the [StdVerifReporterWithSender] and the service handler
/// relies on TMTC packets being exchanged via a [SharedPool]. Please note that this variant
/// of the PUS service base is not optimized for handling packets sent as a `Vec<u8>` and
/// might perform additional copies to the internal buffer as well. The class should
/// still behave correctly.
/// This is a high-level PUS packet handler. It performs some of the boilerplate acitivities
/// involved when handling PUS telecommands and it can be used to implement the handling of
/// PUS telecommands for certain PUS telecommands groups (for example individual services).
///
/// This base class can handle PUS telecommands backed by different memory storage machanisms
/// by using the [EcssTcInMemConverter] abstraction. This object provides some convenience
/// methods to make the generic parts of TC handling easier.
pub struct PusServiceHandler<TcInMemConverter: EcssTcInMemConverter> {
pub common: PusServiceBase,
pub tc_in_mem_converter: TcInMemConverter,
@ -857,6 +863,11 @@ pub mod std_mod {
}
}
/// This function can be used to poll the internal [EcssTcReceiver] object for the next
/// telecommand packet. It will return `Ok(None)` if there are not packets available.
/// In any other case, it will perform the acceptance of the ECSS TC packet using the
/// internal [VerificationReporterWithSender] object. It will then return the telecommand
/// and the according accepted token.
pub fn retrieve_and_accept_next_packet(
&mut self,
) -> Result<Option<AcceptedEcssTcAndToken>, PusPacketHandlingError> {

View File

@ -208,6 +208,8 @@ impl WasAtLeastAccepted for TcStateAccepted {}
impl WasAtLeastAccepted for TcStateStarted {}
impl WasAtLeastAccepted for TcStateCompleted {}
/// Token wrapper to model all possible verification tokens. These tokens are used to
/// enforce the correct order for the verification steps when doing verification reporting.
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum TcStateToken {
None(VerificationToken<TcStateNone>),