add some helper types
All checks were successful
Rust/sat-rs/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2024-02-26 15:34:20 +01:00
parent 223b637eb8
commit 88793cfa87
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 86 additions and 35 deletions

View File

@ -1,8 +1,14 @@
use super::scheduler::PusSchedulerProvider; use super::scheduler::PusSchedulerProvider;
use super::verification::VerificationReportingProvider; use super::verification::{
VerificationReporterWithSharedPoolMpscBoundedSender,
VerificationReporterWithSharedPoolMpscSender, VerificationReporterWithVecMpscBoundedSender,
VerificationReporterWithVecMpscSender, VerificationReportingProvider,
};
use super::{ use super::{
get_current_cds_short_timestamp, EcssTcInMemConverter, EcssTcReceiverCore, EcssTmSenderCore, get_current_cds_short_timestamp, EcssTcInMemConverter, EcssTcInSharedStoreConverter,
PusServiceHelper, EcssTcInVecConverter, EcssTcReceiverCore, EcssTmSenderCore, MpscTcReceiver, PusServiceHelper,
TmAsVecSenderWithBoundedMpsc, TmAsVecSenderWithMpsc, TmInSharedPoolSenderWithBoundedMpsc,
TmInSharedPoolSenderWithMpsc,
}; };
use crate::pool::PoolProvider; use crate::pool::PoolProvider;
use crate::pus::{PusPacketHandlerResult, PusPacketHandlingError}; use crate::pus::{PusPacketHandlerResult, PusPacketHandlingError};
@ -187,6 +193,42 @@ impl<
Ok(PusPacketHandlerResult::RequestHandled) Ok(PusPacketHandlerResult::RequestHandled)
} }
} }
/// Helper type definition for a PUS 11 handler with a dynamic TMTC memory backend and regular
/// mpsc queues.
pub type PusService11SchedHandlerDynWithMpsc<PusScheduler> = PusService11SchedHandler<
MpscTcReceiver,
TmAsVecSenderWithMpsc,
EcssTcInVecConverter,
VerificationReporterWithVecMpscSender,
PusScheduler,
>;
/// Helper type definition for a PUS 11 handler with a dynamic TMTC memory backend and bounded MPSC
/// queues.
pub type PusService11SchedHandlerDynWithBoundedMpsc<PusScheduler> = PusService11SchedHandler<
MpscTcReceiver,
TmAsVecSenderWithBoundedMpsc,
EcssTcInVecConverter,
VerificationReporterWithVecMpscBoundedSender,
PusScheduler,
>;
/// Helper type definition for a PUS 11 handler with a shared store TMTC memory backend and regular
/// mpsc queues.
pub type PusService11SchedHandlerStaticWithMpsc<PusScheduler> = PusService11SchedHandler<
MpscTcReceiver,
TmInSharedPoolSenderWithMpsc,
EcssTcInSharedStoreConverter,
VerificationReporterWithSharedPoolMpscSender,
PusScheduler,
>;
/// Helper type definition for a PUS 11 handler with a shared store TMTC memory backend and bounded
/// mpsc queues.
pub type PusService11SchedHandlerStaticWithBoundedMpsc<PusScheduler> = PusService11SchedHandler<
MpscTcReceiver,
TmInSharedPoolSenderWithBoundedMpsc,
EcssTcInSharedStoreConverter,
VerificationReporterWithSharedPoolMpscBoundedSender,
PusScheduler,
>;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {

View File

@ -5,11 +5,16 @@ use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
use spacepackets::ecss::PusPacket; use spacepackets::ecss::PusPacket;
use spacepackets::SpHeader; use spacepackets::SpHeader;
use super::verification::VerificationReportingProvider; use super::verification::{
VerificationReporterWithSharedPoolMpscBoundedSender,
VerificationReporterWithSharedPoolMpscSender, VerificationReporterWithVecMpscBoundedSender,
VerificationReporterWithVecMpscSender, VerificationReportingProvider,
};
use super::{ use super::{
get_current_cds_short_timestamp, EcssTcInMemConverter, EcssTcReceiverCore, EcssTmSenderCore, get_current_cds_short_timestamp, EcssTcInMemConverter, EcssTcInSharedStoreConverter,
MpscTcReceiver, PusServiceHelper, TmAsVecSenderWithBoundedMpsc, TmAsVecSenderWithMpsc, EcssTcInVecConverter, EcssTcReceiverCore, EcssTmSenderCore, MpscTcReceiver, PusServiceHelper,
TmInSharedPoolSenderWithBoundedMpsc, TmInSharedPoolSenderWithMpsc, TmAsVecSenderWithBoundedMpsc, TmAsVecSenderWithMpsc, TmInSharedPoolSenderWithBoundedMpsc,
TmInSharedPoolSenderWithMpsc,
}; };
/// This is a helper class for [std] environments to handle generic PUS 17 (test service) packets. /// This is a helper class for [std] environments to handle generic PUS 17 (test service) packets.
@ -111,34 +116,38 @@ impl<
} }
} }
pub type PusService17TestHandlerDynWithMpsc<TcInMemConverter, VerificationReporter> = /// Helper type definition for a PUS 17 handler with a dynamic TMTC memory backend and regular
PusService17TestHandler< /// mpsc queues.
pub type PusService17TestHandlerDynWithMpsc = PusService17TestHandler<
MpscTcReceiver, MpscTcReceiver,
TmAsVecSenderWithMpsc, TmAsVecSenderWithMpsc,
TcInMemConverter, EcssTcInVecConverter,
VerificationReporter, VerificationReporterWithVecMpscSender,
>; >;
pub type PusService17TestHandlerDynWithBoundedMpsc<TcInMemConverter, VerificationReporter> = /// Helper type definition for a PUS 17 handler with a dynamic TMTC memory backend and bounded MPSC
PusService17TestHandler< /// queues.
pub type PusService17TestHandlerDynWithBoundedMpsc = PusService17TestHandler<
MpscTcReceiver, MpscTcReceiver,
TmAsVecSenderWithBoundedMpsc, TmAsVecSenderWithBoundedMpsc,
TcInMemConverter, EcssTcInVecConverter,
VerificationReporter, VerificationReporterWithVecMpscBoundedSender,
>; >;
pub type PusService17TestHandlerStaticWithMpsc<TcInMemConverter, VerificationReporter> = /// Helper type definition for a PUS 17 handler with a shared store TMTC memory backend and regular
PusService17TestHandler< /// mpsc queues.
pub type PusService17TestHandlerStaticWithMpsc = PusService17TestHandler<
MpscTcReceiver, MpscTcReceiver,
TmInSharedPoolSenderWithMpsc, TmInSharedPoolSenderWithMpsc,
TcInMemConverter, EcssTcInSharedStoreConverter,
VerificationReporter, VerificationReporterWithSharedPoolMpscSender,
>; >;
pub type PusService17TestHandlerStaticWithBoundedMpsc<TcInMemConverter, VerificationReporter> = /// Helper type definition for a PUS 17 handler with a shared store TMTC memory backend and bounded
PusService17TestHandler< /// mpsc queues.
pub type PusService17TestHandlerStaticWithBoundedMpsc = PusService17TestHandler<
MpscTcReceiver, MpscTcReceiver,
TmInSharedPoolSenderWithBoundedMpsc, TmInSharedPoolSenderWithBoundedMpsc,
TcInMemConverter, EcssTcInSharedStoreConverter,
VerificationReporter, VerificationReporterWithSharedPoolMpscBoundedSender,
>; >;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {