2024-02-26 15:18:15 +01:00
|
|
|
use satrs::pus::{
|
|
|
|
verification::VerificationReportingProvider, EcssTcInMemConverter, EcssTcReceiverCore,
|
|
|
|
EcssTmSenderCore,
|
|
|
|
};
|
2024-02-07 18:10:47 +01:00
|
|
|
|
|
|
|
use super::{
|
|
|
|
action::Pus8Wrapper, event::Pus5Wrapper, hk::Pus3Wrapper, scheduler::Pus11Wrapper,
|
|
|
|
test::Service17CustomWrapper,
|
|
|
|
};
|
|
|
|
|
2024-02-26 11:41:42 +01:00
|
|
|
pub struct PusStack<
|
2024-02-26 15:18:15 +01:00
|
|
|
TcReceiver: EcssTcReceiverCore,
|
|
|
|
TmSender: EcssTmSenderCore,
|
2024-02-26 11:41:42 +01:00
|
|
|
TcInMemConverter: EcssTcInMemConverter,
|
|
|
|
VerificationReporter: VerificationReportingProvider,
|
|
|
|
> {
|
2024-02-26 15:18:15 +01:00
|
|
|
event_srv: Pus5Wrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
|
|
|
hk_srv: Pus3Wrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
|
|
|
action_srv: Pus8Wrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
|
|
|
schedule_srv: Pus11Wrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
|
|
|
test_srv: Service17CustomWrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
2024-02-07 18:10:47 +01:00
|
|
|
}
|
|
|
|
|
2024-02-26 11:41:42 +01:00
|
|
|
impl<
|
2024-02-26 15:18:15 +01:00
|
|
|
TcReceiver: EcssTcReceiverCore,
|
|
|
|
TmSender: EcssTmSenderCore,
|
2024-02-26 11:41:42 +01:00
|
|
|
TcInMemConverter: EcssTcInMemConverter,
|
|
|
|
VerificationReporter: VerificationReportingProvider,
|
2024-02-26 15:18:15 +01:00
|
|
|
> PusStack<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>
|
2024-02-26 11:41:42 +01:00
|
|
|
{
|
2024-02-07 18:10:47 +01:00
|
|
|
pub fn new(
|
2024-02-26 15:18:15 +01:00
|
|
|
hk_srv: Pus3Wrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
|
|
|
event_srv: Pus5Wrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
|
|
|
action_srv: Pus8Wrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
|
|
|
schedule_srv: Pus11Wrapper<TcReceiver, TmSender, TcInMemConverter, VerificationReporter>,
|
|
|
|
test_srv: Service17CustomWrapper<
|
|
|
|
TcReceiver,
|
|
|
|
TmSender,
|
|
|
|
TcInMemConverter,
|
|
|
|
VerificationReporter,
|
|
|
|
>,
|
2024-02-07 18:10:47 +01:00
|
|
|
) -> Self {
|
|
|
|
Self {
|
|
|
|
event_srv,
|
|
|
|
action_srv,
|
|
|
|
schedule_srv,
|
|
|
|
test_srv,
|
|
|
|
hk_srv,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn periodic_operation(&mut self) {
|
|
|
|
self.schedule_srv.release_tcs();
|
|
|
|
loop {
|
|
|
|
let mut all_queues_empty = true;
|
|
|
|
let mut is_srv_finished = |srv_handler_finished: bool| {
|
|
|
|
if !srv_handler_finished {
|
|
|
|
all_queues_empty = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
is_srv_finished(self.test_srv.handle_next_packet());
|
|
|
|
is_srv_finished(self.schedule_srv.handle_next_packet());
|
|
|
|
is_srv_finished(self.event_srv.handle_next_packet());
|
|
|
|
is_srv_finished(self.action_srv.handle_next_packet());
|
|
|
|
is_srv_finished(self.hk_srv.handle_next_packet());
|
|
|
|
if all_queues_empty {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|