update trait names #247

Merged
muellerr merged 1 commits from update-trait-names into main 2025-09-06 19:31:46 +02:00
24 changed files with 160 additions and 151 deletions

View File

@@ -2,7 +2,7 @@ use std::sync::mpsc::{self};
use crate::pus::create_verification_reporter; use crate::pus::create_verification_reporter;
use satrs::event_man::{EventMessageU32, EventRoutingError}; use satrs::event_man::{EventMessageU32, EventRoutingError};
use satrs::pus::event::EventTmHookProvider; use satrs::pus::event::EventTmHook;
use satrs::pus::verification::VerificationReporter; use satrs::pus::verification::VerificationReporter;
use satrs::pus::EcssTmSender; use satrs::pus::EcssTmSender;
use satrs::request::UniqueApidTargetId; use satrs::request::UniqueApidTargetId;
@@ -26,7 +26,7 @@ pub struct EventApidSetter {
pub next_apid: u16, pub next_apid: u16,
} }
impl EventTmHookProvider for EventApidSetter { impl EventTmHook for EventApidSetter {
fn modify_tm(&self, tm: &mut satrs::spacepackets::ecss::tm::PusTmCreator) { fn modify_tm(&self, tm: &mut satrs::spacepackets::ecss::tm::PusTmCreator) {
tm.set_apid(self.next_apid); tm.set_apid(self.next_apid);
} }
@@ -219,7 +219,7 @@ impl<TmSender: EcssTmSender> EventHandler<TmSender> {
mod tests { mod tests {
use satrs::{ use satrs::{
events::EventU32, events::EventU32,
pus::verification::VerificationReporterCfg, pus::verification::VerificationReporterConfig,
spacepackets::{ spacepackets::{
ecss::{tm::PusTmReader, PusPacket}, ecss::{tm::PusTmReader, PusPacket},
CcsdsPacket, CcsdsPacket,
@@ -244,7 +244,7 @@ mod tests {
let (event_tx, event_rx) = mpsc::sync_channel(10); let (event_tx, event_rx) = mpsc::sync_channel(10);
let (_event_req_tx, event_req_rx) = mpsc::sync_channel(10); let (_event_req_tx, event_req_rx) = mpsc::sync_channel(10);
let (tm_sender, tm_receiver) = mpsc::channel(); let (tm_sender, tm_receiver) = mpsc::channel();
let verif_reporter_cfg = VerificationReporterCfg::new(0x05, 2, 2, 128).unwrap(); let verif_reporter_cfg = VerificationReporterConfig::new(0x05, 2, 2, 128).unwrap();
let verif_reporter = let verif_reporter =
VerificationReporter::new(PUS_EVENT_MANAGEMENT.id(), &verif_reporter_cfg); VerificationReporter::new(PUS_EVENT_MANAGEMENT.id(), &verif_reporter_cfg);
let mut event_manager = EventManagerWithBoundedMpsc::new(event_rx); let mut event_manager = EventManagerWithBoundedMpsc::new(event_rx);

View File

@@ -33,7 +33,7 @@ use satrs::{
hal::std::{tcp_server::ServerConfig, udp_server::UdpTcServer}, hal::std::{tcp_server::ServerConfig, udp_server::UdpTcServer},
mode::{Mode, ModeAndSubmode, ModeRequest, ModeRequestHandlerMpscBounded}, mode::{Mode, ModeAndSubmode, ModeRequest, ModeRequestHandlerMpscBounded},
mode_tree::connect_mode_nodes, mode_tree::connect_mode_nodes,
pus::{event_man::EventRequestWithToken, EcssTcInMemConverter, HandlingStatus}, pus::{event_man::EventRequestWithToken, EcssTcInMemConverterWrapper, HandlingStatus},
request::{GenericMessage, MessageMetadata}, request::{GenericMessage, MessageMetadata},
spacepackets::time::{cds::CdsTime, TimeWriter}, spacepackets::time::{cds::CdsTime, TimeWriter},
}; };
@@ -145,7 +145,7 @@ fn main() {
let tc_in_mem_converter = let tc_in_mem_converter =
EcssTcInMemConverter::Static(EcssTcInSharedPoolConverter::new(shared_tc_pool, 4096)); EcssTcInMemConverter::Static(EcssTcInSharedPoolConverter::new(shared_tc_pool, 4096));
} else if #[cfg(feature = "heap_tmtc")] { } else if #[cfg(feature = "heap_tmtc")] {
let tc_in_mem_converter = EcssTcInMemConverter::Heap(EcssTcInVecConverter::default()); let tc_in_mem_converter = EcssTcInMemConverterWrapper::Heap(EcssTcInVecConverter::default());
} }
} }

View File

@@ -9,7 +9,7 @@ use satrs::pus::verification::{
VerificationReportingProvider, VerificationToken, VerificationReportingProvider, VerificationToken,
}; };
use satrs::pus::{ use satrs::pus::{
ActiveRequestProvider, EcssTcAndToken, EcssTcInMemConverter, EcssTmSender, EcssTmtcError, ActiveRequest, EcssTcAndToken, EcssTcInMemConverterWrapper, EcssTmSender, EcssTmtcError,
GenericConversionError, MpscTcReceiver, PusPacketHandlingError, PusReplyHandler, GenericConversionError, MpscTcReceiver, PusPacketHandlingError, PusReplyHandler,
PusServiceHelper, PusTcToRequestConverter, PusServiceHelper, PusTcToRequestConverter,
}; };
@@ -208,7 +208,7 @@ impl PusTcToRequestConverter<ActivePusActionRequestStd, ActionRequest> for Actio
pub fn create_action_service( pub fn create_action_service(
tm_sender: TmTcSender, tm_sender: TmTcSender,
tc_in_mem_converter: EcssTcInMemConverter, tc_in_mem_converter: EcssTcInMemConverterWrapper,
pus_action_rx: mpsc::Receiver<EcssTcAndToken>, pus_action_rx: mpsc::Receiver<EcssTcAndToken>,
action_router: GenericRequestRouter, action_router: GenericRequestRouter,
reply_receiver: mpsc::Receiver<GenericMessage<ActionReplyPus>>, reply_receiver: mpsc::Receiver<GenericMessage<ActionReplyPus>>,
@@ -325,7 +325,7 @@ mod tests {
pus_action_rx, pus_action_rx,
TmTcSender::Heap(tm_funnel_tx.clone()), TmTcSender::Heap(tm_funnel_tx.clone()),
verif_reporter, verif_reporter,
EcssTcInMemConverter::Heap(EcssTcInVecConverter::default()), EcssTcInMemConverterWrapper::Heap(EcssTcInVecConverter::default()),
), ),
ActionRequestConverter::default(), ActionRequestConverter::default(),
DefaultActiveActionRequestMap::default(), DefaultActiveActionRequestMap::default(),

View File

@@ -6,7 +6,7 @@ use satrs::pus::event_man::EventRequestWithToken;
use satrs::pus::event_srv::PusEventServiceHandler; use satrs::pus::event_srv::PusEventServiceHandler;
use satrs::pus::verification::VerificationReporter; use satrs::pus::verification::VerificationReporter;
use satrs::pus::{ use satrs::pus::{
DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConverter, MpscTcReceiver, DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConverterWrapper, MpscTcReceiver,
PartialPusHandlingError, PusServiceHelper, PartialPusHandlingError, PusServiceHelper,
}; };
use satrs::spacepackets::ecss::PusServiceId; use satrs::spacepackets::ecss::PusServiceId;
@@ -16,7 +16,7 @@ use super::{DirectPusService, HandlingStatus};
pub fn create_event_service( pub fn create_event_service(
tm_sender: TmTcSender, tm_sender: TmTcSender,
tm_in_pool_converter: EcssTcInMemConverter, tm_in_pool_converter: EcssTcInMemConverterWrapper,
pus_event_rx: mpsc::Receiver<EcssTcAndToken>, pus_event_rx: mpsc::Receiver<EcssTcAndToken>,
event_request_tx: mpsc::Sender<EventRequestWithToken>, event_request_tx: mpsc::Sender<EventRequestWithToken>,
) -> EventServiceWrapper { ) -> EventServiceWrapper {
@@ -39,7 +39,7 @@ pub struct EventServiceWrapper {
pub handler: PusEventServiceHandler< pub handler: PusEventServiceHandler<
MpscTcReceiver, MpscTcReceiver,
TmTcSender, TmTcSender,
EcssTcInMemConverter, EcssTcInMemConverterWrapper,
VerificationReporter, VerificationReporter,
>, >,
} }

View File

@@ -5,9 +5,10 @@ use satrs::pus::verification::{
VerificationReportingProvider, VerificationToken, VerificationReportingProvider, VerificationToken,
}; };
use satrs::pus::{ use satrs::pus::{
ActivePusRequestStd, ActiveRequestProvider, DefaultActiveRequestMap, EcssTcAndToken, ActivePusRequestStd, ActiveRequest, DefaultActiveRequestMap, EcssTcAndToken,
EcssTcInMemConverter, EcssTmSender, EcssTmtcError, GenericConversionError, MpscTcReceiver, EcssTcInMemConverterWrapper, EcssTmSender, EcssTmtcError, GenericConversionError,
PusPacketHandlingError, PusReplyHandler, PusServiceHelper, PusTcToRequestConverter, MpscTcReceiver, PusPacketHandlingError, PusReplyHandler, PusServiceHelper,
PusTcToRequestConverter,
}; };
use satrs::request::{GenericMessage, UniqueApidTargetId}; use satrs::request::{GenericMessage, UniqueApidTargetId};
use satrs::res_code::ResultU16; use satrs::res_code::ResultU16;
@@ -242,7 +243,7 @@ impl PusTcToRequestConverter<ActivePusRequestStd, HkRequest> for HkRequestConver
pub fn create_hk_service( pub fn create_hk_service(
tm_sender: TmTcSender, tm_sender: TmTcSender,
tc_in_mem_converter: EcssTcInMemConverter, tc_in_mem_converter: EcssTcInMemConverterWrapper,
pus_hk_rx: mpsc::Receiver<EcssTcAndToken>, pus_hk_rx: mpsc::Receiver<EcssTcAndToken>,
request_router: GenericRequestRouter, request_router: GenericRequestRouter,
reply_receiver: mpsc::Receiver<GenericMessage<HkReply>>, reply_receiver: mpsc::Receiver<GenericMessage<HkReply>>,

View File

@@ -4,13 +4,13 @@ use log::warn;
use satrs::pool::PoolAddr; use satrs::pool::PoolAddr;
use satrs::pus::verification::{ use satrs::pus::verification::{
self, FailParams, TcStateAccepted, TcStateStarted, VerificationReporter, self, FailParams, TcStateAccepted, TcStateStarted, VerificationReporter,
VerificationReporterCfg, VerificationReportingProvider, VerificationToken, VerificationReporterConfig, VerificationReportingProvider, VerificationToken,
}; };
use satrs::pus::{ use satrs::pus::{
ActiveRequestMapProvider, ActiveRequestProvider, EcssTcAndToken, EcssTcInMemConversionProvider, ActiveRequest, ActiveRequestStore, CacheAndReadRawEcssTc, EcssTcAndToken,
EcssTcInMemConverter, EcssTcReceiver, EcssTmSender, EcssTmtcError, GenericConversionError, EcssTcInMemConverterWrapper, EcssTcReceiver, EcssTmSender, EcssTmtcError,
GenericRoutingError, HandlingStatus, PusPacketHandlingError, PusReplyHandler, PusRequestRouter, GenericConversionError, GenericRoutingError, HandlingStatus, PusPacketHandlingError,
PusServiceHelper, PusTcToRequestConverter, TcInMemory, PusReplyHandler, PusRequestRouter, PusServiceHelper, PusTcToRequestConverter, TcInMemory,
}; };
use satrs::queue::{GenericReceiveError, GenericSendError}; use satrs::queue::{GenericReceiveError, GenericSendError};
use satrs::request::{Apid, GenericMessage, MessageMetadata}; use satrs::request::{Apid, GenericMessage, MessageMetadata};
@@ -33,7 +33,7 @@ pub mod stack;
pub mod test; pub mod test;
pub fn create_verification_reporter(owner_id: ComponentId, apid: Apid) -> VerificationReporter { pub fn create_verification_reporter(owner_id: ComponentId, apid: Apid) -> VerificationReporter {
let verif_cfg = VerificationReporterCfg::new(apid, 1, 2, 8).unwrap(); let verif_cfg = VerificationReporterConfig::new(apid, 1, 2, 8).unwrap();
// Every software component which needs to generate verification telemetry, gets a cloned // Every software component which needs to generate verification telemetry, gets a cloned
// verification reporter. // verification reporter.
VerificationReporter::new(owner_id, &verif_cfg) VerificationReporter::new(owner_id, &verif_cfg)
@@ -269,16 +269,16 @@ pub struct PusTargetedRequestService<
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>, RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>,
ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>, ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>,
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestInfo>, ActiveRequestMapInstance: ActiveRequestStore<ActiveRequestInfo>,
ActiveRequestInfo: ActiveRequestProvider, ActiveRequestInfo: ActiveRequest,
RequestType, RequestType,
ReplyType, ReplyType,
> { > {
pub service_helper: pub service_helper:
PusServiceHelper<TcReceiver, TmTcSender, EcssTcInMemConverter, VerificationReporter>, PusServiceHelper<TcReceiver, TmTcSender, EcssTcInMemConverterWrapper, VerificationReporter>,
pub request_router: GenericRequestRouter, pub request_router: GenericRequestRouter,
pub request_converter: RequestConverter, pub request_converter: RequestConverter,
pub active_request_map: ActiveRequestMap, pub active_request_map: ActiveRequestMapInstance,
pub reply_handler: ReplyHandler, pub reply_handler: ReplyHandler,
pub reply_receiver: mpsc::Receiver<GenericMessage<ReplyType>>, pub reply_receiver: mpsc::Receiver<GenericMessage<ReplyType>>,
phantom: std::marker::PhantomData<(RequestType, ActiveRequestInfo, ReplyType)>, phantom: std::marker::PhantomData<(RequestType, ActiveRequestInfo, ReplyType)>,
@@ -289,8 +289,8 @@ impl<
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>, RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>,
ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>, ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>,
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestInfo>, ActiveRequestMapInstance: ActiveRequestStore<ActiveRequestInfo>,
ActiveRequestInfo: ActiveRequestProvider, ActiveRequestInfo: ActiveRequest,
RequestType, RequestType,
ReplyType, ReplyType,
> >
@@ -299,7 +299,7 @@ impl<
VerificationReporter, VerificationReporter,
RequestConverter, RequestConverter,
ReplyHandler, ReplyHandler,
ActiveRequestMap, ActiveRequestMapInstance,
ActiveRequestInfo, ActiveRequestInfo,
RequestType, RequestType,
ReplyType, ReplyType,
@@ -311,11 +311,11 @@ where
service_helper: PusServiceHelper< service_helper: PusServiceHelper<
TcReceiver, TcReceiver,
TmTcSender, TmTcSender,
EcssTcInMemConverter, EcssTcInMemConverterWrapper,
VerificationReporter, VerificationReporter,
>, >,
request_converter: RequestConverter, request_converter: RequestConverter,
active_request_map: ActiveRequestMap, active_request_map: ActiveRequestMapInstance,
reply_hook: ReplyHandler, reply_hook: ReplyHandler,
request_router: GenericRequestRouter, request_router: GenericRequestRouter,
reply_receiver: mpsc::Receiver<GenericMessage<ReplyType>>, reply_receiver: mpsc::Receiver<GenericMessage<ReplyType>>,
@@ -509,7 +509,7 @@ where
/// and also log the error. /// and also log the error.
pub fn generic_pus_request_timeout_handler( pub fn generic_pus_request_timeout_handler(
sender: &(impl EcssTmSender + ?Sized), sender: &(impl EcssTmSender + ?Sized),
active_request: &(impl ActiveRequestProvider + Debug), active_request: &(impl ActiveRequest + Debug),
verification_handler: &impl VerificationReportingProvider, verification_handler: &impl VerificationReportingProvider,
time_stamp: &[u8], time_stamp: &[u8],
service_str: &'static str, service_str: &'static str,
@@ -537,7 +537,7 @@ pub(crate) mod tests {
use satrs::{ use satrs::{
pus::{ pus::{
verification::test_util::TestVerificationReporter, ActivePusRequestStd, verification::test_util::TestVerificationReporter, ActivePusRequestStd,
ActiveRequestMapProvider, MpscTcReceiver, ActiveRequestStore, MpscTcReceiver,
}, },
request::UniqueApidTargetId, request::UniqueApidTargetId,
spacepackets::{ spacepackets::{
@@ -556,7 +556,7 @@ pub(crate) mod tests {
// Testbench dedicated to the testing of [PusReplyHandler]s // Testbench dedicated to the testing of [PusReplyHandler]s
pub struct ReplyHandlerTestbench< pub struct ReplyHandlerTestbench<
ReplyHandler: PusReplyHandler<ActiveRequestInfo, Reply, Error = EcssTmtcError>, ReplyHandler: PusReplyHandler<ActiveRequestInfo, Reply, Error = EcssTmtcError>,
ActiveRequestInfo: ActiveRequestProvider, ActiveRequestInfo: ActiveRequest,
Reply, Reply,
> { > {
pub id: ComponentId, pub id: ComponentId,
@@ -570,7 +570,7 @@ pub(crate) mod tests {
impl< impl<
ReplyHandler: PusReplyHandler<ActiveRequestInfo, Reply, Error = EcssTmtcError>, ReplyHandler: PusReplyHandler<ActiveRequestInfo, Reply, Error = EcssTmtcError>,
ActiveRequestInfo: ActiveRequestProvider, ActiveRequestInfo: ActiveRequest,
Reply, Reply,
> ReplyHandlerTestbench<ReplyHandler, ActiveRequestInfo, Reply> > ReplyHandlerTestbench<ReplyHandler, ActiveRequestInfo, Reply>
{ {
@@ -671,7 +671,7 @@ pub(crate) mod tests {
// Testbench dedicated to the testing of [PusTcToRequestConverter]s // Testbench dedicated to the testing of [PusTcToRequestConverter]s
pub struct PusConverterTestbench< pub struct PusConverterTestbench<
Converter: PusTcToRequestConverter<ActiveRequestInfo, Request, Error = GenericConversionError>, Converter: PusTcToRequestConverter<ActiveRequestInfo, Request, Error = GenericConversionError>,
ActiveRequestInfo: ActiveRequestProvider, ActiveRequestInfo: ActiveRequest,
Request, Request,
> { > {
pub id: ComponentId, pub id: ComponentId,
@@ -685,7 +685,7 @@ pub(crate) mod tests {
impl< impl<
Converter: PusTcToRequestConverter<ActiveRequestInfo, Request, Error = GenericConversionError>, Converter: PusTcToRequestConverter<ActiveRequestInfo, Request, Error = GenericConversionError>,
ActiveRequestInfo: ActiveRequestProvider, ActiveRequestInfo: ActiveRequest,
Request, Request,
> PusConverterTestbench<Converter, ActiveRequestInfo, Request> > PusConverterTestbench<Converter, ActiveRequestInfo, Request>
{ {
@@ -751,8 +751,8 @@ pub(crate) mod tests {
pub struct TargetedPusRequestTestbench< pub struct TargetedPusRequestTestbench<
RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>, RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>,
ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>, ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>,
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestInfo>, ActiveRequestMapInstance: ActiveRequestStore<ActiveRequestInfo>,
ActiveRequestInfo: ActiveRequestProvider, ActiveRequestInfo: ActiveRequest,
RequestType, RequestType,
ReplyType, ReplyType,
> { > {
@@ -761,7 +761,7 @@ pub(crate) mod tests {
TestVerificationReporter, TestVerificationReporter,
RequestConverter, RequestConverter,
ReplyHandler, ReplyHandler,
ActiveRequestMap, ActiveRequestMapInstance,
ActiveRequestInfo, ActiveRequestInfo,
RequestType, RequestType,
ReplyType, ReplyType,

View File

@@ -8,7 +8,7 @@ use crate::requests::GenericRequestRouter;
use crate::tmtc::sender::TmTcSender; use crate::tmtc::sender::TmTcSender;
use satrs::pus::verification::VerificationReporter; use satrs::pus::verification::VerificationReporter;
use satrs::pus::{ use satrs::pus::{
DefaultActiveRequestMap, EcssTcAndToken, EcssTcInMemConverter, MpscTcReceiver, DefaultActiveRequestMap, EcssTcAndToken, EcssTcInMemConverterWrapper, MpscTcReceiver,
PusPacketHandlingError, PusServiceHelper, PusPacketHandlingError, PusServiceHelper,
}; };
use satrs::request::GenericMessage; use satrs::request::GenericMessage;
@@ -20,8 +20,8 @@ use satrs::{
self, FailParams, TcStateAccepted, TcStateStarted, VerificationReportingProvider, self, FailParams, TcStateAccepted, TcStateStarted, VerificationReportingProvider,
VerificationToken, VerificationToken,
}, },
ActivePusRequestStd, ActiveRequestProvider, EcssTmSender, EcssTmtcError, ActivePusRequestStd, ActiveRequest, EcssTmSender, EcssTmtcError, GenericConversionError,
GenericConversionError, PusReplyHandler, PusTcToRequestConverter, PusTmVariant, PusReplyHandler, PusTcToRequestConverter, PusTmVariant,
}, },
request::UniqueApidTargetId, request::UniqueApidTargetId,
spacepackets::{ spacepackets::{
@@ -210,7 +210,7 @@ impl PusTcToRequestConverter<ActivePusRequestStd, ModeRequest> for ModeRequestCo
pub fn create_mode_service( pub fn create_mode_service(
tm_sender: TmTcSender, tm_sender: TmTcSender,
tc_in_mem_converter: EcssTcInMemConverter, tc_in_mem_converter: EcssTcInMemConverterWrapper,
pus_action_rx: mpsc::Receiver<EcssTcAndToken>, pus_action_rx: mpsc::Receiver<EcssTcAndToken>,
mode_router: GenericRequestRouter, mode_router: GenericRequestRouter,
reply_receiver: mpsc::Receiver<GenericMessage<ModeReply>>, reply_receiver: mpsc::Receiver<GenericMessage<ModeReply>>,

View File

@@ -9,7 +9,7 @@ use satrs::pus::scheduler::{PusScheduler, TcInfo};
use satrs::pus::scheduler_srv::PusSchedServiceHandler; use satrs::pus::scheduler_srv::PusSchedServiceHandler;
use satrs::pus::verification::VerificationReporter; use satrs::pus::verification::VerificationReporter;
use satrs::pus::{ use satrs::pus::{
DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConverter, MpscTcReceiver, DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConverterWrapper, MpscTcReceiver,
PartialPusHandlingError, PusServiceHelper, PartialPusHandlingError, PusServiceHelper,
}; };
use satrs::spacepackets::ecss::PusServiceId; use satrs::spacepackets::ecss::PusServiceId;
@@ -84,7 +84,7 @@ pub struct SchedulingServiceWrapper {
pub pus_11_handler: PusSchedServiceHandler< pub pus_11_handler: PusSchedServiceHandler<
MpscTcReceiver, MpscTcReceiver,
TmTcSender, TmTcSender,
EcssTcInMemConverter, EcssTcInMemConverterWrapper,
VerificationReporter, VerificationReporter,
PusScheduler, PusScheduler,
>, >,
@@ -174,7 +174,7 @@ impl SchedulingServiceWrapper {
pub fn create_scheduler_service( pub fn create_scheduler_service(
tm_sender: TmTcSender, tm_sender: TmTcSender,
tc_in_mem_converter: EcssTcInMemConverter, tc_in_mem_converter: EcssTcInMemConverterWrapper,
tc_releaser: TcReleaser, tc_releaser: TcReleaser,
pus_sched_rx: mpsc::Receiver<EcssTcAndToken>, pus_sched_rx: mpsc::Receiver<EcssTcAndToken>,
sched_tc_pool: StaticMemoryPool, sched_tc_pool: StaticMemoryPool,

View File

@@ -6,8 +6,8 @@ use satrs::pus::test::PusService17TestHandler;
use satrs::pus::verification::{FailParams, VerificationReporter, VerificationReportingProvider}; use satrs::pus::verification::{FailParams, VerificationReporter, VerificationReportingProvider};
use satrs::pus::PartialPusHandlingError; use satrs::pus::PartialPusHandlingError;
use satrs::pus::{ use satrs::pus::{
DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConversionProvider, CacheAndReadRawEcssTc, DirectPusPacketHandlerResult, EcssTcAndToken,
EcssTcInMemConverter, MpscTcReceiver, PusServiceHelper, EcssTcInMemConverterWrapper, MpscTcReceiver, PusServiceHelper,
}; };
use satrs::spacepackets::ecss::tc::PusTcReader; use satrs::spacepackets::ecss::tc::PusTcReader;
use satrs::spacepackets::ecss::{PusPacket, PusServiceId}; use satrs::spacepackets::ecss::{PusPacket, PusServiceId};
@@ -19,7 +19,7 @@ use super::{DirectPusService, HandlingStatus};
pub fn create_test_service( pub fn create_test_service(
tm_sender: TmTcSender, tm_sender: TmTcSender,
tc_in_mem_converter: EcssTcInMemConverter, tc_in_mem_converter: EcssTcInMemConverterWrapper,
event_sender: mpsc::SyncSender<EventMessageU32>, event_sender: mpsc::SyncSender<EventMessageU32>,
pus_test_rx: mpsc::Receiver<EcssTcAndToken>, pus_test_rx: mpsc::Receiver<EcssTcAndToken>,
) -> TestCustomServiceWrapper { ) -> TestCustomServiceWrapper {
@@ -40,7 +40,7 @@ pub struct TestCustomServiceWrapper {
pub handler: PusService17TestHandler< pub handler: PusService17TestHandler<
MpscTcReceiver, MpscTcReceiver,
TmTcSender, TmTcSender,
EcssTcInMemConverter, EcssTcInMemConverterWrapper,
VerificationReporter, VerificationReporter,
>, >,
pub event_tx: mpsc::SyncSender<EventMessageU32>, pub event_tx: mpsc::SyncSender<EventMessageU32>,

View File

@@ -8,7 +8,7 @@ use satrs::mode::ModeRequest;
use satrs::pus::verification::{ use satrs::pus::verification::{
FailParams, TcStateAccepted, VerificationReportingProvider, VerificationToken, FailParams, TcStateAccepted, VerificationReportingProvider, VerificationToken,
}; };
use satrs::pus::{ActiveRequestProvider, EcssTmSender, GenericRoutingError, PusRequestRouter}; use satrs::pus::{ActiveRequest, EcssTmSender, GenericRoutingError, PusRequestRouter};
use satrs::queue::GenericSendError; use satrs::queue::GenericSendError;
use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId}; use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId};
use satrs::spacepackets::ecss::tc::PusTcReader; use satrs::spacepackets::ecss::tc::PusTcReader;
@@ -46,7 +46,7 @@ impl Default for GenericRequestRouter {
impl GenericRequestRouter { impl GenericRequestRouter {
pub(crate) fn handle_error_generic( pub(crate) fn handle_error_generic(
&self, &self,
active_request: &impl ActiveRequestProvider, active_request: &impl ActiveRequest,
tc: &PusTcReader, tc: &PusTcReader,
error: GenericRoutingError, error: GenericRoutingError,
tm_sender: &(impl EcssTmSender + ?Sized), tm_sender: &(impl EcssTmSender + ?Sized),

View File

@@ -10,6 +10,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Bump `sat-rs` edition to 2024. - Bump `sat-rs` edition to 2024.
## Changed
Some trait renaming to be more in-line with Rust naming conventions.
- `EventTmHookProvider` -> `EventTmHook`
- `ActiveRequestProvider` -> `ActiveRequest`
- `EcssTcInMemConversionProvider` -> `CacheAndReadRawEcssTc`
- `ActiveRequestMapProvider` -> `ActiveRequestStore`
- `CountdownProvider` -> `Countdown`
# [v0.3.0-alpha.2] 2025-07-22 # [v0.3.0-alpha.2] 2025-07-22
`satrs-shared` update `satrs-shared` update

View File

@@ -71,18 +71,14 @@ pub enum ListenerKey {
} }
#[derive(Debug)] #[derive(Debug)]
pub struct EventMessage<Event: GenericEvent, ParamProvider: Debug = Params> { pub struct EventMessage<Event: GenericEvent, Parameters: Debug = Params> {
sender_id: ComponentId, sender_id: ComponentId,
event: Event, event: Event,
params: Option<ParamProvider>, params: Option<Parameters>,
} }
impl<Event: GenericEvent, ParamProvider: Debug + Clone> EventMessage<Event, ParamProvider> { impl<Event: GenericEvent, Parameters: Debug + Clone> EventMessage<Event, Parameters> {
pub fn new_generic( pub fn new_generic(sender_id: ComponentId, event: Event, params: Option<&Parameters>) -> Self {
sender_id: ComponentId,
event: Event,
params: Option<&ParamProvider>,
) -> Self {
Self { Self {
sender_id, sender_id,
event, event,
@@ -98,7 +94,7 @@ impl<Event: GenericEvent, ParamProvider: Debug + Clone> EventMessage<Event, Para
self.event self.event
} }
pub fn params(&self) -> Option<&ParamProvider> { pub fn params(&self) -> Option<&Parameters> {
self.params.as_ref() self.params.as_ref()
} }
@@ -106,7 +102,7 @@ impl<Event: GenericEvent, ParamProvider: Debug + Clone> EventMessage<Event, Para
Self::new_generic(sender_id, event, None) Self::new_generic(sender_id, event, None)
} }
pub fn new_with_params(sender_id: ComponentId, event: Event, params: &ParamProvider) -> Self { pub fn new_with_params(sender_id: ComponentId, event: Event, params: &Parameters) -> Self {
Self::new_generic(sender_id, event, Some(params)) Self::new_generic(sender_id, event, Some(params))
} }
} }

View File

@@ -222,7 +222,7 @@ impl Error for PoolError {
} }
} }
/// Generic trait for pool providers which provide memory pools for variable sized data. /// Generic trait for pool providers which provide memory pools for variable sized packet data.
/// ///
/// It specifies a basic API to [Self::add], [Self::modify], [Self::read] and [Self::delete] data /// It specifies a basic API to [Self::add], [Self::modify], [Self::read] and [Self::delete] data
/// in the store at its core. The API was designed so internal optimizations can be performed /// in the store at its core. The API was designed so internal optimizations can be performed

View File

@@ -143,7 +143,7 @@ pub mod std_mod {
use crate::{ use crate::{
ComponentId, ComponentId,
pus::{ pus::{
ActivePusRequestStd, ActiveRequestProvider, DefaultActiveRequestMap, ActivePusRequestStd, ActiveRequest, DefaultActiveRequestMap,
verification::{self, TcStateToken}, verification::{self, TcStateToken},
}, },
request::{MessageSenderMap, OneMessageSender}, request::{MessageSenderMap, OneMessageSender},
@@ -157,7 +157,7 @@ pub mod std_mod {
common: ActivePusRequestStd, common: ActivePusRequestStd,
} }
impl ActiveRequestProvider for ActivePusActionRequestStd { impl ActiveRequest for ActivePusActionRequestStd {
delegate::delegate! { delegate::delegate! {
to self.common { to self.common {
fn target_id(&self) -> ComponentId; fn target_id(&self) -> ComponentId;

View File

@@ -139,24 +139,24 @@ mod alloc_mod {
use core::cell::RefCell; use core::cell::RefCell;
use spacepackets::ecss::PusError; use spacepackets::ecss::PusError;
pub trait EventTmHookProvider { pub trait EventTmHook {
fn modify_tm(&self, tm: &mut PusTmCreator); fn modify_tm(&self, tm: &mut PusTmCreator);
} }
#[derive(Default)] #[derive(Default)]
pub struct DummyEventHook {} pub struct DummyEventHook {}
impl EventTmHookProvider for DummyEventHook { impl EventTmHook for DummyEventHook {
fn modify_tm(&self, _tm: &mut PusTmCreator) {} fn modify_tm(&self, _tm: &mut PusTmCreator) {}
} }
pub struct EventReporter<EventTmHook: EventTmHookProvider = DummyEventHook> { pub struct EventReporter<EventTmHookInstance: EventTmHook = DummyEventHook> {
id: ComponentId, id: ComponentId,
// Use interior mutability pattern here. This is just an intermediate buffer to the PUS event packet // Use interior mutability pattern here. This is just an intermediate buffer to the PUS event packet
// generation. // generation.
source_data_buf: RefCell<Vec<u8>>, source_data_buf: RefCell<Vec<u8>>,
pub report_creator: EventReportCreator, pub report_creator: EventReportCreator,
pub tm_hook: EventTmHook, pub tm_hook: EventTmHookInstance,
} }
impl EventReporter<DummyEventHook> { impl EventReporter<DummyEventHook> {
@@ -175,13 +175,13 @@ mod alloc_mod {
}) })
} }
} }
impl<EventTmHook: EventTmHookProvider> EventReporter<EventTmHook> { impl<EventTmHookInstance: EventTmHook> EventReporter<EventTmHookInstance> {
pub fn new_with_hook( pub fn new_with_hook(
id: ComponentId, id: ComponentId,
default_apid: u16, default_apid: u16,
default_dest_id: u16, default_dest_id: u16,
max_event_id_and_aux_data_size: usize, max_event_id_and_aux_data_size: usize,
tm_hook: EventTmHook, tm_hook: EventTmHookInstance,
) -> Option<Self> { ) -> Option<Self> {
let reporter = EventReportCreator::new(default_apid, default_dest_id)?; let reporter = EventReportCreator::new(default_apid, default_dest_id)?;
Some(Self { Some(Self {

View File

@@ -102,7 +102,7 @@ pub mod alloc_mod {
use crate::{ use crate::{
events::EventU16, events::EventU16,
params::{Params, WritableToBeBytes}, params::{Params, WritableToBeBytes},
pus::event::{DummyEventHook, EventTmHookProvider}, pus::event::{DummyEventHook, EventTmHook},
}; };
use super::*; use super::*;
@@ -151,9 +151,9 @@ pub mod alloc_mod {
pub struct PusEventTmCreatorWithMap< pub struct PusEventTmCreatorWithMap<
ReportingMap: PusEventReportingMapProvider<Event>, ReportingMap: PusEventReportingMapProvider<Event>,
Event: GenericEvent, Event: GenericEvent,
EventTmHook: EventTmHookProvider = DummyEventHook, EventTmHookInstance: EventTmHook = DummyEventHook,
> { > {
pub reporter: EventReporter<EventTmHook>, pub reporter: EventReporter<EventTmHookInstance>,
reporting_map: ReportingMap, reporting_map: ReportingMap,
phantom: PhantomData<Event>, phantom: PhantomData<Event>,
} }
@@ -161,10 +161,10 @@ pub mod alloc_mod {
impl< impl<
ReportingMap: PusEventReportingMapProvider<Event>, ReportingMap: PusEventReportingMapProvider<Event>,
Event: GenericEvent, Event: GenericEvent,
EventTmHook: EventTmHookProvider, EventTmHookInstance: EventTmHook,
> PusEventTmCreatorWithMap<ReportingMap, Event, EventTmHook> > PusEventTmCreatorWithMap<ReportingMap, Event, EventTmHookInstance>
{ {
pub fn new(reporter: EventReporter<EventTmHook>, backend: ReportingMap) -> Self { pub fn new(reporter: EventReporter<EventTmHookInstance>, backend: ReportingMap) -> Self {
Self { Self {
reporter, reporter,
reporting_map: backend, reporting_map: backend,
@@ -262,10 +262,10 @@ pub mod alloc_mod {
} }
} }
impl<Event: GenericEvent + Copy + PartialEq + Eq + Hash, EventTmHook: EventTmHookProvider> impl<Event: GenericEvent + Copy + PartialEq + Eq + Hash, EventTmHookInstance: EventTmHook>
PusEventTmCreatorWithMap<DefaultPusEventReportingMap<Event>, Event, EventTmHook> PusEventTmCreatorWithMap<DefaultPusEventReportingMap<Event>, Event, EventTmHookInstance>
{ {
pub fn new_with_default_backend(reporter: EventReporter<EventTmHook>) -> Self { pub fn new_with_default_backend(reporter: EventReporter<EventTmHookInstance>) -> Self {
Self { Self {
reporter, reporter,
reporting_map: DefaultPusEventReportingMap::default(), reporting_map: DefaultPusEventReportingMap::default(),

View File

@@ -9,14 +9,14 @@ use std::sync::mpsc::Sender;
use super::verification::VerificationReportingProvider; use super::verification::VerificationReportingProvider;
use super::{ use super::{
EcssTcInMemConversionProvider, EcssTcReceiver, EcssTmSender, GenericConversionError, CacheAndReadRawEcssTc, EcssTcReceiver, EcssTmSender, GenericConversionError,
GenericRoutingError, HandlingStatus, PusServiceHelper, GenericRoutingError, HandlingStatus, PusServiceHelper,
}; };
pub struct PusEventServiceHandler< pub struct PusEventServiceHandler<
TcReceiver: EcssTcReceiver, TcReceiver: EcssTcReceiver,
TmSender: EcssTmSender, TmSender: EcssTmSender,
TcInMemConverter: EcssTcInMemConversionProvider, TcInMemConverter: CacheAndReadRawEcssTc,
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
> { > {
pub service_helper: pub service_helper:
@@ -27,7 +27,7 @@ pub struct PusEventServiceHandler<
impl< impl<
TcReceiver: EcssTcReceiver, TcReceiver: EcssTcReceiver,
TmSender: EcssTmSender, TmSender: EcssTmSender,
TcInMemConverter: EcssTcInMemConversionProvider, TcInMemConverter: CacheAndReadRawEcssTc,
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
> PusEventServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter> > PusEventServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
{ {

View File

@@ -296,7 +296,7 @@ pub trait PacketSenderPusTc: Send {
) -> Result<(), Self::Error>; ) -> Result<(), Self::Error>;
} }
pub trait ActiveRequestMapProvider<V>: Sized { pub trait ActiveRequestStore<V>: Sized {
fn insert(&mut self, request_id: &RequestId, request_info: V); fn insert(&mut self, request_id: &RequestId, request_info: V);
fn get(&self, request_id: RequestId) -> Option<&V>; fn get(&self, request_id: RequestId) -> Option<&V>;
fn get_mut(&mut self, request_id: RequestId) -> Option<&mut V>; fn get_mut(&mut self, request_id: RequestId) -> Option<&mut V>;
@@ -309,7 +309,7 @@ pub trait ActiveRequestMapProvider<V>: Sized {
fn for_each_mut<F: FnMut(&RequestId, &mut V)>(&mut self, f: F); fn for_each_mut<F: FnMut(&RequestId, &mut V)>(&mut self, f: F);
} }
pub trait ActiveRequestProvider { pub trait ActiveRequest {
fn target_id(&self) -> ComponentId; fn target_id(&self) -> ComponentId;
fn token(&self) -> TcStateToken; fn token(&self) -> TcStateToken;
fn set_token(&mut self, token: TcStateToken); fn set_token(&mut self, token: TcStateToken);
@@ -330,7 +330,7 @@ pub trait PusRequestRouter<Request> {
) -> Result<(), Self::Error>; ) -> Result<(), Self::Error>;
} }
pub trait PusReplyHandler<ActiveRequestInfo: ActiveRequestProvider, ReplyType> { pub trait PusReplyHandler<ActiveRequestInfo: ActiveRequest, ReplyType> {
type Error; type Error;
/// This function handles a reply for a given PUS request and returns whether that request /// This function handles a reply for a given PUS request and returns whether that request
@@ -459,7 +459,7 @@ pub mod alloc_mod {
/// ///
/// A [VerificationReportingProvider] instance is passed to the user to also allow handling /// A [VerificationReportingProvider] instance is passed to the user to also allow handling
/// of the verification process as part of the PUS standard requirements. /// of the verification process as part of the PUS standard requirements.
pub trait PusTcToRequestConverter<ActiveRequestInfo: ActiveRequestProvider, Request> { pub trait PusTcToRequestConverter<ActiveRequestInfo: ActiveRequest, Request> {
type Error; type Error;
fn convert( fn convert(
&mut self, &mut self,
@@ -480,7 +480,7 @@ pub mod alloc_mod {
} }
} }
impl<V> ActiveRequestMapProvider<V> for DefaultActiveRequestMap<V> { impl<V> ActiveRequestStore<V> for DefaultActiveRequestMap<V> {
fn insert(&mut self, request_id: &RequestId, request: V) { fn insert(&mut self, request_id: &RequestId, request: V) {
self.0.insert(*request_id, request); self.0.insert(*request_id, request);
} }
@@ -680,7 +680,7 @@ pub mod std_mod {
pub use cb_mod::*; pub use cb_mod::*;
use super::verification::{TcStateToken, VerificationReportingProvider}; use super::verification::{TcStateToken, VerificationReportingProvider};
use super::{AcceptedEcssTcAndToken, ActiveRequestProvider, TcInMemory}; use super::{AcceptedEcssTcAndToken, ActiveRequest, TcInMemory};
use crate::tmtc::PacketInPool; use crate::tmtc::PacketInPool;
impl From<mpsc::SendError<PoolAddr>> for EcssTmtcError { impl From<mpsc::SendError<PoolAddr>> for EcssTmtcError {
@@ -845,7 +845,7 @@ pub mod std_mod {
} }
} }
impl ActiveRequestProvider for ActivePusRequestStd { impl ActiveRequest for ActivePusRequestStd {
fn target_id(&self) -> ComponentId { fn target_id(&self) -> ComponentId {
self.target_id self.target_id
} }
@@ -947,7 +947,9 @@ pub mod std_mod {
} }
} }
pub trait EcssTcInMemConversionProvider { /// This trait provides an abstraction for caching a raw ECSS telecommand and then
/// providing the [PusTcReader] abstraction to read the cache raw telecommand.
pub trait CacheAndReadRawEcssTc {
fn cache(&mut self, possible_packet: &TcInMemory) -> Result<(), PusTcFromMemError>; fn cache(&mut self, possible_packet: &TcInMemory) -> Result<(), PusTcFromMemError>;
fn tc_slice_raw(&self) -> &[u8]; fn tc_slice_raw(&self) -> &[u8];
@@ -976,7 +978,7 @@ pub mod std_mod {
pub pus_tc_raw: Option<Vec<u8>>, pub pus_tc_raw: Option<Vec<u8>>,
} }
impl EcssTcInMemConversionProvider for EcssTcInVecConverter { impl CacheAndReadRawEcssTc for EcssTcInVecConverter {
fn cache(&mut self, tc_in_memory: &TcInMemory) -> Result<(), PusTcFromMemError> { fn cache(&mut self, tc_in_memory: &TcInMemory) -> Result<(), PusTcFromMemError> {
self.pus_tc_raw = None; self.pus_tc_raw = None;
match tc_in_memory { match tc_in_memory {
@@ -1045,7 +1047,7 @@ pub mod std_mod {
} }
} }
impl EcssTcInMemConversionProvider for EcssTcInSharedPoolConverter { impl CacheAndReadRawEcssTc for EcssTcInSharedPoolConverter {
fn cache(&mut self, tc_in_memory: &TcInMemory) -> Result<(), PusTcFromMemError> { fn cache(&mut self, tc_in_memory: &TcInMemory) -> Result<(), PusTcFromMemError> {
match tc_in_memory { match tc_in_memory {
super::TcInMemory::Pool(packet_in_pool) => { super::TcInMemory::Pool(packet_in_pool) => {
@@ -1070,38 +1072,38 @@ pub mod std_mod {
// TODO: alloc feature flag? // TODO: alloc feature flag?
#[derive(Clone)] #[derive(Clone)]
pub enum EcssTcInMemConverter { pub enum EcssTcInMemConverterWrapper {
Static(EcssTcInSharedPoolConverter), Static(EcssTcInSharedPoolConverter),
Heap(EcssTcInVecConverter), Heap(EcssTcInVecConverter),
} }
impl EcssTcInMemConverter { impl EcssTcInMemConverterWrapper {
pub fn new_static(static_store_converter: EcssTcInSharedPoolConverter) -> Self { pub fn new_static(static_store_converter: EcssTcInSharedPoolConverter) -> Self {
EcssTcInMemConverter::Static(static_store_converter) Self::Static(static_store_converter)
} }
pub fn new_heap(heap_converter: EcssTcInVecConverter) -> Self { pub fn new_heap(heap_converter: EcssTcInVecConverter) -> Self {
EcssTcInMemConverter::Heap(heap_converter) Self::Heap(heap_converter)
} }
} }
impl EcssTcInMemConversionProvider for EcssTcInMemConverter { impl CacheAndReadRawEcssTc for EcssTcInMemConverterWrapper {
fn cache(&mut self, tc_in_memory: &TcInMemory) -> Result<(), PusTcFromMemError> { fn cache(&mut self, tc_in_memory: &TcInMemory) -> Result<(), PusTcFromMemError> {
match self { match self {
EcssTcInMemConverter::Static(converter) => converter.cache(tc_in_memory), Self::Static(converter) => converter.cache(tc_in_memory),
EcssTcInMemConverter::Heap(converter) => converter.cache(tc_in_memory), Self::Heap(converter) => converter.cache(tc_in_memory),
} }
} }
fn tc_slice_raw(&self) -> &[u8] { fn tc_slice_raw(&self) -> &[u8] {
match self { match self {
EcssTcInMemConverter::Static(converter) => converter.tc_slice_raw(), Self::Static(converter) => converter.tc_slice_raw(),
EcssTcInMemConverter::Heap(converter) => converter.tc_slice_raw(), Self::Heap(converter) => converter.tc_slice_raw(),
} }
} }
fn sender_id(&self) -> Option<ComponentId> { fn sender_id(&self) -> Option<ComponentId> {
match self { match self {
EcssTcInMemConverter::Static(converter) => converter.sender_id(), Self::Static(converter) => converter.sender_id(),
EcssTcInMemConverter::Heap(converter) => converter.sender_id(), Self::Heap(converter) => converter.sender_id(),
} }
} }
} }
@@ -1129,7 +1131,7 @@ pub mod std_mod {
pub struct PusServiceHelper< pub struct PusServiceHelper<
TcReceiver: EcssTcReceiver, TcReceiver: EcssTcReceiver,
TmSender: EcssTmSender, TmSender: EcssTmSender,
TcInMemConverter: EcssTcInMemConversionProvider, TcInMemConverter: CacheAndReadRawEcssTc,
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
> { > {
pub common: PusServiceBase<TcReceiver, TmSender, VerificationReporter>, pub common: PusServiceBase<TcReceiver, TmSender, VerificationReporter>,
@@ -1139,7 +1141,7 @@ pub mod std_mod {
impl< impl<
TcReceiver: EcssTcReceiver, TcReceiver: EcssTcReceiver,
TmSender: EcssTmSender, TmSender: EcssTmSender,
TcInMemConverter: EcssTcInMemConversionProvider, TcInMemConverter: CacheAndReadRawEcssTc,
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
> PusServiceHelper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter> > PusServiceHelper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
{ {
@@ -1314,7 +1316,8 @@ pub mod tests {
use super::verification::test_util::TestVerificationReporter; use super::verification::test_util::TestVerificationReporter;
use super::verification::{ use super::verification::{
TcStateAccepted, VerificationReporterCfg, VerificationReportingProvider, VerificationToken, TcStateAccepted, VerificationReporterConfig, VerificationReportingProvider,
VerificationToken,
}; };
use super::*; use super::*;
@@ -1404,7 +1407,7 @@ pub mod tests {
let (test_srv_tc_tx, test_srv_tc_rx) = mpsc::sync_channel(10); let (test_srv_tc_tx, test_srv_tc_rx) = mpsc::sync_channel(10);
let (tm_tx, tm_rx) = mpsc::sync_channel(10); let (tm_tx, tm_rx) = mpsc::sync_channel(10);
let verif_cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap(); let verif_cfg = VerificationReporterConfig::new(TEST_APID, 1, 2, 8).unwrap();
let verification_handler = let verification_handler =
VerificationReporter::new(TEST_COMPONENT_ID_0.id(), &verif_cfg); VerificationReporter::new(TEST_COMPONENT_ID_0.id(), &verif_cfg);
let test_srv_tm_sender = let test_srv_tm_sender =
@@ -1501,7 +1504,7 @@ pub mod tests {
let (test_srv_tc_tx, test_srv_tc_rx) = mpsc::channel(); let (test_srv_tc_tx, test_srv_tc_rx) = mpsc::channel();
let (tm_tx, tm_rx) = mpsc::channel(); let (tm_tx, tm_rx) = mpsc::channel();
let verif_cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap(); let verif_cfg = VerificationReporterConfig::new(TEST_APID, 1, 2, 8).unwrap();
let verification_handler = let verification_handler =
VerificationReporter::new(TEST_COMPONENT_ID_0.id(), &verif_cfg); VerificationReporter::new(TEST_COMPONENT_ID_0.id(), &verif_cfg);
let in_store_converter = EcssTcInVecConverter::default(); let in_store_converter = EcssTcInVecConverter::default();

View File

@@ -878,22 +878,22 @@ mod tests {
) )
} }
fn scheduled_tc(timestamp: UnixTime, buf: &mut [u8]) -> PusTcCreator { fn scheduled_tc(timestamp: UnixTime, buf: &mut [u8]) -> PusTcCreator<'_> {
let (sph, len_app_data) = pus_tc_base(timestamp, buf); let (sph, len_app_data) = pus_tc_base(timestamp, buf);
PusTcCreator::new_simple(sph, 11, 4, &buf[..len_app_data], true) PusTcCreator::new_simple(sph, 11, 4, &buf[..len_app_data], true)
} }
fn wrong_tc_service(timestamp: UnixTime, buf: &mut [u8]) -> PusTcCreator { fn wrong_tc_service(timestamp: UnixTime, buf: &mut [u8]) -> PusTcCreator<'_> {
let (sph, len_app_data) = pus_tc_base(timestamp, buf); let (sph, len_app_data) = pus_tc_base(timestamp, buf);
PusTcCreator::new_simple(sph, 12, 4, &buf[..len_app_data], true) PusTcCreator::new_simple(sph, 12, 4, &buf[..len_app_data], true)
} }
fn wrong_tc_subservice(timestamp: UnixTime, buf: &mut [u8]) -> PusTcCreator { fn wrong_tc_subservice(timestamp: UnixTime, buf: &mut [u8]) -> PusTcCreator<'_> {
let (sph, len_app_data) = pus_tc_base(timestamp, buf); let (sph, len_app_data) = pus_tc_base(timestamp, buf);
PusTcCreator::new_simple(sph, 11, 5, &buf[..len_app_data], true) PusTcCreator::new_simple(sph, 11, 5, &buf[..len_app_data], true)
} }
fn double_wrapped_time_tagged_tc(timestamp: UnixTime, buf: &mut [u8]) -> PusTcCreator { fn double_wrapped_time_tagged_tc(timestamp: UnixTime, buf: &mut [u8]) -> PusTcCreator<'_> {
let cds_time = let cds_time =
cds::CdsTime::from_unix_time_with_u16_days(&timestamp, cds::SubmillisPrecision::Absent) cds::CdsTime::from_unix_time_with_u16_days(&timestamp, cds::SubmillisPrecision::Absent)
.unwrap(); .unwrap();

View File

@@ -1,7 +1,7 @@
use super::scheduler::PusSchedulerProvider; use super::scheduler::PusSchedulerProvider;
use super::verification::{VerificationReporter, VerificationReportingProvider}; use super::verification::{VerificationReporter, VerificationReportingProvider};
use super::{ use super::{
DirectPusPacketHandlerResult, EcssTcInMemConversionProvider, EcssTcInSharedPoolConverter, CacheAndReadRawEcssTc, DirectPusPacketHandlerResult, EcssTcInSharedPoolConverter,
EcssTcInVecConverter, EcssTcReceiver, EcssTmSender, HandlingStatus, MpscTcReceiver, EcssTcInVecConverter, EcssTcReceiver, EcssTmSender, HandlingStatus, MpscTcReceiver,
PartialPusHandlingError, PusServiceHelper, PartialPusHandlingError, PusServiceHelper,
}; };
@@ -24,7 +24,7 @@ use std::sync::mpsc;
pub struct PusSchedServiceHandler< pub struct PusSchedServiceHandler<
TcReceiver: EcssTcReceiver, TcReceiver: EcssTcReceiver,
TmSender: EcssTmSender, TmSender: EcssTmSender,
TcInMemConverter: EcssTcInMemConversionProvider, TcInMemConverter: CacheAndReadRawEcssTc,
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
PusScheduler: PusSchedulerProvider, PusScheduler: PusSchedulerProvider,
> { > {
@@ -36,7 +36,7 @@ pub struct PusSchedServiceHandler<
impl< impl<
TcReceiver: EcssTcReceiver, TcReceiver: EcssTcReceiver,
TmSender: EcssTmSender, TmSender: EcssTmSender,
TcInMemConverter: EcssTcInMemConversionProvider, TcInMemConverter: CacheAndReadRawEcssTc,
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
Scheduler: PusSchedulerProvider, Scheduler: PusSchedulerProvider,
> PusSchedServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter, Scheduler> > PusSchedServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter, Scheduler>

View File

@@ -9,9 +9,8 @@ use std::sync::mpsc;
use super::verification::{VerificationReporter, VerificationReportingProvider}; use super::verification::{VerificationReporter, VerificationReportingProvider};
use super::{ use super::{
EcssTcInMemConversionProvider, EcssTcInSharedPoolConverter, EcssTcInVecConverter, CacheAndReadRawEcssTc, EcssTcInSharedPoolConverter, EcssTcInVecConverter, EcssTcReceiver,
EcssTcReceiver, EcssTmSender, GenericConversionError, HandlingStatus, MpscTcReceiver, EcssTmSender, GenericConversionError, HandlingStatus, MpscTcReceiver, PusServiceHelper,
PusServiceHelper,
}; };
/// 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.
@@ -19,7 +18,7 @@ use super::{
pub struct PusService17TestHandler< pub struct PusService17TestHandler<
TcReceiver: EcssTcReceiver, TcReceiver: EcssTcReceiver,
TmSender: EcssTmSender, TmSender: EcssTmSender,
TcInMemConverter: EcssTcInMemConversionProvider, TcInMemConverter: CacheAndReadRawEcssTc,
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
> { > {
pub service_helper: pub service_helper:
@@ -29,7 +28,7 @@ pub struct PusService17TestHandler<
impl< impl<
TcReceiver: EcssTcReceiver, TcReceiver: EcssTcReceiver,
TmSender: EcssTmSender, TmSender: EcssTmSender,
TcInMemConverter: EcssTcInMemConversionProvider, TcInMemConverter: CacheAndReadRawEcssTc,
VerificationReporter: VerificationReportingProvider, VerificationReporter: VerificationReportingProvider,
> PusService17TestHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter> > PusService17TestHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
{ {

View File

@@ -17,7 +17,7 @@
//! use std::time::Duration; //! use std::time::Duration;
//! use satrs::pool::{PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig}; //! use satrs::pool::{PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig};
//! use satrs::pus::verification::{ //! use satrs::pus::verification::{
//! VerificationReportingProvider, VerificationReporterCfg, VerificationReporter //! VerificationReportingProvider, VerificationReporterConfig, VerificationReporter
//! }; //! };
//! use satrs::tmtc::{SharedStaticMemoryPool, PacketSenderWithSharedPool}; //! use satrs::tmtc::{SharedStaticMemoryPool, PacketSenderWithSharedPool};
//! use satrs::spacepackets::seq_count::SeqCountProviderSimple; //! use satrs::spacepackets::seq_count::SeqCountProviderSimple;
@@ -38,7 +38,7 @@
//! let shared_tm_pool = SharedStaticMemoryPool::new(RwLock::new(tm_pool)); //! let shared_tm_pool = SharedStaticMemoryPool::new(RwLock::new(tm_pool));
//! let (verif_tx, verif_rx) = mpsc::sync_channel(10); //! let (verif_tx, verif_rx) = mpsc::sync_channel(10);
//! let sender = PacketSenderWithSharedPool::new_with_shared_packet_pool(verif_tx, &shared_tm_pool); //! let sender = PacketSenderWithSharedPool::new_with_shared_packet_pool(verif_tx, &shared_tm_pool);
//! let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap(); //! let cfg = VerificationReporterConfig::new(TEST_APID, 1, 2, 8).unwrap();
//! let mut reporter = VerificationReporter::new(TEST_COMPONENT_ID.id(), &cfg); //! let mut reporter = VerificationReporter::new(TEST_COMPONENT_ID.id(), &cfg);
//! //!
//! let tc_header = PusTcSecondaryHeader::new_simple(17, 1); //! let tc_header = PusTcSecondaryHeader::new_simple(17, 1);
@@ -846,14 +846,14 @@ pub mod alloc_mod {
use core::cell::RefCell; use core::cell::RefCell;
#[derive(Clone)] #[derive(Clone)]
pub struct VerificationReporterCfg { pub struct VerificationReporterConfig {
apid: u16, apid: u16,
pub step_field_width: usize, pub step_field_width: usize,
pub fail_code_field_width: usize, pub fail_code_field_width: usize,
pub max_fail_data_len: usize, pub max_fail_data_len: usize,
} }
impl VerificationReporterCfg { impl VerificationReporterConfig {
pub fn new( pub fn new(
apid: u16, apid: u16,
step_field_width: usize, step_field_width: usize,
@@ -876,7 +876,7 @@ pub mod alloc_mod {
/// ///
/// The [Self::modify_tm] function is called before the TM is sent. This allows users to change /// The [Self::modify_tm] function is called before the TM is sent. This allows users to change
/// fields like the message count or sequence counter before the TM is sent. /// fields like the message count or sequence counter before the TM is sent.
pub trait VerificationHookProvider { pub trait VerificationHook {
fn modify_tm(&self, tm: &mut PusTmCreator); fn modify_tm(&self, tm: &mut PusTmCreator);
} }
@@ -886,7 +886,7 @@ pub mod alloc_mod {
#[derive(Default, Copy, Clone)] #[derive(Default, Copy, Clone)]
pub struct DummyVerificationHook {} pub struct DummyVerificationHook {}
impl VerificationHookProvider for DummyVerificationHook { impl VerificationHook for DummyVerificationHook {
fn modify_tm(&self, _tm: &mut PusTmCreator) {} fn modify_tm(&self, _tm: &mut PusTmCreator) {}
} }
@@ -899,16 +899,16 @@ pub mod alloc_mod {
/// destination fields are assumed to be constant for a given repoter instance. /// destination fields are assumed to be constant for a given repoter instance.
#[derive(Clone)] #[derive(Clone)]
pub struct VerificationReporter< pub struct VerificationReporter<
VerificationHook: VerificationHookProvider = DummyVerificationHook, VerificationHookInstance: VerificationHook = DummyVerificationHook,
> { > {
owner_id: ComponentId, owner_id: ComponentId,
source_data_buf: RefCell<alloc::vec::Vec<u8>>, source_data_buf: RefCell<alloc::vec::Vec<u8>>,
pub reporter_creator: VerificationReportCreator, pub reporter_creator: VerificationReportCreator,
pub tm_hook: VerificationHook, pub tm_hook: VerificationHookInstance,
} }
impl VerificationReporter<DummyVerificationHook> { impl VerificationReporter<DummyVerificationHook> {
pub fn new(owner_id: ComponentId, cfg: &VerificationReporterCfg) -> Self { pub fn new(owner_id: ComponentId, cfg: &VerificationReporterConfig) -> Self {
let reporter = VerificationReportCreator::new(cfg.apid).unwrap(); let reporter = VerificationReportCreator::new(cfg.apid).unwrap();
Self { Self {
owner_id, owner_id,
@@ -925,13 +925,13 @@ pub mod alloc_mod {
} }
} }
impl<VerificationHook: VerificationHookProvider> VerificationReporter<VerificationHook> { impl<VerificationHookInstance: VerificationHook> VerificationReporter<VerificationHookInstance> {
/// The provided [VerificationHookProvider] can be used to modify a verification packet /// The provided [VerificationHookProvider] can be used to modify a verification packet
/// before it is sent. /// before it is sent.
pub fn new_with_hook( pub fn new_with_hook(
owner_id: ComponentId, owner_id: ComponentId,
cfg: &VerificationReporterCfg, cfg: &VerificationReporterConfig,
tm_hook: VerificationHook, tm_hook: VerificationHookInstance,
) -> Self { ) -> Self {
let reporter = VerificationReportCreator::new(cfg.apid).unwrap(); let reporter = VerificationReportCreator::new(cfg.apid).unwrap();
Self { Self {
@@ -978,8 +978,8 @@ pub mod alloc_mod {
} }
} }
impl<VerificationHook: VerificationHookProvider> VerificationReportingProvider impl<VerificationHookInstance: VerificationHook> VerificationReportingProvider
for VerificationReporter<VerificationHook> for VerificationReporter<VerificationHookInstance>
{ {
delegate!( delegate!(
to self.reporter_creator { to self.reporter_creator {
@@ -1693,7 +1693,7 @@ pub mod tests {
use crate::pus::tests::CommonTmInfo; use crate::pus::tests::CommonTmInfo;
use crate::pus::verification::{ use crate::pus::verification::{
EcssTmSender, EcssTmtcError, FailParams, FailParamsWithStep, RequestId, TcStateNone, EcssTmSender, EcssTmtcError, FailParams, FailParamsWithStep, RequestId, TcStateNone,
VerificationReporter, VerificationReporterCfg, VerificationToken, VerificationReporter, VerificationReporterConfig, VerificationToken,
handle_step_failure_with_generic_params, handle_step_failure_with_generic_params,
}; };
use crate::pus::{ChannelWithId, PusTmVariant}; use crate::pus::{ChannelWithId, PusTmVariant};
@@ -1717,8 +1717,8 @@ pub mod tests {
use super::{ use super::{
DummyVerificationHook, FailParamHelper, SeqCountProviderSimple, TcStateAccepted, DummyVerificationHook, FailParamHelper, SeqCountProviderSimple, TcStateAccepted,
TcStateStarted, VerificationHookProvider, VerificationReportingProvider, TcStateStarted, VerificationHook, VerificationReportingProvider, WasAtLeastAccepted,
WasAtLeastAccepted, handle_completion_failure_with_generic_params, handle_completion_failure_with_generic_params,
}; };
fn is_send<T: Send>(_: &T) {} fn is_send<T: Send>(_: &T) {}
@@ -1787,7 +1787,7 @@ pub mod tests {
pub msg_counter: SeqCountProviderSimple<u16>, pub msg_counter: SeqCountProviderSimple<u16>,
} }
impl VerificationHookProvider for SequenceCounterHook { impl VerificationHook for SequenceCounterHook {
fn modify_tm(&self, tm: &mut spacepackets::ecss::tm::PusTmCreator) { fn modify_tm(&self, tm: &mut spacepackets::ecss::tm::PusTmCreator) {
tm.set_seq_count(self.seq_counter.get_and_increment()); tm.set_seq_count(self.seq_counter.get_and_increment());
tm.set_msg_counter(self.msg_counter.get_and_increment()); tm.set_msg_counter(self.msg_counter.get_and_increment());
@@ -1795,29 +1795,29 @@ pub mod tests {
} }
struct VerificationReporterTestbench< struct VerificationReporterTestbench<
VerificationHook: VerificationHookProvider = DummyVerificationHook, VerificationHookInstance: VerificationHook = DummyVerificationHook,
> { > {
pub id: ComponentId, pub id: ComponentId,
sender: TestSender, sender: TestSender,
reporter: VerificationReporter<VerificationHook>, reporter: VerificationReporter<VerificationHookInstance>,
pub request_id: RequestId, pub request_id: RequestId,
tc: Vec<u8>, tc: Vec<u8>,
} }
fn base_reporter(id: ComponentId, max_fail_data_len: usize) -> VerificationReporter { fn base_reporter(id: ComponentId, max_fail_data_len: usize) -> VerificationReporter {
let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, max_fail_data_len).unwrap(); let cfg = VerificationReporterConfig::new(TEST_APID, 1, 2, max_fail_data_len).unwrap();
VerificationReporter::new(id, &cfg) VerificationReporter::new(id, &cfg)
} }
fn reporter_with_hook<VerificationHook: VerificationHookProvider>( fn reporter_with_hook<VerificationHookInstance: VerificationHook>(
id: ComponentId, id: ComponentId,
hook: VerificationHook, hook: VerificationHookInstance,
) -> VerificationReporter<VerificationHook> { ) -> VerificationReporter<VerificationHookInstance> {
let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap(); let cfg = VerificationReporterConfig::new(TEST_APID, 1, 2, 8).unwrap();
VerificationReporter::new_with_hook(id, &cfg, hook) VerificationReporter::new_with_hook(id, &cfg, hook)
} }
impl<VerificiationHook: VerificationHookProvider> VerificationReporterTestbench<VerificiationHook> { impl<VerificiationHook: VerificationHook> VerificationReporterTestbench<VerificiationHook> {
fn new_with_hook(id: ComponentId, tc: PusTcCreator, tm_hook: VerificiationHook) -> Self { fn new_with_hook(id: ComponentId, tc: PusTcCreator, tm_hook: VerificiationHook) -> Self {
let reporter = reporter_with_hook(id, tm_hook); let reporter = reporter_with_hook(id, tm_hook);
Self { Self {

View File

@@ -1,7 +1,7 @@
use core::fmt::Debug; use core::fmt::Debug;
/// Generic abstraction for a check/countdown timer. /// Generic abstraction for a check/countdown timer.
pub trait CountdownProvider: Debug { pub trait Countdown: Debug {
fn has_expired(&self) -> bool; fn has_expired(&self) -> bool;
fn reset(&mut self); fn reset(&mut self);
} }

View File

@@ -4,7 +4,7 @@ pub mod crossbeam_test {
use satrs::pool::{PoolProvider, PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig}; use satrs::pool::{PoolProvider, PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig};
use satrs::pus::test_util::{TEST_APID, TEST_COMPONENT_ID_0}; use satrs::pus::test_util::{TEST_APID, TEST_COMPONENT_ID_0};
use satrs::pus::verification::{ use satrs::pus::verification::{
FailParams, RequestId, VerificationReporter, VerificationReporterCfg, FailParams, RequestId, VerificationReporter, VerificationReporterConfig,
VerificationReportingProvider, VerificationReportingProvider,
}; };
use satrs::tmtc::{PacketSenderWithSharedPool, SharedStaticMemoryPool}; use satrs::tmtc::{PacketSenderWithSharedPool, SharedStaticMemoryPool};
@@ -31,7 +31,7 @@ pub mod crossbeam_test {
// We use a synced sequence count provider here because both verification reporters have the // We use a synced sequence count provider here because both verification reporters have the
// the same APID. If they had distinct APIDs, the more correct approach would be to have // the same APID. If they had distinct APIDs, the more correct approach would be to have
// each reporter have an own sequence count provider. // each reporter have an own sequence count provider.
let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap(); let cfg = VerificationReporterConfig::new(TEST_APID, 1, 2, 8).unwrap();
// Shared pool object to store the verification PUS telemetry // Shared pool object to store the verification PUS telemetry
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples( let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(
vec![(10, 32), (10, 64), (10, 128), (10, 1024)], vec![(10, 32), (10, 64), (10, 128), (10, 1024)],