From 88793cfa8784dbb05d33c9da7d4c9b25e3141a25 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Feb 2024 15:34:20 +0100 Subject: [PATCH] add some helper types --- satrs/src/pus/scheduler_srv.rs | 48 ++++++++++++++++++++-- satrs/src/pus/test.rs | 73 +++++++++++++++++++--------------- 2 files changed, 86 insertions(+), 35 deletions(-) diff --git a/satrs/src/pus/scheduler_srv.rs b/satrs/src/pus/scheduler_srv.rs index dbe3ae6..9cfb920 100644 --- a/satrs/src/pus/scheduler_srv.rs +++ b/satrs/src/pus/scheduler_srv.rs @@ -1,8 +1,14 @@ use super::scheduler::PusSchedulerProvider; -use super::verification::VerificationReportingProvider; +use super::verification::{ + VerificationReporterWithSharedPoolMpscBoundedSender, + VerificationReporterWithSharedPoolMpscSender, VerificationReporterWithVecMpscBoundedSender, + VerificationReporterWithVecMpscSender, VerificationReportingProvider, +}; use super::{ - get_current_cds_short_timestamp, EcssTcInMemConverter, EcssTcReceiverCore, EcssTmSenderCore, - PusServiceHelper, + get_current_cds_short_timestamp, EcssTcInMemConverter, EcssTcInSharedStoreConverter, + EcssTcInVecConverter, EcssTcReceiverCore, EcssTmSenderCore, MpscTcReceiver, PusServiceHelper, + TmAsVecSenderWithBoundedMpsc, TmAsVecSenderWithMpsc, TmInSharedPoolSenderWithBoundedMpsc, + TmInSharedPoolSenderWithMpsc, }; use crate::pool::PoolProvider; use crate::pus::{PusPacketHandlerResult, PusPacketHandlingError}; @@ -187,6 +193,42 @@ impl< Ok(PusPacketHandlerResult::RequestHandled) } } +/// Helper type definition for a PUS 11 handler with a dynamic TMTC memory backend and regular +/// mpsc queues. +pub type PusService11SchedHandlerDynWithMpsc = 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 = 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 = 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 = PusService11SchedHandler< + MpscTcReceiver, + TmInSharedPoolSenderWithBoundedMpsc, + EcssTcInSharedStoreConverter, + VerificationReporterWithSharedPoolMpscBoundedSender, + PusScheduler, +>; #[cfg(test)] mod tests { diff --git a/satrs/src/pus/test.rs b/satrs/src/pus/test.rs index 4ad023c..ea5a720 100644 --- a/satrs/src/pus/test.rs +++ b/satrs/src/pus/test.rs @@ -5,11 +5,16 @@ use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader}; use spacepackets::ecss::PusPacket; use spacepackets::SpHeader; -use super::verification::VerificationReportingProvider; +use super::verification::{ + VerificationReporterWithSharedPoolMpscBoundedSender, + VerificationReporterWithSharedPoolMpscSender, VerificationReporterWithVecMpscBoundedSender, + VerificationReporterWithVecMpscSender, VerificationReportingProvider, +}; use super::{ - get_current_cds_short_timestamp, EcssTcInMemConverter, EcssTcReceiverCore, EcssTmSenderCore, - MpscTcReceiver, PusServiceHelper, TmAsVecSenderWithBoundedMpsc, TmAsVecSenderWithMpsc, - TmInSharedPoolSenderWithBoundedMpsc, TmInSharedPoolSenderWithMpsc, + get_current_cds_short_timestamp, EcssTcInMemConverter, EcssTcInSharedStoreConverter, + EcssTcInVecConverter, EcssTcReceiverCore, EcssTmSenderCore, MpscTcReceiver, PusServiceHelper, + TmAsVecSenderWithBoundedMpsc, TmAsVecSenderWithMpsc, TmInSharedPoolSenderWithBoundedMpsc, + TmInSharedPoolSenderWithMpsc, }; /// This is a helper class for [std] environments to handle generic PUS 17 (test service) packets. @@ -111,34 +116,38 @@ impl< } } -pub type PusService17TestHandlerDynWithMpsc = - PusService17TestHandler< - MpscTcReceiver, - TmAsVecSenderWithMpsc, - TcInMemConverter, - VerificationReporter, - >; -pub type PusService17TestHandlerDynWithBoundedMpsc = - PusService17TestHandler< - MpscTcReceiver, - TmAsVecSenderWithBoundedMpsc, - TcInMemConverter, - VerificationReporter, - >; -pub type PusService17TestHandlerStaticWithMpsc = - PusService17TestHandler< - MpscTcReceiver, - TmInSharedPoolSenderWithMpsc, - TcInMemConverter, - VerificationReporter, - >; -pub type PusService17TestHandlerStaticWithBoundedMpsc = - PusService17TestHandler< - MpscTcReceiver, - TmInSharedPoolSenderWithBoundedMpsc, - TcInMemConverter, - VerificationReporter, - >; +/// Helper type definition for a PUS 17 handler with a dynamic TMTC memory backend and regular +/// mpsc queues. +pub type PusService17TestHandlerDynWithMpsc = PusService17TestHandler< + MpscTcReceiver, + TmAsVecSenderWithMpsc, + EcssTcInVecConverter, + VerificationReporterWithVecMpscSender, +>; +/// Helper type definition for a PUS 17 handler with a dynamic TMTC memory backend and bounded MPSC +/// queues. +pub type PusService17TestHandlerDynWithBoundedMpsc = PusService17TestHandler< + MpscTcReceiver, + TmAsVecSenderWithBoundedMpsc, + EcssTcInVecConverter, + VerificationReporterWithVecMpscBoundedSender, +>; +/// Helper type definition for a PUS 17 handler with a shared store TMTC memory backend and regular +/// mpsc queues. +pub type PusService17TestHandlerStaticWithMpsc = PusService17TestHandler< + MpscTcReceiver, + TmInSharedPoolSenderWithMpsc, + EcssTcInSharedStoreConverter, + VerificationReporterWithSharedPoolMpscSender, +>; +/// Helper type definition for a PUS 17 handler with a shared store TMTC memory backend and bounded +/// mpsc queues. +pub type PusService17TestHandlerStaticWithBoundedMpsc = PusService17TestHandler< + MpscTcReceiver, + TmInSharedPoolSenderWithBoundedMpsc, + EcssTcInSharedStoreConverter, + VerificationReporterWithSharedPoolMpscBoundedSender, +>; #[cfg(test)] mod tests {