Merge pull request 'update trait names' (#247) from update-trait-names into main
Reviewed-on: #247
This commit is contained in:
@@ -2,7 +2,7 @@ use std::sync::mpsc::{self};
|
||||
|
||||
use crate::pus::create_verification_reporter;
|
||||
use satrs::event_man::{EventMessageU32, EventRoutingError};
|
||||
use satrs::pus::event::EventTmHookProvider;
|
||||
use satrs::pus::event::EventTmHook;
|
||||
use satrs::pus::verification::VerificationReporter;
|
||||
use satrs::pus::EcssTmSender;
|
||||
use satrs::request::UniqueApidTargetId;
|
||||
@@ -26,7 +26,7 @@ pub struct EventApidSetter {
|
||||
pub next_apid: u16,
|
||||
}
|
||||
|
||||
impl EventTmHookProvider for EventApidSetter {
|
||||
impl EventTmHook for EventApidSetter {
|
||||
fn modify_tm(&self, tm: &mut satrs::spacepackets::ecss::tm::PusTmCreator) {
|
||||
tm.set_apid(self.next_apid);
|
||||
}
|
||||
@@ -219,7 +219,7 @@ impl<TmSender: EcssTmSender> EventHandler<TmSender> {
|
||||
mod tests {
|
||||
use satrs::{
|
||||
events::EventU32,
|
||||
pus::verification::VerificationReporterCfg,
|
||||
pus::verification::VerificationReporterConfig,
|
||||
spacepackets::{
|
||||
ecss::{tm::PusTmReader, PusPacket},
|
||||
CcsdsPacket,
|
||||
@@ -244,7 +244,7 @@ mod tests {
|
||||
let (event_tx, event_rx) = mpsc::sync_channel(10);
|
||||
let (_event_req_tx, event_req_rx) = mpsc::sync_channel(10);
|
||||
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 =
|
||||
VerificationReporter::new(PUS_EVENT_MANAGEMENT.id(), &verif_reporter_cfg);
|
||||
let mut event_manager = EventManagerWithBoundedMpsc::new(event_rx);
|
||||
|
@@ -33,7 +33,7 @@ use satrs::{
|
||||
hal::std::{tcp_server::ServerConfig, udp_server::UdpTcServer},
|
||||
mode::{Mode, ModeAndSubmode, ModeRequest, ModeRequestHandlerMpscBounded},
|
||||
mode_tree::connect_mode_nodes,
|
||||
pus::{event_man::EventRequestWithToken, EcssTcInMemConverter, HandlingStatus},
|
||||
pus::{event_man::EventRequestWithToken, EcssTcInMemConverterWrapper, HandlingStatus},
|
||||
request::{GenericMessage, MessageMetadata},
|
||||
spacepackets::time::{cds::CdsTime, TimeWriter},
|
||||
};
|
||||
@@ -145,7 +145,7 @@ fn main() {
|
||||
let tc_in_mem_converter =
|
||||
EcssTcInMemConverter::Static(EcssTcInSharedPoolConverter::new(shared_tc_pool, 4096));
|
||||
} else if #[cfg(feature = "heap_tmtc")] {
|
||||
let tc_in_mem_converter = EcssTcInMemConverter::Heap(EcssTcInVecConverter::default());
|
||||
let tc_in_mem_converter = EcssTcInMemConverterWrapper::Heap(EcssTcInVecConverter::default());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,7 @@ use satrs::pus::verification::{
|
||||
VerificationReportingProvider, VerificationToken,
|
||||
};
|
||||
use satrs::pus::{
|
||||
ActiveRequestProvider, EcssTcAndToken, EcssTcInMemConverter, EcssTmSender, EcssTmtcError,
|
||||
ActiveRequest, EcssTcAndToken, EcssTcInMemConverterWrapper, EcssTmSender, EcssTmtcError,
|
||||
GenericConversionError, MpscTcReceiver, PusPacketHandlingError, PusReplyHandler,
|
||||
PusServiceHelper, PusTcToRequestConverter,
|
||||
};
|
||||
@@ -208,7 +208,7 @@ impl PusTcToRequestConverter<ActivePusActionRequestStd, ActionRequest> for Actio
|
||||
|
||||
pub fn create_action_service(
|
||||
tm_sender: TmTcSender,
|
||||
tc_in_mem_converter: EcssTcInMemConverter,
|
||||
tc_in_mem_converter: EcssTcInMemConverterWrapper,
|
||||
pus_action_rx: mpsc::Receiver<EcssTcAndToken>,
|
||||
action_router: GenericRequestRouter,
|
||||
reply_receiver: mpsc::Receiver<GenericMessage<ActionReplyPus>>,
|
||||
@@ -325,7 +325,7 @@ mod tests {
|
||||
pus_action_rx,
|
||||
TmTcSender::Heap(tm_funnel_tx.clone()),
|
||||
verif_reporter,
|
||||
EcssTcInMemConverter::Heap(EcssTcInVecConverter::default()),
|
||||
EcssTcInMemConverterWrapper::Heap(EcssTcInVecConverter::default()),
|
||||
),
|
||||
ActionRequestConverter::default(),
|
||||
DefaultActiveActionRequestMap::default(),
|
||||
|
@@ -6,7 +6,7 @@ use satrs::pus::event_man::EventRequestWithToken;
|
||||
use satrs::pus::event_srv::PusEventServiceHandler;
|
||||
use satrs::pus::verification::VerificationReporter;
|
||||
use satrs::pus::{
|
||||
DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConverter, MpscTcReceiver,
|
||||
DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConverterWrapper, MpscTcReceiver,
|
||||
PartialPusHandlingError, PusServiceHelper,
|
||||
};
|
||||
use satrs::spacepackets::ecss::PusServiceId;
|
||||
@@ -16,7 +16,7 @@ use super::{DirectPusService, HandlingStatus};
|
||||
|
||||
pub fn create_event_service(
|
||||
tm_sender: TmTcSender,
|
||||
tm_in_pool_converter: EcssTcInMemConverter,
|
||||
tm_in_pool_converter: EcssTcInMemConverterWrapper,
|
||||
pus_event_rx: mpsc::Receiver<EcssTcAndToken>,
|
||||
event_request_tx: mpsc::Sender<EventRequestWithToken>,
|
||||
) -> EventServiceWrapper {
|
||||
@@ -39,7 +39,7 @@ pub struct EventServiceWrapper {
|
||||
pub handler: PusEventServiceHandler<
|
||||
MpscTcReceiver,
|
||||
TmTcSender,
|
||||
EcssTcInMemConverter,
|
||||
EcssTcInMemConverterWrapper,
|
||||
VerificationReporter,
|
||||
>,
|
||||
}
|
||||
|
@@ -5,9 +5,10 @@ use satrs::pus::verification::{
|
||||
VerificationReportingProvider, VerificationToken,
|
||||
};
|
||||
use satrs::pus::{
|
||||
ActivePusRequestStd, ActiveRequestProvider, DefaultActiveRequestMap, EcssTcAndToken,
|
||||
EcssTcInMemConverter, EcssTmSender, EcssTmtcError, GenericConversionError, MpscTcReceiver,
|
||||
PusPacketHandlingError, PusReplyHandler, PusServiceHelper, PusTcToRequestConverter,
|
||||
ActivePusRequestStd, ActiveRequest, DefaultActiveRequestMap, EcssTcAndToken,
|
||||
EcssTcInMemConverterWrapper, EcssTmSender, EcssTmtcError, GenericConversionError,
|
||||
MpscTcReceiver, PusPacketHandlingError, PusReplyHandler, PusServiceHelper,
|
||||
PusTcToRequestConverter,
|
||||
};
|
||||
use satrs::request::{GenericMessage, UniqueApidTargetId};
|
||||
use satrs::res_code::ResultU16;
|
||||
@@ -242,7 +243,7 @@ impl PusTcToRequestConverter<ActivePusRequestStd, HkRequest> for HkRequestConver
|
||||
|
||||
pub fn create_hk_service(
|
||||
tm_sender: TmTcSender,
|
||||
tc_in_mem_converter: EcssTcInMemConverter,
|
||||
tc_in_mem_converter: EcssTcInMemConverterWrapper,
|
||||
pus_hk_rx: mpsc::Receiver<EcssTcAndToken>,
|
||||
request_router: GenericRequestRouter,
|
||||
reply_receiver: mpsc::Receiver<GenericMessage<HkReply>>,
|
||||
|
@@ -4,13 +4,13 @@ use log::warn;
|
||||
use satrs::pool::PoolAddr;
|
||||
use satrs::pus::verification::{
|
||||
self, FailParams, TcStateAccepted, TcStateStarted, VerificationReporter,
|
||||
VerificationReporterCfg, VerificationReportingProvider, VerificationToken,
|
||||
VerificationReporterConfig, VerificationReportingProvider, VerificationToken,
|
||||
};
|
||||
use satrs::pus::{
|
||||
ActiveRequestMapProvider, ActiveRequestProvider, EcssTcAndToken, EcssTcInMemConversionProvider,
|
||||
EcssTcInMemConverter, EcssTcReceiver, EcssTmSender, EcssTmtcError, GenericConversionError,
|
||||
GenericRoutingError, HandlingStatus, PusPacketHandlingError, PusReplyHandler, PusRequestRouter,
|
||||
PusServiceHelper, PusTcToRequestConverter, TcInMemory,
|
||||
ActiveRequest, ActiveRequestStore, CacheAndReadRawEcssTc, EcssTcAndToken,
|
||||
EcssTcInMemConverterWrapper, EcssTcReceiver, EcssTmSender, EcssTmtcError,
|
||||
GenericConversionError, GenericRoutingError, HandlingStatus, PusPacketHandlingError,
|
||||
PusReplyHandler, PusRequestRouter, PusServiceHelper, PusTcToRequestConverter, TcInMemory,
|
||||
};
|
||||
use satrs::queue::{GenericReceiveError, GenericSendError};
|
||||
use satrs::request::{Apid, GenericMessage, MessageMetadata};
|
||||
@@ -33,7 +33,7 @@ pub mod stack;
|
||||
pub mod test;
|
||||
|
||||
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
|
||||
// verification reporter.
|
||||
VerificationReporter::new(owner_id, &verif_cfg)
|
||||
@@ -269,16 +269,16 @@ pub struct PusTargetedRequestService<
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>,
|
||||
ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>,
|
||||
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestInfo>,
|
||||
ActiveRequestInfo: ActiveRequestProvider,
|
||||
ActiveRequestMapInstance: ActiveRequestStore<ActiveRequestInfo>,
|
||||
ActiveRequestInfo: ActiveRequest,
|
||||
RequestType,
|
||||
ReplyType,
|
||||
> {
|
||||
pub service_helper:
|
||||
PusServiceHelper<TcReceiver, TmTcSender, EcssTcInMemConverter, VerificationReporter>,
|
||||
PusServiceHelper<TcReceiver, TmTcSender, EcssTcInMemConverterWrapper, VerificationReporter>,
|
||||
pub request_router: GenericRequestRouter,
|
||||
pub request_converter: RequestConverter,
|
||||
pub active_request_map: ActiveRequestMap,
|
||||
pub active_request_map: ActiveRequestMapInstance,
|
||||
pub reply_handler: ReplyHandler,
|
||||
pub reply_receiver: mpsc::Receiver<GenericMessage<ReplyType>>,
|
||||
phantom: std::marker::PhantomData<(RequestType, ActiveRequestInfo, ReplyType)>,
|
||||
@@ -289,8 +289,8 @@ impl<
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>,
|
||||
ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>,
|
||||
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestInfo>,
|
||||
ActiveRequestInfo: ActiveRequestProvider,
|
||||
ActiveRequestMapInstance: ActiveRequestStore<ActiveRequestInfo>,
|
||||
ActiveRequestInfo: ActiveRequest,
|
||||
RequestType,
|
||||
ReplyType,
|
||||
>
|
||||
@@ -299,7 +299,7 @@ impl<
|
||||
VerificationReporter,
|
||||
RequestConverter,
|
||||
ReplyHandler,
|
||||
ActiveRequestMap,
|
||||
ActiveRequestMapInstance,
|
||||
ActiveRequestInfo,
|
||||
RequestType,
|
||||
ReplyType,
|
||||
@@ -311,11 +311,11 @@ where
|
||||
service_helper: PusServiceHelper<
|
||||
TcReceiver,
|
||||
TmTcSender,
|
||||
EcssTcInMemConverter,
|
||||
EcssTcInMemConverterWrapper,
|
||||
VerificationReporter,
|
||||
>,
|
||||
request_converter: RequestConverter,
|
||||
active_request_map: ActiveRequestMap,
|
||||
active_request_map: ActiveRequestMapInstance,
|
||||
reply_hook: ReplyHandler,
|
||||
request_router: GenericRequestRouter,
|
||||
reply_receiver: mpsc::Receiver<GenericMessage<ReplyType>>,
|
||||
@@ -509,7 +509,7 @@ where
|
||||
/// and also log the error.
|
||||
pub fn generic_pus_request_timeout_handler(
|
||||
sender: &(impl EcssTmSender + ?Sized),
|
||||
active_request: &(impl ActiveRequestProvider + Debug),
|
||||
active_request: &(impl ActiveRequest + Debug),
|
||||
verification_handler: &impl VerificationReportingProvider,
|
||||
time_stamp: &[u8],
|
||||
service_str: &'static str,
|
||||
@@ -537,7 +537,7 @@ pub(crate) mod tests {
|
||||
use satrs::{
|
||||
pus::{
|
||||
verification::test_util::TestVerificationReporter, ActivePusRequestStd,
|
||||
ActiveRequestMapProvider, MpscTcReceiver,
|
||||
ActiveRequestStore, MpscTcReceiver,
|
||||
},
|
||||
request::UniqueApidTargetId,
|
||||
spacepackets::{
|
||||
@@ -556,7 +556,7 @@ pub(crate) mod tests {
|
||||
// Testbench dedicated to the testing of [PusReplyHandler]s
|
||||
pub struct ReplyHandlerTestbench<
|
||||
ReplyHandler: PusReplyHandler<ActiveRequestInfo, Reply, Error = EcssTmtcError>,
|
||||
ActiveRequestInfo: ActiveRequestProvider,
|
||||
ActiveRequestInfo: ActiveRequest,
|
||||
Reply,
|
||||
> {
|
||||
pub id: ComponentId,
|
||||
@@ -570,7 +570,7 @@ pub(crate) mod tests {
|
||||
|
||||
impl<
|
||||
ReplyHandler: PusReplyHandler<ActiveRequestInfo, Reply, Error = EcssTmtcError>,
|
||||
ActiveRequestInfo: ActiveRequestProvider,
|
||||
ActiveRequestInfo: ActiveRequest,
|
||||
Reply,
|
||||
> ReplyHandlerTestbench<ReplyHandler, ActiveRequestInfo, Reply>
|
||||
{
|
||||
@@ -671,7 +671,7 @@ pub(crate) mod tests {
|
||||
// Testbench dedicated to the testing of [PusTcToRequestConverter]s
|
||||
pub struct PusConverterTestbench<
|
||||
Converter: PusTcToRequestConverter<ActiveRequestInfo, Request, Error = GenericConversionError>,
|
||||
ActiveRequestInfo: ActiveRequestProvider,
|
||||
ActiveRequestInfo: ActiveRequest,
|
||||
Request,
|
||||
> {
|
||||
pub id: ComponentId,
|
||||
@@ -685,7 +685,7 @@ pub(crate) mod tests {
|
||||
|
||||
impl<
|
||||
Converter: PusTcToRequestConverter<ActiveRequestInfo, Request, Error = GenericConversionError>,
|
||||
ActiveRequestInfo: ActiveRequestProvider,
|
||||
ActiveRequestInfo: ActiveRequest,
|
||||
Request,
|
||||
> PusConverterTestbench<Converter, ActiveRequestInfo, Request>
|
||||
{
|
||||
@@ -751,8 +751,8 @@ pub(crate) mod tests {
|
||||
pub struct TargetedPusRequestTestbench<
|
||||
RequestConverter: PusTcToRequestConverter<ActiveRequestInfo, RequestType, Error = GenericConversionError>,
|
||||
ReplyHandler: PusReplyHandler<ActiveRequestInfo, ReplyType, Error = EcssTmtcError>,
|
||||
ActiveRequestMap: ActiveRequestMapProvider<ActiveRequestInfo>,
|
||||
ActiveRequestInfo: ActiveRequestProvider,
|
||||
ActiveRequestMapInstance: ActiveRequestStore<ActiveRequestInfo>,
|
||||
ActiveRequestInfo: ActiveRequest,
|
||||
RequestType,
|
||||
ReplyType,
|
||||
> {
|
||||
@@ -761,7 +761,7 @@ pub(crate) mod tests {
|
||||
TestVerificationReporter,
|
||||
RequestConverter,
|
||||
ReplyHandler,
|
||||
ActiveRequestMap,
|
||||
ActiveRequestMapInstance,
|
||||
ActiveRequestInfo,
|
||||
RequestType,
|
||||
ReplyType,
|
||||
|
@@ -8,7 +8,7 @@ use crate::requests::GenericRequestRouter;
|
||||
use crate::tmtc::sender::TmTcSender;
|
||||
use satrs::pus::verification::VerificationReporter;
|
||||
use satrs::pus::{
|
||||
DefaultActiveRequestMap, EcssTcAndToken, EcssTcInMemConverter, MpscTcReceiver,
|
||||
DefaultActiveRequestMap, EcssTcAndToken, EcssTcInMemConverterWrapper, MpscTcReceiver,
|
||||
PusPacketHandlingError, PusServiceHelper,
|
||||
};
|
||||
use satrs::request::GenericMessage;
|
||||
@@ -20,8 +20,8 @@ use satrs::{
|
||||
self, FailParams, TcStateAccepted, TcStateStarted, VerificationReportingProvider,
|
||||
VerificationToken,
|
||||
},
|
||||
ActivePusRequestStd, ActiveRequestProvider, EcssTmSender, EcssTmtcError,
|
||||
GenericConversionError, PusReplyHandler, PusTcToRequestConverter, PusTmVariant,
|
||||
ActivePusRequestStd, ActiveRequest, EcssTmSender, EcssTmtcError, GenericConversionError,
|
||||
PusReplyHandler, PusTcToRequestConverter, PusTmVariant,
|
||||
},
|
||||
request::UniqueApidTargetId,
|
||||
spacepackets::{
|
||||
@@ -210,7 +210,7 @@ impl PusTcToRequestConverter<ActivePusRequestStd, ModeRequest> for ModeRequestCo
|
||||
|
||||
pub fn create_mode_service(
|
||||
tm_sender: TmTcSender,
|
||||
tc_in_mem_converter: EcssTcInMemConverter,
|
||||
tc_in_mem_converter: EcssTcInMemConverterWrapper,
|
||||
pus_action_rx: mpsc::Receiver<EcssTcAndToken>,
|
||||
mode_router: GenericRequestRouter,
|
||||
reply_receiver: mpsc::Receiver<GenericMessage<ModeReply>>,
|
||||
|
@@ -9,7 +9,7 @@ use satrs::pus::scheduler::{PusScheduler, TcInfo};
|
||||
use satrs::pus::scheduler_srv::PusSchedServiceHandler;
|
||||
use satrs::pus::verification::VerificationReporter;
|
||||
use satrs::pus::{
|
||||
DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConverter, MpscTcReceiver,
|
||||
DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConverterWrapper, MpscTcReceiver,
|
||||
PartialPusHandlingError, PusServiceHelper,
|
||||
};
|
||||
use satrs::spacepackets::ecss::PusServiceId;
|
||||
@@ -84,7 +84,7 @@ pub struct SchedulingServiceWrapper {
|
||||
pub pus_11_handler: PusSchedServiceHandler<
|
||||
MpscTcReceiver,
|
||||
TmTcSender,
|
||||
EcssTcInMemConverter,
|
||||
EcssTcInMemConverterWrapper,
|
||||
VerificationReporter,
|
||||
PusScheduler,
|
||||
>,
|
||||
@@ -174,7 +174,7 @@ impl SchedulingServiceWrapper {
|
||||
|
||||
pub fn create_scheduler_service(
|
||||
tm_sender: TmTcSender,
|
||||
tc_in_mem_converter: EcssTcInMemConverter,
|
||||
tc_in_mem_converter: EcssTcInMemConverterWrapper,
|
||||
tc_releaser: TcReleaser,
|
||||
pus_sched_rx: mpsc::Receiver<EcssTcAndToken>,
|
||||
sched_tc_pool: StaticMemoryPool,
|
||||
|
@@ -6,8 +6,8 @@ use satrs::pus::test::PusService17TestHandler;
|
||||
use satrs::pus::verification::{FailParams, VerificationReporter, VerificationReportingProvider};
|
||||
use satrs::pus::PartialPusHandlingError;
|
||||
use satrs::pus::{
|
||||
DirectPusPacketHandlerResult, EcssTcAndToken, EcssTcInMemConversionProvider,
|
||||
EcssTcInMemConverter, MpscTcReceiver, PusServiceHelper,
|
||||
CacheAndReadRawEcssTc, DirectPusPacketHandlerResult, EcssTcAndToken,
|
||||
EcssTcInMemConverterWrapper, MpscTcReceiver, PusServiceHelper,
|
||||
};
|
||||
use satrs::spacepackets::ecss::tc::PusTcReader;
|
||||
use satrs::spacepackets::ecss::{PusPacket, PusServiceId};
|
||||
@@ -19,7 +19,7 @@ use super::{DirectPusService, HandlingStatus};
|
||||
|
||||
pub fn create_test_service(
|
||||
tm_sender: TmTcSender,
|
||||
tc_in_mem_converter: EcssTcInMemConverter,
|
||||
tc_in_mem_converter: EcssTcInMemConverterWrapper,
|
||||
event_sender: mpsc::SyncSender<EventMessageU32>,
|
||||
pus_test_rx: mpsc::Receiver<EcssTcAndToken>,
|
||||
) -> TestCustomServiceWrapper {
|
||||
@@ -40,7 +40,7 @@ pub struct TestCustomServiceWrapper {
|
||||
pub handler: PusService17TestHandler<
|
||||
MpscTcReceiver,
|
||||
TmTcSender,
|
||||
EcssTcInMemConverter,
|
||||
EcssTcInMemConverterWrapper,
|
||||
VerificationReporter,
|
||||
>,
|
||||
pub event_tx: mpsc::SyncSender<EventMessageU32>,
|
||||
|
@@ -8,7 +8,7 @@ use satrs::mode::ModeRequest;
|
||||
use satrs::pus::verification::{
|
||||
FailParams, TcStateAccepted, VerificationReportingProvider, VerificationToken,
|
||||
};
|
||||
use satrs::pus::{ActiveRequestProvider, EcssTmSender, GenericRoutingError, PusRequestRouter};
|
||||
use satrs::pus::{ActiveRequest, EcssTmSender, GenericRoutingError, PusRequestRouter};
|
||||
use satrs::queue::GenericSendError;
|
||||
use satrs::request::{GenericMessage, MessageMetadata, UniqueApidTargetId};
|
||||
use satrs::spacepackets::ecss::tc::PusTcReader;
|
||||
@@ -46,7 +46,7 @@ impl Default for GenericRequestRouter {
|
||||
impl GenericRequestRouter {
|
||||
pub(crate) fn handle_error_generic(
|
||||
&self,
|
||||
active_request: &impl ActiveRequestProvider,
|
||||
active_request: &impl ActiveRequest,
|
||||
tc: &PusTcReader,
|
||||
error: GenericRoutingError,
|
||||
tm_sender: &(impl EcssTmSender + ?Sized),
|
||||
|
@@ -10,6 +10,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
- 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
|
||||
|
||||
`satrs-shared` update
|
||||
|
@@ -71,18 +71,14 @@ pub enum ListenerKey {
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct EventMessage<Event: GenericEvent, ParamProvider: Debug = Params> {
|
||||
pub struct EventMessage<Event: GenericEvent, Parameters: Debug = Params> {
|
||||
sender_id: ComponentId,
|
||||
event: Event,
|
||||
params: Option<ParamProvider>,
|
||||
params: Option<Parameters>,
|
||||
}
|
||||
|
||||
impl<Event: GenericEvent, ParamProvider: Debug + Clone> EventMessage<Event, ParamProvider> {
|
||||
pub fn new_generic(
|
||||
sender_id: ComponentId,
|
||||
event: Event,
|
||||
params: Option<&ParamProvider>,
|
||||
) -> Self {
|
||||
impl<Event: GenericEvent, Parameters: Debug + Clone> EventMessage<Event, Parameters> {
|
||||
pub fn new_generic(sender_id: ComponentId, event: Event, params: Option<&Parameters>) -> Self {
|
||||
Self {
|
||||
sender_id,
|
||||
event,
|
||||
@@ -98,7 +94,7 @@ impl<Event: GenericEvent, ParamProvider: Debug + Clone> EventMessage<Event, Para
|
||||
self.event
|
||||
}
|
||||
|
||||
pub fn params(&self) -> Option<&ParamProvider> {
|
||||
pub fn params(&self) -> Option<&Parameters> {
|
||||
self.params.as_ref()
|
||||
}
|
||||
|
||||
@@ -106,7 +102,7 @@ impl<Event: GenericEvent, ParamProvider: Debug + Clone> EventMessage<Event, Para
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
/// in the store at its core. The API was designed so internal optimizations can be performed
|
||||
|
@@ -143,7 +143,7 @@ pub mod std_mod {
|
||||
use crate::{
|
||||
ComponentId,
|
||||
pus::{
|
||||
ActivePusRequestStd, ActiveRequestProvider, DefaultActiveRequestMap,
|
||||
ActivePusRequestStd, ActiveRequest, DefaultActiveRequestMap,
|
||||
verification::{self, TcStateToken},
|
||||
},
|
||||
request::{MessageSenderMap, OneMessageSender},
|
||||
@@ -157,7 +157,7 @@ pub mod std_mod {
|
||||
common: ActivePusRequestStd,
|
||||
}
|
||||
|
||||
impl ActiveRequestProvider for ActivePusActionRequestStd {
|
||||
impl ActiveRequest for ActivePusActionRequestStd {
|
||||
delegate::delegate! {
|
||||
to self.common {
|
||||
fn target_id(&self) -> ComponentId;
|
||||
|
@@ -139,24 +139,24 @@ mod alloc_mod {
|
||||
use core::cell::RefCell;
|
||||
use spacepackets::ecss::PusError;
|
||||
|
||||
pub trait EventTmHookProvider {
|
||||
pub trait EventTmHook {
|
||||
fn modify_tm(&self, tm: &mut PusTmCreator);
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct DummyEventHook {}
|
||||
|
||||
impl EventTmHookProvider for DummyEventHook {
|
||||
impl EventTmHook for DummyEventHook {
|
||||
fn modify_tm(&self, _tm: &mut PusTmCreator) {}
|
||||
}
|
||||
|
||||
pub struct EventReporter<EventTmHook: EventTmHookProvider = DummyEventHook> {
|
||||
pub struct EventReporter<EventTmHookInstance: EventTmHook = DummyEventHook> {
|
||||
id: ComponentId,
|
||||
// Use interior mutability pattern here. This is just an intermediate buffer to the PUS event packet
|
||||
// generation.
|
||||
source_data_buf: RefCell<Vec<u8>>,
|
||||
pub report_creator: EventReportCreator,
|
||||
pub tm_hook: EventTmHook,
|
||||
pub tm_hook: EventTmHookInstance,
|
||||
}
|
||||
|
||||
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(
|
||||
id: ComponentId,
|
||||
default_apid: u16,
|
||||
default_dest_id: u16,
|
||||
max_event_id_and_aux_data_size: usize,
|
||||
tm_hook: EventTmHook,
|
||||
tm_hook: EventTmHookInstance,
|
||||
) -> Option<Self> {
|
||||
let reporter = EventReportCreator::new(default_apid, default_dest_id)?;
|
||||
Some(Self {
|
||||
|
@@ -102,7 +102,7 @@ pub mod alloc_mod {
|
||||
use crate::{
|
||||
events::EventU16,
|
||||
params::{Params, WritableToBeBytes},
|
||||
pus::event::{DummyEventHook, EventTmHookProvider},
|
||||
pus::event::{DummyEventHook, EventTmHook},
|
||||
};
|
||||
|
||||
use super::*;
|
||||
@@ -151,9 +151,9 @@ pub mod alloc_mod {
|
||||
pub struct PusEventTmCreatorWithMap<
|
||||
ReportingMap: PusEventReportingMapProvider<Event>,
|
||||
Event: GenericEvent,
|
||||
EventTmHook: EventTmHookProvider = DummyEventHook,
|
||||
EventTmHookInstance: EventTmHook = DummyEventHook,
|
||||
> {
|
||||
pub reporter: EventReporter<EventTmHook>,
|
||||
pub reporter: EventReporter<EventTmHookInstance>,
|
||||
reporting_map: ReportingMap,
|
||||
phantom: PhantomData<Event>,
|
||||
}
|
||||
@@ -161,10 +161,10 @@ pub mod alloc_mod {
|
||||
impl<
|
||||
ReportingMap: PusEventReportingMapProvider<Event>,
|
||||
Event: GenericEvent,
|
||||
EventTmHook: EventTmHookProvider,
|
||||
> PusEventTmCreatorWithMap<ReportingMap, Event, EventTmHook>
|
||||
EventTmHookInstance: EventTmHook,
|
||||
> PusEventTmCreatorWithMap<ReportingMap, Event, EventTmHookInstance>
|
||||
{
|
||||
pub fn new(reporter: EventReporter<EventTmHook>, backend: ReportingMap) -> Self {
|
||||
pub fn new(reporter: EventReporter<EventTmHookInstance>, backend: ReportingMap) -> Self {
|
||||
Self {
|
||||
reporter,
|
||||
reporting_map: backend,
|
||||
@@ -262,10 +262,10 @@ pub mod alloc_mod {
|
||||
}
|
||||
}
|
||||
|
||||
impl<Event: GenericEvent + Copy + PartialEq + Eq + Hash, EventTmHook: EventTmHookProvider>
|
||||
PusEventTmCreatorWithMap<DefaultPusEventReportingMap<Event>, Event, EventTmHook>
|
||||
impl<Event: GenericEvent + Copy + PartialEq + Eq + Hash, EventTmHookInstance: 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 {
|
||||
reporter,
|
||||
reporting_map: DefaultPusEventReportingMap::default(),
|
||||
|
@@ -9,14 +9,14 @@ use std::sync::mpsc::Sender;
|
||||
|
||||
use super::verification::VerificationReportingProvider;
|
||||
use super::{
|
||||
EcssTcInMemConversionProvider, EcssTcReceiver, EcssTmSender, GenericConversionError,
|
||||
CacheAndReadRawEcssTc, EcssTcReceiver, EcssTmSender, GenericConversionError,
|
||||
GenericRoutingError, HandlingStatus, PusServiceHelper,
|
||||
};
|
||||
|
||||
pub struct PusEventServiceHandler<
|
||||
TcReceiver: EcssTcReceiver,
|
||||
TmSender: EcssTmSender,
|
||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||
TcInMemConverter: CacheAndReadRawEcssTc,
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
> {
|
||||
pub service_helper:
|
||||
@@ -27,7 +27,7 @@ pub struct PusEventServiceHandler<
|
||||
impl<
|
||||
TcReceiver: EcssTcReceiver,
|
||||
TmSender: EcssTmSender,
|
||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||
TcInMemConverter: CacheAndReadRawEcssTc,
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
> PusEventServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
|
||||
{
|
||||
|
@@ -296,7 +296,7 @@ pub trait PacketSenderPusTc: Send {
|
||||
) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
pub trait ActiveRequestMapProvider<V>: Sized {
|
||||
pub trait ActiveRequestStore<V>: Sized {
|
||||
fn insert(&mut self, request_id: &RequestId, request_info: V);
|
||||
fn get(&self, request_id: RequestId) -> Option<&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);
|
||||
}
|
||||
|
||||
pub trait ActiveRequestProvider {
|
||||
pub trait ActiveRequest {
|
||||
fn target_id(&self) -> ComponentId;
|
||||
fn token(&self) -> TcStateToken;
|
||||
fn set_token(&mut self, token: TcStateToken);
|
||||
@@ -330,7 +330,7 @@ pub trait PusRequestRouter<Request> {
|
||||
) -> Result<(), Self::Error>;
|
||||
}
|
||||
|
||||
pub trait PusReplyHandler<ActiveRequestInfo: ActiveRequestProvider, ReplyType> {
|
||||
pub trait PusReplyHandler<ActiveRequestInfo: ActiveRequest, ReplyType> {
|
||||
type Error;
|
||||
|
||||
/// 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
|
||||
/// 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;
|
||||
fn convert(
|
||||
&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) {
|
||||
self.0.insert(*request_id, request);
|
||||
}
|
||||
@@ -680,7 +680,7 @@ pub mod std_mod {
|
||||
pub use cb_mod::*;
|
||||
|
||||
use super::verification::{TcStateToken, VerificationReportingProvider};
|
||||
use super::{AcceptedEcssTcAndToken, ActiveRequestProvider, TcInMemory};
|
||||
use super::{AcceptedEcssTcAndToken, ActiveRequest, TcInMemory};
|
||||
use crate::tmtc::PacketInPool;
|
||||
|
||||
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 {
|
||||
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 tc_slice_raw(&self) -> &[u8];
|
||||
@@ -976,7 +978,7 @@ pub mod std_mod {
|
||||
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> {
|
||||
self.pus_tc_raw = None;
|
||||
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> {
|
||||
match tc_in_memory {
|
||||
super::TcInMemory::Pool(packet_in_pool) => {
|
||||
@@ -1070,38 +1072,38 @@ pub mod std_mod {
|
||||
|
||||
// TODO: alloc feature flag?
|
||||
#[derive(Clone)]
|
||||
pub enum EcssTcInMemConverter {
|
||||
pub enum EcssTcInMemConverterWrapper {
|
||||
Static(EcssTcInSharedPoolConverter),
|
||||
Heap(EcssTcInVecConverter),
|
||||
}
|
||||
|
||||
impl EcssTcInMemConverter {
|
||||
impl EcssTcInMemConverterWrapper {
|
||||
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 {
|
||||
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> {
|
||||
match self {
|
||||
EcssTcInMemConverter::Static(converter) => converter.cache(tc_in_memory),
|
||||
EcssTcInMemConverter::Heap(converter) => converter.cache(tc_in_memory),
|
||||
Self::Static(converter) => converter.cache(tc_in_memory),
|
||||
Self::Heap(converter) => converter.cache(tc_in_memory),
|
||||
}
|
||||
}
|
||||
fn tc_slice_raw(&self) -> &[u8] {
|
||||
match self {
|
||||
EcssTcInMemConverter::Static(converter) => converter.tc_slice_raw(),
|
||||
EcssTcInMemConverter::Heap(converter) => converter.tc_slice_raw(),
|
||||
Self::Static(converter) => converter.tc_slice_raw(),
|
||||
Self::Heap(converter) => converter.tc_slice_raw(),
|
||||
}
|
||||
}
|
||||
fn sender_id(&self) -> Option<ComponentId> {
|
||||
match self {
|
||||
EcssTcInMemConverter::Static(converter) => converter.sender_id(),
|
||||
EcssTcInMemConverter::Heap(converter) => converter.sender_id(),
|
||||
Self::Static(converter) => converter.sender_id(),
|
||||
Self::Heap(converter) => converter.sender_id(),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1129,7 +1131,7 @@ pub mod std_mod {
|
||||
pub struct PusServiceHelper<
|
||||
TcReceiver: EcssTcReceiver,
|
||||
TmSender: EcssTmSender,
|
||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||
TcInMemConverter: CacheAndReadRawEcssTc,
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
> {
|
||||
pub common: PusServiceBase<TcReceiver, TmSender, VerificationReporter>,
|
||||
@@ -1139,7 +1141,7 @@ pub mod std_mod {
|
||||
impl<
|
||||
TcReceiver: EcssTcReceiver,
|
||||
TmSender: EcssTmSender,
|
||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||
TcInMemConverter: CacheAndReadRawEcssTc,
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
> PusServiceHelper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
|
||||
{
|
||||
@@ -1314,7 +1316,8 @@ pub mod tests {
|
||||
|
||||
use super::verification::test_util::TestVerificationReporter;
|
||||
use super::verification::{
|
||||
TcStateAccepted, VerificationReporterCfg, VerificationReportingProvider, VerificationToken,
|
||||
TcStateAccepted, VerificationReporterConfig, VerificationReportingProvider,
|
||||
VerificationToken,
|
||||
};
|
||||
use super::*;
|
||||
|
||||
@@ -1404,7 +1407,7 @@ pub mod tests {
|
||||
let (test_srv_tc_tx, test_srv_tc_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 =
|
||||
VerificationReporter::new(TEST_COMPONENT_ID_0.id(), &verif_cfg);
|
||||
let test_srv_tm_sender =
|
||||
@@ -1501,7 +1504,7 @@ pub mod tests {
|
||||
let (test_srv_tc_tx, test_srv_tc_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 =
|
||||
VerificationReporter::new(TEST_COMPONENT_ID_0.id(), &verif_cfg);
|
||||
let in_store_converter = EcssTcInVecConverter::default();
|
||||
|
@@ -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);
|
||||
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);
|
||||
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);
|
||||
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 =
|
||||
cds::CdsTime::from_unix_time_with_u16_days(×tamp, cds::SubmillisPrecision::Absent)
|
||||
.unwrap();
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use super::scheduler::PusSchedulerProvider;
|
||||
use super::verification::{VerificationReporter, VerificationReportingProvider};
|
||||
use super::{
|
||||
DirectPusPacketHandlerResult, EcssTcInMemConversionProvider, EcssTcInSharedPoolConverter,
|
||||
CacheAndReadRawEcssTc, DirectPusPacketHandlerResult, EcssTcInSharedPoolConverter,
|
||||
EcssTcInVecConverter, EcssTcReceiver, EcssTmSender, HandlingStatus, MpscTcReceiver,
|
||||
PartialPusHandlingError, PusServiceHelper,
|
||||
};
|
||||
@@ -24,7 +24,7 @@ use std::sync::mpsc;
|
||||
pub struct PusSchedServiceHandler<
|
||||
TcReceiver: EcssTcReceiver,
|
||||
TmSender: EcssTmSender,
|
||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||
TcInMemConverter: CacheAndReadRawEcssTc,
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
PusScheduler: PusSchedulerProvider,
|
||||
> {
|
||||
@@ -36,7 +36,7 @@ pub struct PusSchedServiceHandler<
|
||||
impl<
|
||||
TcReceiver: EcssTcReceiver,
|
||||
TmSender: EcssTmSender,
|
||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||
TcInMemConverter: CacheAndReadRawEcssTc,
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
Scheduler: PusSchedulerProvider,
|
||||
> PusSchedServiceHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter, Scheduler>
|
||||
|
@@ -9,9 +9,8 @@ use std::sync::mpsc;
|
||||
|
||||
use super::verification::{VerificationReporter, VerificationReportingProvider};
|
||||
use super::{
|
||||
EcssTcInMemConversionProvider, EcssTcInSharedPoolConverter, EcssTcInVecConverter,
|
||||
EcssTcReceiver, EcssTmSender, GenericConversionError, HandlingStatus, MpscTcReceiver,
|
||||
PusServiceHelper,
|
||||
CacheAndReadRawEcssTc, EcssTcInSharedPoolConverter, EcssTcInVecConverter, EcssTcReceiver,
|
||||
EcssTmSender, GenericConversionError, HandlingStatus, MpscTcReceiver, PusServiceHelper,
|
||||
};
|
||||
|
||||
/// 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<
|
||||
TcReceiver: EcssTcReceiver,
|
||||
TmSender: EcssTmSender,
|
||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||
TcInMemConverter: CacheAndReadRawEcssTc,
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
> {
|
||||
pub service_helper:
|
||||
@@ -29,7 +28,7 @@ pub struct PusService17TestHandler<
|
||||
impl<
|
||||
TcReceiver: EcssTcReceiver,
|
||||
TmSender: EcssTmSender,
|
||||
TcInMemConverter: EcssTcInMemConversionProvider,
|
||||
TcInMemConverter: CacheAndReadRawEcssTc,
|
||||
VerificationReporter: VerificationReportingProvider,
|
||||
> PusService17TestHandler<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
|
||||
{
|
||||
|
@@ -17,7 +17,7 @@
|
||||
//! use std::time::Duration;
|
||||
//! use satrs::pool::{PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig};
|
||||
//! use satrs::pus::verification::{
|
||||
//! VerificationReportingProvider, VerificationReporterCfg, VerificationReporter
|
||||
//! VerificationReportingProvider, VerificationReporterConfig, VerificationReporter
|
||||
//! };
|
||||
//! use satrs::tmtc::{SharedStaticMemoryPool, PacketSenderWithSharedPool};
|
||||
//! use satrs::spacepackets::seq_count::SeqCountProviderSimple;
|
||||
@@ -38,7 +38,7 @@
|
||||
//! let shared_tm_pool = SharedStaticMemoryPool::new(RwLock::new(tm_pool));
|
||||
//! let (verif_tx, verif_rx) = mpsc::sync_channel(10);
|
||||
//! 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 tc_header = PusTcSecondaryHeader::new_simple(17, 1);
|
||||
@@ -846,14 +846,14 @@ pub mod alloc_mod {
|
||||
use core::cell::RefCell;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct VerificationReporterCfg {
|
||||
pub struct VerificationReporterConfig {
|
||||
apid: u16,
|
||||
pub step_field_width: usize,
|
||||
pub fail_code_field_width: usize,
|
||||
pub max_fail_data_len: usize,
|
||||
}
|
||||
|
||||
impl VerificationReporterCfg {
|
||||
impl VerificationReporterConfig {
|
||||
pub fn new(
|
||||
apid: u16,
|
||||
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
|
||||
/// 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);
|
||||
}
|
||||
|
||||
@@ -886,7 +886,7 @@ pub mod alloc_mod {
|
||||
#[derive(Default, Copy, Clone)]
|
||||
pub struct DummyVerificationHook {}
|
||||
|
||||
impl VerificationHookProvider for DummyVerificationHook {
|
||||
impl VerificationHook for DummyVerificationHook {
|
||||
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.
|
||||
#[derive(Clone)]
|
||||
pub struct VerificationReporter<
|
||||
VerificationHook: VerificationHookProvider = DummyVerificationHook,
|
||||
VerificationHookInstance: VerificationHook = DummyVerificationHook,
|
||||
> {
|
||||
owner_id: ComponentId,
|
||||
source_data_buf: RefCell<alloc::vec::Vec<u8>>,
|
||||
pub reporter_creator: VerificationReportCreator,
|
||||
pub tm_hook: VerificationHook,
|
||||
pub tm_hook: VerificationHookInstance,
|
||||
}
|
||||
|
||||
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();
|
||||
Self {
|
||||
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
|
||||
/// before it is sent.
|
||||
pub fn new_with_hook(
|
||||
owner_id: ComponentId,
|
||||
cfg: &VerificationReporterCfg,
|
||||
tm_hook: VerificationHook,
|
||||
cfg: &VerificationReporterConfig,
|
||||
tm_hook: VerificationHookInstance,
|
||||
) -> Self {
|
||||
let reporter = VerificationReportCreator::new(cfg.apid).unwrap();
|
||||
Self {
|
||||
@@ -978,8 +978,8 @@ pub mod alloc_mod {
|
||||
}
|
||||
}
|
||||
|
||||
impl<VerificationHook: VerificationHookProvider> VerificationReportingProvider
|
||||
for VerificationReporter<VerificationHook>
|
||||
impl<VerificationHookInstance: VerificationHook> VerificationReportingProvider
|
||||
for VerificationReporter<VerificationHookInstance>
|
||||
{
|
||||
delegate!(
|
||||
to self.reporter_creator {
|
||||
@@ -1693,7 +1693,7 @@ pub mod tests {
|
||||
use crate::pus::tests::CommonTmInfo;
|
||||
use crate::pus::verification::{
|
||||
EcssTmSender, EcssTmtcError, FailParams, FailParamsWithStep, RequestId, TcStateNone,
|
||||
VerificationReporter, VerificationReporterCfg, VerificationToken,
|
||||
VerificationReporter, VerificationReporterConfig, VerificationToken,
|
||||
handle_step_failure_with_generic_params,
|
||||
};
|
||||
use crate::pus::{ChannelWithId, PusTmVariant};
|
||||
@@ -1717,8 +1717,8 @@ pub mod tests {
|
||||
|
||||
use super::{
|
||||
DummyVerificationHook, FailParamHelper, SeqCountProviderSimple, TcStateAccepted,
|
||||
TcStateStarted, VerificationHookProvider, VerificationReportingProvider,
|
||||
WasAtLeastAccepted, handle_completion_failure_with_generic_params,
|
||||
TcStateStarted, VerificationHook, VerificationReportingProvider, WasAtLeastAccepted,
|
||||
handle_completion_failure_with_generic_params,
|
||||
};
|
||||
|
||||
fn is_send<T: Send>(_: &T) {}
|
||||
@@ -1787,7 +1787,7 @@ pub mod tests {
|
||||
pub msg_counter: SeqCountProviderSimple<u16>,
|
||||
}
|
||||
|
||||
impl VerificationHookProvider for SequenceCounterHook {
|
||||
impl VerificationHook for SequenceCounterHook {
|
||||
fn modify_tm(&self, tm: &mut spacepackets::ecss::tm::PusTmCreator) {
|
||||
tm.set_seq_count(self.seq_counter.get_and_increment());
|
||||
tm.set_msg_counter(self.msg_counter.get_and_increment());
|
||||
@@ -1795,29 +1795,29 @@ pub mod tests {
|
||||
}
|
||||
|
||||
struct VerificationReporterTestbench<
|
||||
VerificationHook: VerificationHookProvider = DummyVerificationHook,
|
||||
VerificationHookInstance: VerificationHook = DummyVerificationHook,
|
||||
> {
|
||||
pub id: ComponentId,
|
||||
sender: TestSender,
|
||||
reporter: VerificationReporter<VerificationHook>,
|
||||
reporter: VerificationReporter<VerificationHookInstance>,
|
||||
pub request_id: RequestId,
|
||||
tc: Vec<u8>,
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
fn reporter_with_hook<VerificationHook: VerificationHookProvider>(
|
||||
fn reporter_with_hook<VerificationHookInstance: VerificationHook>(
|
||||
id: ComponentId,
|
||||
hook: VerificationHook,
|
||||
) -> VerificationReporter<VerificationHook> {
|
||||
let cfg = VerificationReporterCfg::new(TEST_APID, 1, 2, 8).unwrap();
|
||||
hook: VerificationHookInstance,
|
||||
) -> VerificationReporter<VerificationHookInstance> {
|
||||
let cfg = VerificationReporterConfig::new(TEST_APID, 1, 2, 8).unwrap();
|
||||
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 {
|
||||
let reporter = reporter_with_hook(id, tm_hook);
|
||||
Self {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
use core::fmt::Debug;
|
||||
|
||||
/// Generic abstraction for a check/countdown timer.
|
||||
pub trait CountdownProvider: Debug {
|
||||
pub trait Countdown: Debug {
|
||||
fn has_expired(&self) -> bool;
|
||||
fn reset(&mut self);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ pub mod crossbeam_test {
|
||||
use satrs::pool::{PoolProvider, PoolProviderWithGuards, StaticMemoryPool, StaticPoolConfig};
|
||||
use satrs::pus::test_util::{TEST_APID, TEST_COMPONENT_ID_0};
|
||||
use satrs::pus::verification::{
|
||||
FailParams, RequestId, VerificationReporter, VerificationReporterCfg,
|
||||
FailParams, RequestId, VerificationReporter, VerificationReporterConfig,
|
||||
VerificationReportingProvider,
|
||||
};
|
||||
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
|
||||
// the same APID. If they had distinct APIDs, the more correct approach would be to have
|
||||
// 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
|
||||
let pool_cfg = StaticPoolConfig::new_from_subpool_cfg_tuples(
|
||||
vec![(10, 32), (10, 64), (10, 128), (10, 1024)],
|
||||
|
Reference in New Issue
Block a user