better naming
Some checks failed
Rust/sat-rs/pipeline/pr-main There was a failure building this commit

This commit is contained in:
Robin Müller 2024-02-01 14:09:54 +01:00
parent 4929e39af7
commit 6296b1b0ac
Signed by: muellerr
GPG Key ID: A649FB78196E3849
8 changed files with 111 additions and 69 deletions

View File

@ -1,52 +1,37 @@
use crate::events::EventU32; use crate::events::EventU32;
use crate::pus::event_man::{EventRequest, EventRequestWithToken}; use crate::pus::event_man::{EventRequest, EventRequestWithToken};
use crate::pus::verification::TcStateToken; use crate::pus::verification::TcStateToken;
use crate::pus::{ use crate::pus::{PartialPusHandlingError, PusPacketHandlerResult, PusPacketHandlingError};
EcssTcReceiver, EcssTmSender, PartialPusHandlingError, PusPacketHandlerResult,
PusPacketHandlingError,
};
use alloc::boxed::Box;
use spacepackets::ecss::event::Subservice; use spacepackets::ecss::event::Subservice;
use spacepackets::ecss::PusPacket; use spacepackets::ecss::PusPacket;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use super::verification::VerificationReporterWithSender; use super::{EcssTcInMemConverter, PusServiceBase, PusServiceHelper};
use super::{EcssTcInMemConverter, PusServiceBase, PusServiceHandler};
pub struct PusService5EventHandler<TcInMemConverter: EcssTcInMemConverter> { pub struct PusService5EventHandler<TcInMemConverter: EcssTcInMemConverter> {
pub psb: PusServiceHandler<TcInMemConverter>, pub service_helper: PusServiceHelper<TcInMemConverter>,
event_request_tx: Sender<EventRequestWithToken>, event_request_tx: Sender<EventRequestWithToken>,
} }
impl<TcInMemConverter: EcssTcInMemConverter> PusService5EventHandler<TcInMemConverter> { impl<TcInMemConverter: EcssTcInMemConverter> PusService5EventHandler<TcInMemConverter> {
pub fn new( pub fn new(
tc_receiver: Box<dyn EcssTcReceiver>, service_handler: PusServiceHelper<TcInMemConverter>,
tm_sender: Box<dyn EcssTmSender>,
tm_apid: u16,
verification_handler: VerificationReporterWithSender,
tc_in_mem_converter: TcInMemConverter,
event_request_tx: Sender<EventRequestWithToken>, event_request_tx: Sender<EventRequestWithToken>,
) -> Self { ) -> Self {
Self { Self {
psb: PusServiceHandler::new( service_helper: service_handler,
tc_receiver,
tm_sender,
tm_apid,
verification_handler,
tc_in_mem_converter,
),
event_request_tx, event_request_tx,
} }
} }
pub fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> { pub fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
let possible_packet = self.psb.retrieve_and_accept_next_packet()?; let possible_packet = self.service_helper.retrieve_and_accept_next_packet()?;
if possible_packet.is_none() { if possible_packet.is_none() {
return Ok(PusPacketHandlerResult::Empty); return Ok(PusPacketHandlerResult::Empty);
} }
let ecss_tc_and_token = possible_packet.unwrap(); let ecss_tc_and_token = possible_packet.unwrap();
let tc = self let tc = self
.psb .service_helper
.tc_in_mem_converter .tc_in_mem_converter
.convert_ecss_tc_in_memory_to_reader(&ecss_tc_and_token.tc_in_memory)?; .convert_ecss_tc_in_memory_to_reader(&ecss_tc_and_token.tc_in_memory)?;
let subservice = tc.subservice(); let subservice = tc.subservice();
@ -66,7 +51,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService5EventHandler<TcInMemConv
let user_data = tc.user_data(); let user_data = tc.user_data();
let event_u32 = EventU32::from(u32::from_be_bytes(user_data[0..4].try_into().unwrap())); let event_u32 = EventU32::from(u32::from_be_bytes(user_data[0..4].try_into().unwrap()));
let start_token = self let start_token = self
.psb .service_helper
.common .common
.verification_handler .verification_handler
.borrow_mut() .borrow_mut()
@ -126,3 +111,53 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService5EventHandler<TcInMemConv
Ok(PusPacketHandlerResult::RequestHandled) Ok(PusPacketHandlerResult::RequestHandled)
} }
} }
#[cfg(test)]
mod tests {
use delegate::delegate;
use spacepackets::ecss::{tc::PusTcCreator, tm::PusTmReader};
use std::sync::mpsc::Sender;
use crate::pus::{
event_man::EventRequestWithToken,
tests::{PusServiceHandlerWithStoreCommon, PusTestHarness},
verification::{TcStateAccepted, VerificationToken},
EcssTcInStoreConverter, PusPacketHandlerResult, PusPacketHandlingError,
};
use super::PusService5EventHandler;
struct Pus5HandlerWithStoreTester {
common: PusServiceHandlerWithStoreCommon,
handler: PusService5EventHandler<EcssTcInStoreConverter>,
}
impl Pus5HandlerWithStoreTester {
pub fn new(event_request_tx: Sender<EventRequestWithToken>) -> Self {
let (common, srv_handler) = PusServiceHandlerWithStoreCommon::new();
let pus_17_handler = PusService5EventHandler::new(srv_handler, event_request_tx);
Self {
common,
handler: pus_17_handler,
}
}
}
impl PusTestHarness for Pus5HandlerWithStoreTester {
delegate! {
to self.common {
fn send_tc(&mut self, tc: &PusTcCreator) -> VerificationToken<TcStateAccepted>;
fn read_next_tm(&mut self) -> PusTmReader<'_>;
fn check_next_verification_tm<STATE>(
&self,
subservice: u8,
token: VerificationToken<STATE>,
);
}
to self.handler {
fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError>;
}
}
}
}

View File

@ -833,19 +833,21 @@ pub mod std_mod {
} }
} }
/// This is a high-level PUS packet handler. It performs some of the boilerplate acitivities /// This is a high-level PUS packet handler helper.
/// involved when handling PUS telecommands and it can be used to implement the handling of ///
/// PUS telecommands for certain PUS telecommands groups (for example individual services). /// It performs some of the boilerplate acitivities involved when handling PUS telecommands and
/// it can be used to implement the handling of PUS telecommands for certain PUS telecommands
/// groups (for example individual services).
/// ///
/// This base class can handle PUS telecommands backed by different memory storage machanisms /// This base class can handle PUS telecommands backed by different memory storage machanisms
/// by using the [EcssTcInMemConverter] abstraction. This object provides some convenience /// by using the [EcssTcInMemConverter] abstraction. This object provides some convenience
/// methods to make the generic parts of TC handling easier. /// methods to make the generic parts of TC handling easier.
pub struct PusServiceHandler<TcInMemConverter: EcssTcInMemConverter> { pub struct PusServiceHelper<TcInMemConverter: EcssTcInMemConverter> {
pub common: PusServiceBase, pub common: PusServiceBase,
pub tc_in_mem_converter: TcInMemConverter, pub tc_in_mem_converter: TcInMemConverter,
} }
impl<TcInMemConverter: EcssTcInMemConverter> PusServiceHandler<TcInMemConverter> { impl<TcInMemConverter: EcssTcInMemConverter> PusServiceHelper<TcInMemConverter> {
pub fn new( pub fn new(
tc_receiver: Box<dyn EcssTcReceiver>, tc_receiver: Box<dyn EcssTcReceiver>,
tm_sender: Box<dyn EcssTmSender>, tm_sender: Box<dyn EcssTmSender>,
@ -931,7 +933,7 @@ pub mod tests {
use super::{ use super::{
EcssTcAndToken, EcssTcInStoreConverter, EcssTcInVecConverter, MpscTcReceiver, EcssTcAndToken, EcssTcInStoreConverter, EcssTcInVecConverter, MpscTcReceiver,
MpscTmAsVecSender, MpscTmInStoreSender, PusPacketHandlerResult, PusPacketHandlingError, MpscTmAsVecSender, MpscTmInStoreSender, PusPacketHandlerResult, PusPacketHandlingError,
PusServiceHandler, TcInMemory, PusServiceHelper, TcInMemory,
}; };
pub const TEST_APID: u16 = 0x101; pub const TEST_APID: u16 = 0x101;
@ -987,7 +989,7 @@ pub mod tests {
/// [PusServiceHandler] which might be required for a specific PUS service handler. /// [PusServiceHandler] which might be required for a specific PUS service handler.
/// ///
/// The PUS service handler is instantiated with a [EcssTcInStoreConverter]. /// The PUS service handler is instantiated with a [EcssTcInStoreConverter].
pub fn new() -> (Self, PusServiceHandler<EcssTcInStoreConverter>) { pub fn new() -> (Self, PusServiceHelper<EcssTcInStoreConverter>) {
let pool_cfg = PoolCfg::new(vec![(16, 16), (8, 32), (4, 64)]); let pool_cfg = PoolCfg::new(vec![(16, 16), (8, 32), (4, 64)]);
let tc_pool = LocalPool::new(pool_cfg.clone()); let tc_pool = LocalPool::new(pool_cfg.clone());
let tm_pool = LocalPool::new(pool_cfg); let tm_pool = LocalPool::new(pool_cfg);
@ -1015,7 +1017,7 @@ pub mod tests {
tm_receiver: tm_rx, tm_receiver: tm_rx,
verification_handler: verification_handler.clone(), verification_handler: verification_handler.clone(),
}, },
PusServiceHandler::new( PusServiceHelper::new(
Box::new(test_srv_tc_receiver), Box::new(test_srv_tc_receiver),
Box::new(test_srv_tm_sender), Box::new(test_srv_tm_sender),
TEST_APID, TEST_APID,
@ -1079,7 +1081,7 @@ pub mod tests {
} }
impl PusServiceHandlerWithVecCommon { impl PusServiceHandlerWithVecCommon {
pub fn new() -> (Self, PusServiceHandler<EcssTcInVecConverter>) { pub fn new() -> (Self, PusServiceHelper<EcssTcInVecConverter>) {
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();
@ -1097,7 +1099,7 @@ pub mod tests {
tm_receiver: tm_rx, tm_receiver: tm_rx,
verification_handler: verification_handler.clone(), verification_handler: verification_handler.clone(),
}, },
PusServiceHandler::new( PusServiceHelper::new(
Box::new(test_srv_tc_receiver), Box::new(test_srv_tc_receiver),
Box::new(test_srv_tm_sender), Box::new(test_srv_tm_sender),
TEST_APID, TEST_APID,

View File

@ -6,7 +6,7 @@ use spacepackets::time::cds::TimeProvider;
use std::boxed::Box; use std::boxed::Box;
use super::verification::VerificationReporterWithSender; use super::verification::VerificationReporterWithSender;
use super::{EcssTcInMemConverter, PusServiceBase, PusServiceHandler}; use super::{EcssTcInMemConverter, PusServiceBase, PusServiceHelper};
/// This is a helper class for [std] environments to handle generic PUS 11 (scheduling service) /// This is a helper class for [std] environments to handle generic PUS 11 (scheduling service)
/// packets. This handler is constrained to using the [PusScheduler], but is able to process /// packets. This handler is constrained to using the [PusScheduler], but is able to process
@ -17,7 +17,7 @@ use super::{EcssTcInMemConverter, PusServiceBase, PusServiceHandler};
/// [Self::scheduler] and [Self::scheduler_mut] function and then use the scheduler API to release /// [Self::scheduler] and [Self::scheduler_mut] function and then use the scheduler API to release
/// telecommands when applicable. /// telecommands when applicable.
pub struct PusService11SchedHandler<TcInMemConverter: EcssTcInMemConverter> { pub struct PusService11SchedHandler<TcInMemConverter: EcssTcInMemConverter> {
pub psb: PusServiceHandler<TcInMemConverter>, pub psb: PusServiceHelper<TcInMemConverter>,
shared_tc_store: SharedPool, shared_tc_store: SharedPool,
scheduler: PusScheduler, scheduler: PusScheduler,
} }
@ -33,7 +33,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService11SchedHandler<TcInMemCon
scheduler: PusScheduler, scheduler: PusScheduler,
) -> Self { ) -> Self {
Self { Self {
psb: PusServiceHandler::new( psb: PusServiceHelper::new(
tc_receiver, tc_receiver,
tm_sender, tm_sender,
tm_apid, tm_apid,
@ -175,3 +175,6 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService11SchedHandler<TcInMemCon
Ok(PusPacketHandlerResult::RequestHandled) Ok(PusPacketHandlerResult::RequestHandled)
} }
} }
#[cfg(test)]
mod tests {}

View File

@ -5,29 +5,29 @@ use spacepackets::ecss::tm::{PusTmCreator, PusTmSecondaryHeader};
use spacepackets::ecss::PusPacket; use spacepackets::ecss::PusPacket;
use spacepackets::SpHeader; use spacepackets::SpHeader;
use super::{EcssTcInMemConverter, PusServiceBase, PusServiceHandler}; use super::{EcssTcInMemConverter, PusServiceBase, 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.
/// This handler only processes ping requests and generates a ping reply for them accordingly. /// This handler only processes ping requests and generates a ping reply for them accordingly.
pub struct PusService17TestHandler<TcInMemConverter: EcssTcInMemConverter> { pub struct PusService17TestHandler<TcInMemConverter: EcssTcInMemConverter> {
pub psb: PusServiceHandler<TcInMemConverter>, pub service_helper: PusServiceHelper<TcInMemConverter>,
} }
impl<TcInMemConverter: EcssTcInMemConverter> PusService17TestHandler<TcInMemConverter> { impl<TcInMemConverter: EcssTcInMemConverter> PusService17TestHandler<TcInMemConverter> {
pub fn new(service_handler: PusServiceHandler<TcInMemConverter>) -> Self { pub fn new(service_helper: PusServiceHelper<TcInMemConverter>) -> Self {
Self { Self {
psb: service_handler, service_helper,
} }
} }
pub fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> { pub fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
let possible_packet = self.psb.retrieve_and_accept_next_packet()?; let possible_packet = self.service_helper.retrieve_and_accept_next_packet()?;
if possible_packet.is_none() { if possible_packet.is_none() {
return Ok(PusPacketHandlerResult::Empty); return Ok(PusPacketHandlerResult::Empty);
} }
let ecss_tc_and_token = possible_packet.unwrap(); let ecss_tc_and_token = possible_packet.unwrap();
let tc = self let tc = self
.psb .service_helper
.tc_in_mem_converter .tc_in_mem_converter
.convert_ecss_tc_in_memory_to_reader(&ecss_tc_and_token.tc_in_memory)?; .convert_ecss_tc_in_memory_to_reader(&ecss_tc_and_token.tc_in_memory)?;
if tc.service() != 17 { if tc.service() != 17 {
@ -37,7 +37,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService17TestHandler<TcInMemConv
let mut partial_error = None; let mut partial_error = None;
let time_stamp = PusServiceBase::get_current_timestamp(&mut partial_error); let time_stamp = PusServiceBase::get_current_timestamp(&mut partial_error);
let result = self let result = self
.psb .service_helper
.common .common
.verification_handler .verification_handler
.get_mut() .get_mut()
@ -50,11 +50,11 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService17TestHandler<TcInMemConv
None None
}; };
// Sequence count will be handled centrally in TM funnel. // Sequence count will be handled centrally in TM funnel.
let mut reply_header = SpHeader::tm_unseg(self.psb.common.tm_apid, 0, 0).unwrap(); let mut reply_header = SpHeader::tm_unseg(self.service_helper.common.tm_apid, 0, 0).unwrap();
let tc_header = PusTmSecondaryHeader::new_simple(17, 2, &time_stamp); let tc_header = PusTmSecondaryHeader::new_simple(17, 2, &time_stamp);
let ping_reply = PusTmCreator::new(&mut reply_header, tc_header, &[], true); let ping_reply = PusTmCreator::new(&mut reply_header, tc_header, &[], true);
let result = self let result = self
.psb .service_helper
.common .common
.tm_sender .tm_sender
.send_tm(PusTmWrapper::Direct(ping_reply)) .send_tm(PusTmWrapper::Direct(ping_reply))
@ -65,7 +65,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService17TestHandler<TcInMemConv
if let Some(start_token) = start_token { if let Some(start_token) = start_token {
if self if self
.psb .service_helper
.common .common
.verification_handler .verification_handler
.get_mut() .get_mut()

View File

@ -43,7 +43,7 @@ use satrs_core::pus::verification::{
TcStateStarted, VerificationReporterCfg, VerificationReporterWithSender, VerificationToken, TcStateStarted, VerificationReporterCfg, VerificationReporterWithSender, VerificationToken,
}; };
use satrs_core::pus::{ use satrs_core::pus::{
EcssTcInStoreConverter, MpscTcReceiver, MpscTmInStoreSender, PusServiceHandler, EcssTcInStoreConverter, MpscTcReceiver, MpscTmInStoreSender, PusServiceHelper,
}; };
use satrs_core::seq_count::{CcsdsSimpleSeqCountProvider, SequenceCountProviderCore}; use satrs_core::seq_count::{CcsdsSimpleSeqCountProvider, SequenceCountProviderCore};
use satrs_core::spacepackets::ecss::tm::{PusTmCreator, PusTmZeroCopyWriter}; use satrs_core::spacepackets::ecss::tm::{PusTmCreator, PusTmZeroCopyWriter};
@ -179,7 +179,7 @@ fn main() {
"PUS_17_TC_RECV", "PUS_17_TC_RECV",
pus_test_rx, pus_test_rx,
); );
let pus17_handler = PusService17TestHandler::new(PusServiceHandler::new( let pus17_handler = PusService17TestHandler::new(PusServiceHelper::new(
Box::new(test_srv_receiver), Box::new(test_srv_receiver),
Box::new(test_srv_tm_sender), Box::new(test_srv_tm_sender),
PUS_APID, PUS_APID,
@ -230,11 +230,13 @@ fn main() {
pus_event_rx, pus_event_rx,
); );
let pus_5_handler = PusService5EventHandler::new( let pus_5_handler = PusService5EventHandler::new(
Box::new(event_srv_receiver), PusServiceHelper::new(
Box::new(event_srv_tm_sender), Box::new(event_srv_receiver),
PUS_APID, Box::new(event_srv_tm_sender),
verif_reporter.clone(), PUS_APID,
EcssTcInStoreConverter::new(tc_store.pool.clone(), 2048), verif_reporter.clone(),
EcssTcInStoreConverter::new(tc_store.pool.clone(), 2048),
),
event_request_tx, event_request_tx,
); );
let mut pus_5_wrapper = Pus5Wrapper { pus_5_handler }; let mut pus_5_wrapper = Pus5Wrapper { pus_5_handler };

View File

@ -5,7 +5,7 @@ use satrs_core::pus::verification::{
}; };
use satrs_core::pus::{ use satrs_core::pus::{
EcssTcInMemConverter, EcssTcInStoreConverter, EcssTcReceiver, EcssTmSender, EcssTcInMemConverter, EcssTcInStoreConverter, EcssTcReceiver, EcssTmSender,
PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, PusServiceHandler, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, PusServiceHelper,
}; };
use satrs_core::spacepackets::ecss::tc::PusTcReader; use satrs_core::spacepackets::ecss::tc::PusTcReader;
use satrs_core::spacepackets::ecss::PusPacket; use satrs_core::spacepackets::ecss::PusPacket;
@ -14,7 +14,7 @@ use std::collections::HashMap;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
pub struct PusService8ActionHandler<TcInMemConverter: EcssTcInMemConverter> { pub struct PusService8ActionHandler<TcInMemConverter: EcssTcInMemConverter> {
psb: PusServiceHandler<TcInMemConverter>, service_helper: PusServiceHelper<TcInMemConverter>,
request_handlers: HashMap<TargetIdWithApid, Sender<RequestWithToken>>, request_handlers: HashMap<TargetIdWithApid, Sender<RequestWithToken>>,
} }
@ -28,7 +28,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService8ActionHandler<TcInMemCon
request_handlers: HashMap<TargetIdWithApid, Sender<RequestWithToken>>, request_handlers: HashMap<TargetIdWithApid, Sender<RequestWithToken>>,
) -> Self { ) -> Self {
Self { Self {
psb: PusServiceHandler::new( service_helper: PusServiceHelper::new(
tc_receiver, tc_receiver,
tm_sender, tm_sender,
tm_apid, tm_apid,
@ -47,7 +47,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService8ActionHandler<TcInMemCon
) -> Result<(), PusPacketHandlingError> { ) -> Result<(), PusPacketHandlingError> {
let user_data = tc.user_data(); let user_data = tc.user_data();
if user_data.len() < 8 { if user_data.len() < 8 {
self.psb self.service_helper
.common .common
.verification_handler .verification_handler
.borrow_mut() .borrow_mut()
@ -77,7 +77,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService8ActionHandler<TcInMemCon
} else { } else {
let mut fail_data: [u8; 4] = [0; 4]; let mut fail_data: [u8; 4] = [0; 4];
fail_data.copy_from_slice(&target_id.target.to_be_bytes()); fail_data.copy_from_slice(&target_id.target.to_be_bytes());
self.psb self.service_helper
.common .common
.verification_handler .verification_handler
.borrow_mut() .borrow_mut()
@ -98,15 +98,15 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService8ActionHandler<TcInMemCon
} }
fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> { fn handle_one_tc(&mut self) -> Result<PusPacketHandlerResult, PusPacketHandlingError> {
let possible_packet = self.psb.retrieve_and_accept_next_packet()?; let possible_packet = self.service_helper.retrieve_and_accept_next_packet()?;
if possible_packet.is_none() { if possible_packet.is_none() {
return Ok(PusPacketHandlerResult::Empty); return Ok(PusPacketHandlerResult::Empty);
} }
let ecss_tc_and_token = possible_packet.unwrap(); let ecss_tc_and_token = possible_packet.unwrap();
self.psb self.service_helper
.tc_in_mem_converter .tc_in_mem_converter
.cache_ecss_tc_in_memory(&ecss_tc_and_token.tc_in_memory)?; .cache_ecss_tc_in_memory(&ecss_tc_and_token.tc_in_memory)?;
let tc = PusTcReader::new(self.psb.tc_in_mem_converter.tc_slice_raw())?.0; let tc = PusTcReader::new(self.service_helper.tc_in_mem_converter.tc_slice_raw())?.0;
let subservice = tc.subservice(); let subservice = tc.subservice();
let mut partial_error = None; let mut partial_error = None;
let time_stamp = PusServiceBase::get_current_timestamp(&mut partial_error); let time_stamp = PusServiceBase::get_current_timestamp(&mut partial_error);
@ -116,7 +116,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService8ActionHandler<TcInMemCon
} }
_ => { _ => {
let fail_data = [subservice]; let fail_data = [subservice];
self.psb self.service_helper
.common .common
.verification_handler .verification_handler
.get_mut() .get_mut()

View File

@ -4,7 +4,7 @@ use satrs_core::hk::{CollectionIntervalFactor, HkRequest};
use satrs_core::pus::verification::{FailParams, StdVerifReporterWithSender}; use satrs_core::pus::verification::{FailParams, StdVerifReporterWithSender};
use satrs_core::pus::{ use satrs_core::pus::{
EcssTcInMemConverter, EcssTcInStoreConverter, EcssTcReceiver, EcssTmSender, EcssTcInMemConverter, EcssTcInStoreConverter, EcssTcReceiver, EcssTmSender,
PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, PusServiceHandler, PusPacketHandlerResult, PusPacketHandlingError, PusServiceBase, PusServiceHelper,
}; };
use satrs_core::spacepackets::ecss::{hk, PusPacket}; use satrs_core::spacepackets::ecss::{hk, PusPacket};
use satrs_example::{hk_err, tmtc_err, TargetIdWithApid}; use satrs_example::{hk_err, tmtc_err, TargetIdWithApid};
@ -12,7 +12,7 @@ use std::collections::HashMap;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
pub struct PusService3HkHandler<TcInMemConverter: EcssTcInMemConverter> { pub struct PusService3HkHandler<TcInMemConverter: EcssTcInMemConverter> {
psb: PusServiceHandler<TcInMemConverter>, psb: PusServiceHelper<TcInMemConverter>,
request_handlers: HashMap<TargetIdWithApid, Sender<RequestWithToken>>, request_handlers: HashMap<TargetIdWithApid, Sender<RequestWithToken>>,
} }
@ -26,7 +26,7 @@ impl<TcInMemConverter: EcssTcInMemConverter> PusService3HkHandler<TcInMemConvert
request_handlers: HashMap<TargetIdWithApid, Sender<RequestWithToken>>, request_handlers: HashMap<TargetIdWithApid, Sender<RequestWithToken>>,
) -> Self { ) -> Self {
Self { Self {
psb: PusServiceHandler::new( psb: PusServiceHelper::new(
tc_receiver, tc_receiver,
tm_sender, tm_sender,
tm_apid, tm_apid,

View File

@ -39,7 +39,7 @@ impl Service17CustomWrapper {
} }
PusPacketHandlerResult::CustomSubservice(subservice, token) => { PusPacketHandlerResult::CustomSubservice(subservice, token) => {
let (tc, _) = let (tc, _) =
PusTcReader::new(self.pus17_handler.psb.tc_in_mem_converter.tc_slice_raw()) PusTcReader::new(self.pus17_handler.service_helper.tc_in_mem_converter.tc_slice_raw())
.unwrap(); .unwrap();
let time_stamper = TimeProvider::from_now_with_u16_days().unwrap(); let time_stamper = TimeProvider::from_now_with_u16_days().unwrap();
let mut stamp_buf: [u8; 7] = [0; 7]; let mut stamp_buf: [u8; 7] = [0; 7];
@ -51,14 +51,14 @@ impl Service17CustomWrapper {
.expect("Sending test event failed"); .expect("Sending test event failed");
let start_token = self let start_token = self
.pus17_handler .pus17_handler
.psb .service_helper
.common .common
.verification_handler .verification_handler
.get_mut() .get_mut()
.start_success(token, Some(&stamp_buf)) .start_success(token, Some(&stamp_buf))
.expect("Error sending start success"); .expect("Error sending start success");
self.pus17_handler self.pus17_handler
.psb .service_helper
.common .common
.verification_handler .verification_handler
.get_mut() .get_mut()
@ -67,7 +67,7 @@ impl Service17CustomWrapper {
} else { } else {
let fail_data = [tc.subservice()]; let fail_data = [tc.subservice()];
self.pus17_handler self.pus17_handler
.psb .service_helper
.common .common
.verification_handler .verification_handler
.get_mut() .get_mut()