2024-02-26 11:41:42 +01:00
|
|
|
use satrs::pus::{verification::VerificationReportingProvider, EcssTcInMemConverter};
|
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<
|
|
|
|
TcInMemConverter: EcssTcInMemConverter,
|
|
|
|
VerificationReporter: VerificationReportingProvider,
|
|
|
|
> {
|
|
|
|
event_srv: Pus5Wrapper<TcInMemConverter, VerificationReporter>,
|
|
|
|
hk_srv: Pus3Wrapper<TcInMemConverter, VerificationReporter>,
|
|
|
|
action_srv: Pus8Wrapper<TcInMemConverter, VerificationReporter>,
|
|
|
|
schedule_srv: Pus11Wrapper<TcInMemConverter, VerificationReporter>,
|
|
|
|
test_srv: Service17CustomWrapper<TcInMemConverter, VerificationReporter>,
|
2024-02-07 18:10:47 +01:00
|
|
|
}
|
|
|
|
|
2024-02-26 11:41:42 +01:00
|
|
|
impl<
|
|
|
|
TcInMemConverter: EcssTcInMemConverter,
|
|
|
|
VerificationReporter: VerificationReportingProvider,
|
|
|
|
> PusStack<TcInMemConverter, VerificationReporter>
|
|
|
|
{
|
2024-02-07 18:10:47 +01:00
|
|
|
pub fn new(
|
2024-02-26 11:41:42 +01:00
|
|
|
hk_srv: Pus3Wrapper<TcInMemConverter, VerificationReporter>,
|
|
|
|
event_srv: Pus5Wrapper<TcInMemConverter, VerificationReporter>,
|
|
|
|
action_srv: Pus8Wrapper<TcInMemConverter, VerificationReporter>,
|
|
|
|
schedule_srv: Pus11Wrapper<TcInMemConverter, VerificationReporter>,
|
|
|
|
test_srv: Service17CustomWrapper<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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|