simplifications for verification reporter
This commit is contained in:
parent
831cb46059
commit
bc65cae3ec
@ -97,7 +97,6 @@ pub use alloc_mod::{
|
|||||||
VerificationReporter, VerificationReporterCfg, VerificationReporterWithSender,
|
VerificationReporter, VerificationReporterCfg, VerificationReporterWithSender,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::seq_count::SequenceCountProviderCore;
|
|
||||||
#[cfg(all(feature = "crossbeam", feature = "std"))]
|
#[cfg(all(feature = "crossbeam", feature = "std"))]
|
||||||
pub use stdmod::CrossbeamVerifSender;
|
pub use stdmod::CrossbeamVerifSender;
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
@ -316,14 +315,6 @@ pub struct VerificationReporterCore {
|
|||||||
apid: u16,
|
apid: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn increment_seq_counter(
|
|
||||||
seq_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
) {
|
|
||||||
if let Some(seq_counter) = seq_counter {
|
|
||||||
seq_counter.increment();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub enum VerifSuccess {}
|
pub enum VerifSuccess {}
|
||||||
pub enum VerifFailure {}
|
pub enum VerifFailure {}
|
||||||
|
|
||||||
@ -366,14 +357,7 @@ impl<'src_data, State, SuccessOrFailure> VerificationSendable<'src_data, State,
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'src_data, State> VerificationSendable<'src_data, State, VerifFailure> {
|
impl<'src_data, State> VerificationSendable<'src_data, State, VerifFailure> {
|
||||||
pub fn send_success_verif_failure(
|
pub fn send_success_verif_failure(self) {}
|
||||||
self,
|
|
||||||
seq_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
msg_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
) {
|
|
||||||
increment_seq_counter(seq_counter);
|
|
||||||
increment_seq_counter(msg_counter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'src_data, State> VerificationSendable<'src_data, State, VerifFailure> {
|
impl<'src_data, State> VerificationSendable<'src_data, State, VerifFailure> {
|
||||||
@ -383,13 +367,7 @@ impl<'src_data, State> VerificationSendable<'src_data, State, VerifFailure> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'src_data> VerificationSendable<'src_data, TcStateNone, VerifSuccess> {
|
impl<'src_data> VerificationSendable<'src_data, TcStateNone, VerifSuccess> {
|
||||||
pub fn send_success_acceptance_success(
|
pub fn send_success_acceptance_success(self) -> VerificationToken<TcStateAccepted> {
|
||||||
self,
|
|
||||||
seq_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
msg_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
) -> VerificationToken<TcStateAccepted> {
|
|
||||||
increment_seq_counter(seq_counter);
|
|
||||||
increment_seq_counter(msg_counter);
|
|
||||||
VerificationToken {
|
VerificationToken {
|
||||||
state: PhantomData,
|
state: PhantomData,
|
||||||
req_id: self.token.unwrap().req_id(),
|
req_id: self.token.unwrap().req_id(),
|
||||||
@ -398,13 +376,7 @@ impl<'src_data> VerificationSendable<'src_data, TcStateNone, VerifSuccess> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'src_data> VerificationSendable<'src_data, TcStateAccepted, VerifSuccess> {
|
impl<'src_data> VerificationSendable<'src_data, TcStateAccepted, VerifSuccess> {
|
||||||
pub fn send_success_start_success(
|
pub fn send_success_start_success(self) -> VerificationToken<TcStateStarted> {
|
||||||
self,
|
|
||||||
seq_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
msg_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
) -> VerificationToken<TcStateStarted> {
|
|
||||||
increment_seq_counter(seq_counter);
|
|
||||||
increment_seq_counter(msg_counter);
|
|
||||||
VerificationToken {
|
VerificationToken {
|
||||||
state: PhantomData,
|
state: PhantomData,
|
||||||
req_id: self.token.unwrap().req_id(),
|
req_id: self.token.unwrap().req_id(),
|
||||||
@ -415,14 +387,7 @@ impl<'src_data> VerificationSendable<'src_data, TcStateAccepted, VerifSuccess> {
|
|||||||
impl<'src_data, TcState: WasAtLeastAccepted + Copy>
|
impl<'src_data, TcState: WasAtLeastAccepted + Copy>
|
||||||
VerificationSendable<'src_data, TcState, VerifSuccess>
|
VerificationSendable<'src_data, TcState, VerifSuccess>
|
||||||
{
|
{
|
||||||
pub fn send_success_step_or_completion_success(
|
pub fn send_success_step_or_completion_success(self) {}
|
||||||
self,
|
|
||||||
seq_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
msg_counter: Option<&(impl SequenceCountProviderCore<u16> + ?Sized)>,
|
|
||||||
) {
|
|
||||||
increment_seq_counter(seq_counter);
|
|
||||||
increment_seq_counter(msg_counter);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Primary verification handler. It provides an API to send PUS 1 verification telemetry packets
|
/// Primary verification handler. It provides an API to send PUS 1 verification telemetry packets
|
||||||
@ -477,8 +442,8 @@ impl VerificationReporterCore {
|
|||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
subservice: u8,
|
subservice: u8,
|
||||||
token: VerificationToken<State>,
|
token: VerificationToken<State>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
time_stamp: Option<&'src_data [u8]>,
|
time_stamp: Option<&'src_data [u8]>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationSendable<'src_data, State, VerifSuccess>,
|
VerificationSendable<'src_data, State, VerifSuccess>,
|
||||||
@ -488,8 +453,8 @@ impl VerificationReporterCore {
|
|||||||
self.create_pus_verif_success_tm(
|
self.create_pus_verif_success_tm(
|
||||||
src_data_buf,
|
src_data_buf,
|
||||||
subservice,
|
subservice,
|
||||||
seq_counter.get(),
|
seq_count,
|
||||||
msg_counter.get(),
|
msg_count,
|
||||||
&token.req_id,
|
&token.req_id,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
None::<&dyn EcssEnumeration>,
|
None::<&dyn EcssEnumeration>,
|
||||||
@ -506,8 +471,8 @@ impl VerificationReporterCore {
|
|||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
subservice: u8,
|
subservice: u8,
|
||||||
token: VerificationToken<State>,
|
token: VerificationToken<State>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
step: Option<&(impl EcssEnumeration + ?Sized)>,
|
step: Option<&(impl EcssEnumeration + ?Sized)>,
|
||||||
params: &FailParams<'src_data, '_>,
|
params: &FailParams<'src_data, '_>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
@ -518,8 +483,8 @@ impl VerificationReporterCore {
|
|||||||
self.create_pus_verif_fail_tm(
|
self.create_pus_verif_fail_tm(
|
||||||
src_data_buf,
|
src_data_buf,
|
||||||
subservice,
|
subservice,
|
||||||
seq_counter.get(),
|
seq_count,
|
||||||
msg_counter.get(),
|
msg_count,
|
||||||
&token.req_id,
|
&token.req_id,
|
||||||
step,
|
step,
|
||||||
params,
|
params,
|
||||||
@ -534,8 +499,8 @@ impl VerificationReporterCore {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
token: VerificationToken<TcStateNone>,
|
token: VerificationToken<TcStateNone>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
time_stamp: Option<&'src_data [u8]>,
|
time_stamp: Option<&'src_data [u8]>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationSendable<'src_data, TcStateNone, VerifSuccess>,
|
VerificationSendable<'src_data, TcStateNone, VerifSuccess>,
|
||||||
@ -545,8 +510,8 @@ impl VerificationReporterCore {
|
|||||||
src_data_buf,
|
src_data_buf,
|
||||||
Subservice::TmAcceptanceSuccess.into(),
|
Subservice::TmAcceptanceSuccess.into(),
|
||||||
token,
|
token,
|
||||||
seq_counter,
|
seq_count,
|
||||||
msg_counter,
|
msg_count,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -554,8 +519,6 @@ impl VerificationReporterCore {
|
|||||||
pub fn send_acceptance_success<E>(
|
pub fn send_acceptance_success<E>(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcStateNone, VerifSuccess>,
|
mut sendable: VerificationSendable<'_, TcStateNone, VerifSuccess>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||||
) -> Result<VerificationToken<TcStateAccepted>, VerificationOrSendErrorWithToken<E, TcStateNone>>
|
) -> Result<VerificationToken<TcStateAccepted>, VerificationOrSendErrorWithToken<E, TcStateNone>>
|
||||||
{
|
{
|
||||||
@ -567,14 +530,12 @@ impl VerificationReporterCore {
|
|||||||
sendable.token.unwrap(),
|
sendable.token.unwrap(),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
Ok(sendable.send_success_acceptance_success(Some(seq_counter), Some(msg_counter)))
|
Ok(sendable.send_success_acceptance_success())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_acceptance_failure<E>(
|
pub fn send_acceptance_failure<E>(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcStateNone, VerifFailure>,
|
mut sendable: VerificationSendable<'_, TcStateNone, VerifFailure>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||||
) -> Result<(), VerificationOrSendErrorWithToken<E, TcStateNone>> {
|
) -> Result<(), VerificationOrSendErrorWithToken<E, TcStateNone>> {
|
||||||
sender
|
sender
|
||||||
@ -585,7 +546,7 @@ impl VerificationReporterCore {
|
|||||||
sendable.token.unwrap(),
|
sendable.token.unwrap(),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
sendable.send_success_verif_failure(Some(seq_counter), Some(msg_counter));
|
sendable.send_success_verif_failure();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -594,8 +555,8 @@ impl VerificationReporterCore {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
token: VerificationToken<TcStateNone>,
|
token: VerificationToken<TcStateNone>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
params: FailParams<'src_data, '_>,
|
params: FailParams<'src_data, '_>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationSendable<'src_data, TcStateNone, VerifFailure>,
|
VerificationSendable<'src_data, TcStateNone, VerifFailure>,
|
||||||
@ -605,8 +566,8 @@ impl VerificationReporterCore {
|
|||||||
src_data_buf,
|
src_data_buf,
|
||||||
Subservice::TmAcceptanceFailure.into(),
|
Subservice::TmAcceptanceFailure.into(),
|
||||||
token,
|
token,
|
||||||
seq_counter,
|
seq_count,
|
||||||
msg_counter,
|
msg_count,
|
||||||
None::<&dyn EcssEnumeration>,
|
None::<&dyn EcssEnumeration>,
|
||||||
¶ms,
|
¶ms,
|
||||||
)
|
)
|
||||||
@ -619,8 +580,8 @@ impl VerificationReporterCore {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
token: VerificationToken<TcStateAccepted>,
|
token: VerificationToken<TcStateAccepted>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
time_stamp: Option<&'src_data [u8]>,
|
time_stamp: Option<&'src_data [u8]>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationSendable<'src_data, TcStateAccepted, VerifSuccess>,
|
VerificationSendable<'src_data, TcStateAccepted, VerifSuccess>,
|
||||||
@ -630,8 +591,8 @@ impl VerificationReporterCore {
|
|||||||
src_data_buf,
|
src_data_buf,
|
||||||
Subservice::TmStartSuccess.into(),
|
Subservice::TmStartSuccess.into(),
|
||||||
token,
|
token,
|
||||||
seq_counter,
|
seq_count,
|
||||||
msg_counter,
|
msg_count,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -639,8 +600,6 @@ impl VerificationReporterCore {
|
|||||||
pub fn send_start_success<E>(
|
pub fn send_start_success<E>(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifSuccess>,
|
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifSuccess>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationToken<TcStateStarted>,
|
VerificationToken<TcStateStarted>,
|
||||||
@ -654,7 +613,7 @@ impl VerificationReporterCore {
|
|||||||
sendable.token.unwrap(),
|
sendable.token.unwrap(),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
Ok(sendable.send_success_start_success(Some(seq_counter), Some(msg_counter)))
|
Ok(sendable.send_success_start_success())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 4\] packet, see 8.1.2.4 of the PUS standard.
|
/// Package and send a PUS TM\[1, 4\] packet, see 8.1.2.4 of the PUS standard.
|
||||||
@ -665,8 +624,8 @@ impl VerificationReporterCore {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
token: VerificationToken<TcStateAccepted>,
|
token: VerificationToken<TcStateAccepted>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
params: FailParams<'src_data, '_>,
|
params: FailParams<'src_data, '_>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationSendable<'src_data, TcStateAccepted, VerifFailure>,
|
VerificationSendable<'src_data, TcStateAccepted, VerifFailure>,
|
||||||
@ -676,8 +635,8 @@ impl VerificationReporterCore {
|
|||||||
src_data_buf,
|
src_data_buf,
|
||||||
Subservice::TmStartFailure.into(),
|
Subservice::TmStartFailure.into(),
|
||||||
token,
|
token,
|
||||||
seq_counter,
|
seq_count,
|
||||||
msg_counter,
|
msg_count,
|
||||||
None::<&dyn EcssEnumeration>,
|
None::<&dyn EcssEnumeration>,
|
||||||
¶ms,
|
¶ms,
|
||||||
)
|
)
|
||||||
@ -686,8 +645,6 @@ impl VerificationReporterCore {
|
|||||||
pub fn send_start_failure<E>(
|
pub fn send_start_failure<E>(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifFailure>,
|
mut sendable: VerificationSendable<'_, TcStateAccepted, VerifFailure>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||||
) -> Result<(), VerificationOrSendErrorWithToken<E, TcStateAccepted>> {
|
) -> Result<(), VerificationOrSendErrorWithToken<E, TcStateAccepted>> {
|
||||||
sender
|
sender
|
||||||
@ -698,7 +655,7 @@ impl VerificationReporterCore {
|
|||||||
sendable.token.unwrap(),
|
sendable.token.unwrap(),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
sendable.send_success_verif_failure(Some(seq_counter), Some(msg_counter));
|
sendable.send_success_verif_failure();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,8 +666,8 @@ impl VerificationReporterCore {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
token: &VerificationToken<TcStateStarted>,
|
token: &VerificationToken<TcStateStarted>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
time_stamp: Option<&'src_data [u8]>,
|
time_stamp: Option<&'src_data [u8]>,
|
||||||
step: impl EcssEnumeration,
|
step: impl EcssEnumeration,
|
||||||
) -> Result<VerificationSendable<'src_data, TcStateStarted, VerifSuccess>, EcssTmtcError> {
|
) -> Result<VerificationSendable<'src_data, TcStateStarted, VerifSuccess>, EcssTmtcError> {
|
||||||
@ -718,8 +675,8 @@ impl VerificationReporterCore {
|
|||||||
self.create_pus_verif_success_tm(
|
self.create_pus_verif_success_tm(
|
||||||
src_data_buf,
|
src_data_buf,
|
||||||
Subservice::TmStepSuccess.into(),
|
Subservice::TmStepSuccess.into(),
|
||||||
seq_counter.get(),
|
seq_count,
|
||||||
msg_counter.get(),
|
msg_count,
|
||||||
&token.req_id,
|
&token.req_id,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
Some(&step),
|
Some(&step),
|
||||||
@ -735,8 +692,8 @@ impl VerificationReporterCore {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
token: VerificationToken<TcStateStarted>,
|
token: VerificationToken<TcStateStarted>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
params: FailParamsWithStep<'src_data, '_>,
|
params: FailParamsWithStep<'src_data, '_>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationSendable<'src_data, TcStateStarted, VerifFailure>,
|
VerificationSendable<'src_data, TcStateStarted, VerifFailure>,
|
||||||
@ -746,8 +703,8 @@ impl VerificationReporterCore {
|
|||||||
self.create_pus_verif_fail_tm(
|
self.create_pus_verif_fail_tm(
|
||||||
src_data_buf,
|
src_data_buf,
|
||||||
Subservice::TmStepFailure.into(),
|
Subservice::TmStepFailure.into(),
|
||||||
seq_counter.get(),
|
seq_count,
|
||||||
msg_counter.get(),
|
msg_count,
|
||||||
&token.req_id,
|
&token.req_id,
|
||||||
Some(params.step),
|
Some(params.step),
|
||||||
¶ms.bp,
|
¶ms.bp,
|
||||||
@ -765,8 +722,8 @@ impl VerificationReporterCore {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
token: VerificationToken<TcState>,
|
token: VerificationToken<TcState>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_counter: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_counter: u16,
|
||||||
time_stamp: Option<&'src_data [u8]>,
|
time_stamp: Option<&'src_data [u8]>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationSendable<'src_data, TcState, VerifSuccess>,
|
VerificationSendable<'src_data, TcState, VerifSuccess>,
|
||||||
@ -790,8 +747,8 @@ impl VerificationReporterCore {
|
|||||||
&mut self,
|
&mut self,
|
||||||
src_data_buf: &'src_data mut [u8],
|
src_data_buf: &'src_data mut [u8],
|
||||||
token: VerificationToken<TcState>,
|
token: VerificationToken<TcState>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
seq_count: u16,
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
msg_count: u16,
|
||||||
params: FailParams<'src_data, '_>,
|
params: FailParams<'src_data, '_>,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
VerificationSendable<'src_data, TcState, VerifFailure>,
|
VerificationSendable<'src_data, TcState, VerifFailure>,
|
||||||
@ -801,8 +758,8 @@ impl VerificationReporterCore {
|
|||||||
src_data_buf,
|
src_data_buf,
|
||||||
Subservice::TmCompletionFailure.into(),
|
Subservice::TmCompletionFailure.into(),
|
||||||
token,
|
token,
|
||||||
seq_counter,
|
seq_count,
|
||||||
msg_counter,
|
msg_count,
|
||||||
None::<&dyn EcssEnumeration>,
|
None::<&dyn EcssEnumeration>,
|
||||||
¶ms,
|
¶ms,
|
||||||
)
|
)
|
||||||
@ -811,8 +768,6 @@ impl VerificationReporterCore {
|
|||||||
pub fn send_step_or_completion_success<E, TcState: WasAtLeastAccepted + Copy>(
|
pub fn send_step_or_completion_success<E, TcState: WasAtLeastAccepted + Copy>(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcState, VerifSuccess>,
|
mut sendable: VerificationSendable<'_, TcState, VerifSuccess>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||||
) -> Result<(), VerificationOrSendErrorWithToken<E, TcState>> {
|
) -> Result<(), VerificationOrSendErrorWithToken<E, TcState>> {
|
||||||
sender
|
sender
|
||||||
@ -823,15 +778,13 @@ impl VerificationReporterCore {
|
|||||||
sendable.token.unwrap(),
|
sendable.token.unwrap(),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
sendable.send_success_step_or_completion_success(Some(seq_counter), Some(msg_counter));
|
sendable.send_success_step_or_completion_success();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_step_or_completion_failure<E, TcState: WasAtLeastAccepted + Copy>(
|
pub fn send_step_or_completion_failure<E, TcState: WasAtLeastAccepted + Copy>(
|
||||||
&self,
|
&self,
|
||||||
mut sendable: VerificationSendable<'_, TcState, VerifFailure>,
|
mut sendable: VerificationSendable<'_, TcState, VerifFailure>,
|
||||||
seq_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
msg_counter: &(impl SequenceCountProviderCore<u16> + ?Sized),
|
|
||||||
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
sender: &mut (impl EcssTmSenderCore<Error = E> + ?Sized),
|
||||||
) -> Result<(), VerificationOrSendErrorWithToken<E, TcState>> {
|
) -> Result<(), VerificationOrSendErrorWithToken<E, TcState>> {
|
||||||
sender
|
sender
|
||||||
@ -842,7 +795,7 @@ impl VerificationReporterCore {
|
|||||||
sendable.token.unwrap(),
|
sendable.token.unwrap(),
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
sendable.send_success_verif_failure(Some(seq_counter), Some(msg_counter));
|
sendable.send_success_verif_failure();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -953,7 +906,6 @@ impl VerificationReporterCore {
|
|||||||
mod alloc_mod {
|
mod alloc_mod {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::pus::alloc_mod::EcssTmSender;
|
use crate::pus::alloc_mod::EcssTmSender;
|
||||||
use crate::seq_count::SequenceCountProvider;
|
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
use alloc::vec;
|
use alloc::vec;
|
||||||
use alloc::vec::Vec;
|
use alloc::vec::Vec;
|
||||||
@ -961,8 +913,6 @@ mod alloc_mod {
|
|||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct VerificationReporterCfg {
|
pub struct VerificationReporterCfg {
|
||||||
apid: u16,
|
apid: u16,
|
||||||
seq_counter: Box<dyn SequenceCountProvider<u16> + Send>,
|
|
||||||
msg_counter: Box<dyn SequenceCountProvider<u16> + Send>,
|
|
||||||
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,
|
||||||
@ -971,8 +921,6 @@ mod alloc_mod {
|
|||||||
impl VerificationReporterCfg {
|
impl VerificationReporterCfg {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
apid: u16,
|
apid: u16,
|
||||||
seq_counter: Box<dyn SequenceCountProvider<u16> + Send>,
|
|
||||||
msg_counter: Box<dyn SequenceCountProvider<u16> + Send>,
|
|
||||||
step_field_width: usize,
|
step_field_width: usize,
|
||||||
fail_code_field_width: usize,
|
fail_code_field_width: usize,
|
||||||
max_fail_data_len: usize,
|
max_fail_data_len: usize,
|
||||||
@ -982,8 +930,6 @@ mod alloc_mod {
|
|||||||
}
|
}
|
||||||
Some(Self {
|
Some(Self {
|
||||||
apid,
|
apid,
|
||||||
seq_counter,
|
|
||||||
msg_counter,
|
|
||||||
step_field_width,
|
step_field_width,
|
||||||
fail_code_field_width,
|
fail_code_field_width,
|
||||||
max_fail_data_len,
|
max_fail_data_len,
|
||||||
@ -993,11 +939,11 @@ mod alloc_mod {
|
|||||||
|
|
||||||
/// Primary verification handler. It provides an API to send PUS 1 verification telemetry packets
|
/// Primary verification handler. It provides an API to send PUS 1 verification telemetry packets
|
||||||
/// and verify the various steps of telecommand handling as specified in the PUS standard.
|
/// and verify the various steps of telecommand handling as specified in the PUS standard.
|
||||||
|
/// It is assumed that the sequence counter and message counters are written in a central
|
||||||
|
/// TM funnel. This helper will always set those fields to 0.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct VerificationReporter {
|
pub struct VerificationReporter {
|
||||||
source_data_buf: Vec<u8>,
|
source_data_buf: Vec<u8>,
|
||||||
seq_counter: Box<dyn SequenceCountProvider<u16> + Send + 'static>,
|
|
||||||
msg_counter: Box<dyn SequenceCountProvider<u16> + Send + 'static>,
|
|
||||||
pub reporter: VerificationReporterCore,
|
pub reporter: VerificationReporterCore,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,8 +958,6 @@ mod alloc_mod {
|
|||||||
+ cfg.fail_code_field_width
|
+ cfg.fail_code_field_width
|
||||||
+ cfg.max_fail_data_len
|
+ cfg.max_fail_data_len
|
||||||
],
|
],
|
||||||
seq_counter: cfg.seq_counter.clone(),
|
|
||||||
msg_counter: cfg.msg_counter.clone(),
|
|
||||||
reporter,
|
reporter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1046,16 +990,11 @@ mod alloc_mod {
|
|||||||
let sendable = self.reporter.acceptance_success(
|
let sendable = self.reporter.acceptance_success(
|
||||||
self.source_data_buf.as_mut_slice(),
|
self.source_data_buf.as_mut_slice(),
|
||||||
token,
|
token,
|
||||||
self.seq_counter.as_ref(),
|
0,
|
||||||
self.msg_counter.as_ref(),
|
0,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
)?;
|
)?;
|
||||||
self.reporter.send_acceptance_success(
|
self.reporter.send_acceptance_success(sendable, sender)
|
||||||
sendable,
|
|
||||||
self.seq_counter.as_ref(),
|
|
||||||
self.msg_counter.as_ref(),
|
|
||||||
sender,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 2\] packet, see 8.1.2.2 of the PUS standard
|
/// Package and send a PUS TM\[1, 2\] packet, see 8.1.2.2 of the PUS standard
|
||||||
@ -1068,16 +1007,11 @@ mod alloc_mod {
|
|||||||
let sendable = self.reporter.acceptance_failure(
|
let sendable = self.reporter.acceptance_failure(
|
||||||
self.source_data_buf.as_mut_slice(),
|
self.source_data_buf.as_mut_slice(),
|
||||||
token,
|
token,
|
||||||
self.seq_counter.as_ref(),
|
0,
|
||||||
self.msg_counter.as_ref(),
|
0,
|
||||||
params,
|
params,
|
||||||
)?;
|
)?;
|
||||||
self.reporter.send_acceptance_failure(
|
self.reporter.send_acceptance_failure(sendable, sender)
|
||||||
sendable,
|
|
||||||
self.seq_counter.as_ref(),
|
|
||||||
self.msg_counter.as_ref(),
|
|
||||||
sender,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 3\] packet, see 8.1.2.3 of the PUS standard.
|
/// Package and send a PUS TM\[1, 3\] packet, see 8.1.2.3 of the PUS standard.
|
||||||
@ -1095,16 +1029,11 @@ mod alloc_mod {
|
|||||||
let sendable = self.reporter.start_success(
|
let sendable = self.reporter.start_success(
|
||||||
self.source_data_buf.as_mut_slice(),
|
self.source_data_buf.as_mut_slice(),
|
||||||
token,
|
token,
|
||||||
self.seq_counter.as_mut(),
|
0,
|
||||||
self.msg_counter.as_mut(),
|
0,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
)?;
|
)?;
|
||||||
self.reporter.send_start_success(
|
self.reporter.send_start_success(sendable, sender)
|
||||||
sendable,
|
|
||||||
self.seq_counter.as_ref(),
|
|
||||||
self.msg_counter.as_ref(),
|
|
||||||
sender,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 4\] packet, see 8.1.2.4 of the PUS standard.
|
/// Package and send a PUS TM\[1, 4\] packet, see 8.1.2.4 of the PUS standard.
|
||||||
@ -1120,16 +1049,11 @@ mod alloc_mod {
|
|||||||
let sendable = self.reporter.start_failure(
|
let sendable = self.reporter.start_failure(
|
||||||
self.source_data_buf.as_mut_slice(),
|
self.source_data_buf.as_mut_slice(),
|
||||||
token,
|
token,
|
||||||
self.seq_counter.as_mut(),
|
0,
|
||||||
self.msg_counter.as_mut(),
|
0,
|
||||||
params,
|
params,
|
||||||
)?;
|
)?;
|
||||||
self.reporter.send_start_failure(
|
self.reporter.send_start_failure(sendable, sender)
|
||||||
sendable,
|
|
||||||
self.seq_counter.as_ref(),
|
|
||||||
self.msg_counter.as_ref(),
|
|
||||||
sender,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 5\] packet, see 8.1.2.5 of the PUS standard.
|
/// Package and send a PUS TM\[1, 5\] packet, see 8.1.2.5 of the PUS standard.
|
||||||
@ -1145,18 +1069,13 @@ mod alloc_mod {
|
|||||||
let sendable = self.reporter.step_success(
|
let sendable = self.reporter.step_success(
|
||||||
self.source_data_buf.as_mut_slice(),
|
self.source_data_buf.as_mut_slice(),
|
||||||
token,
|
token,
|
||||||
self.seq_counter.as_mut(),
|
0,
|
||||||
self.msg_counter.as_mut(),
|
0,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
step,
|
step,
|
||||||
)?;
|
)?;
|
||||||
self.reporter
|
self.reporter
|
||||||
.send_step_or_completion_success(
|
.send_step_or_completion_success(sendable, sender)
|
||||||
sendable,
|
|
||||||
self.seq_counter.as_ref(),
|
|
||||||
self.msg_counter.as_ref(),
|
|
||||||
sender,
|
|
||||||
)
|
|
||||||
.map_err(|e| e.0)
|
.map_err(|e| e.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1173,16 +1092,12 @@ mod alloc_mod {
|
|||||||
let sendable = self.reporter.step_failure(
|
let sendable = self.reporter.step_failure(
|
||||||
self.source_data_buf.as_mut_slice(),
|
self.source_data_buf.as_mut_slice(),
|
||||||
token,
|
token,
|
||||||
self.seq_counter.as_mut(),
|
0,
|
||||||
self.msg_counter.as_mut(),
|
0,
|
||||||
params,
|
params,
|
||||||
)?;
|
)?;
|
||||||
self.reporter.send_step_or_completion_failure(
|
self.reporter
|
||||||
sendable,
|
.send_step_or_completion_failure(sendable, sender)
|
||||||
self.seq_counter.as_ref(),
|
|
||||||
self.msg_counter.as_ref(),
|
|
||||||
sender,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 7\] packet, see 8.1.2.7 of the PUS standard.
|
/// Package and send a PUS TM\[1, 7\] packet, see 8.1.2.7 of the PUS standard.
|
||||||
@ -1198,16 +1113,12 @@ mod alloc_mod {
|
|||||||
let sendable = self.reporter.completion_success(
|
let sendable = self.reporter.completion_success(
|
||||||
self.source_data_buf.as_mut_slice(),
|
self.source_data_buf.as_mut_slice(),
|
||||||
token,
|
token,
|
||||||
self.seq_counter.as_mut(),
|
0,
|
||||||
self.msg_counter.as_mut(),
|
0,
|
||||||
time_stamp,
|
time_stamp,
|
||||||
)?;
|
)?;
|
||||||
self.reporter.send_step_or_completion_success(
|
self.reporter
|
||||||
sendable,
|
.send_step_or_completion_success(sendable, sender)
|
||||||
self.seq_counter.as_ref(),
|
|
||||||
self.msg_counter.as_ref(),
|
|
||||||
sender,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Package and send a PUS TM\[1, 8\] packet, see 8.1.2.8 of the PUS standard.
|
/// Package and send a PUS TM\[1, 8\] packet, see 8.1.2.8 of the PUS standard.
|
||||||
@ -1223,16 +1134,12 @@ mod alloc_mod {
|
|||||||
let sendable = self.reporter.completion_failure(
|
let sendable = self.reporter.completion_failure(
|
||||||
self.source_data_buf.as_mut_slice(),
|
self.source_data_buf.as_mut_slice(),
|
||||||
token,
|
token,
|
||||||
self.seq_counter.as_mut(),
|
0,
|
||||||
self.msg_counter.as_mut(),
|
0,
|
||||||
params,
|
params,
|
||||||
)?;
|
)?;
|
||||||
self.reporter.send_step_or_completion_failure(
|
self.reporter
|
||||||
sendable,
|
.send_step_or_completion_failure(sendable, sender)
|
||||||
self.seq_counter.as_ref(),
|
|
||||||
self.msg_counter.as_ref(),
|
|
||||||
sender,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,14 @@ pub struct SeqCountProviderSimple {
|
|||||||
seq_count: Cell<u16>,
|
seq_count: Cell<u16>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl SeqCountProviderSimple {
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
seq_count: Cell::new(0),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl SequenceCountProviderCore<u16> for SeqCountProviderSimple {
|
impl SequenceCountProviderCore<u16> for SeqCountProviderSimple {
|
||||||
fn get(&self) -> u16 {
|
fn get(&self) -> u16 {
|
||||||
self.seq_count.get()
|
self.seq_count.get()
|
||||||
|
@ -6,6 +6,7 @@ mod requests;
|
|||||||
mod tmtc;
|
mod tmtc;
|
||||||
|
|
||||||
use log::{info, warn};
|
use log::{info, warn};
|
||||||
|
use std::collections::hash_map::Entry;
|
||||||
|
|
||||||
use crate::hk::AcsHkIds;
|
use crate::hk::AcsHkIds;
|
||||||
use crate::logging::setup_logger;
|
use crate::logging::setup_logger;
|
||||||
@ -36,7 +37,8 @@ use satrs_core::pus::verification::{
|
|||||||
MpscVerifSender, VerificationReporterCfg, VerificationReporterWithSender,
|
MpscVerifSender, VerificationReporterCfg, VerificationReporterWithSender,
|
||||||
};
|
};
|
||||||
use satrs_core::pus::MpscTmtcInStoreSender;
|
use satrs_core::pus::MpscTmtcInStoreSender;
|
||||||
use satrs_core::seq_count::{SeqCountProviderSimple, SeqCountProviderSyncClonable};
|
use satrs_core::seq_count::{SeqCountProviderSimple, SequenceCountProviderCore};
|
||||||
|
use satrs_core::spacepackets::ecss::{PusPacket, SerializablePusPacket};
|
||||||
use satrs_core::spacepackets::{
|
use satrs_core::spacepackets::{
|
||||||
time::cds::TimeProvider,
|
time::cds::TimeProvider,
|
||||||
time::TimeWriter,
|
time::TimeWriter,
|
||||||
@ -65,6 +67,7 @@ fn main() {
|
|||||||
(15, 2048),
|
(15, 2048),
|
||||||
]));
|
]));
|
||||||
let tm_store = SharedTmStore::new(Arc::new(RwLock::new(Box::new(tm_pool))));
|
let tm_store = SharedTmStore::new(Arc::new(RwLock::new(Box::new(tm_pool))));
|
||||||
|
let tm_store_event = tm_store.clone();
|
||||||
let tc_pool = LocalPool::new(PoolCfg::new(vec![
|
let tc_pool = LocalPool::new(PoolCfg::new(vec![
|
||||||
(30, 32),
|
(30, 32),
|
||||||
(15, 64),
|
(15, 64),
|
||||||
@ -77,9 +80,8 @@ fn main() {
|
|||||||
pool: Arc::new(RwLock::new(Box::new(tc_pool))),
|
pool: Arc::new(RwLock::new(Box::new(tc_pool))),
|
||||||
};
|
};
|
||||||
|
|
||||||
let seq_count_provider = SeqCountProviderSyncClonable::default();
|
let seq_count_provider = SeqCountProviderSimple::new();
|
||||||
let seq_count_provider_verif = seq_count_provider.clone();
|
let mut msg_counter_map: HashMap<u8, u16> = HashMap::new();
|
||||||
let seq_count_provider_tmtc = seq_count_provider;
|
|
||||||
let sock_addr = SocketAddr::new(IpAddr::V4(OBSW_SERVER_ADDR), SERVER_PORT);
|
let sock_addr = SocketAddr::new(IpAddr::V4(OBSW_SERVER_ADDR), SERVER_PORT);
|
||||||
let (tc_source_tx, tc_source_rx) = channel();
|
let (tc_source_tx, tc_source_rx) = channel();
|
||||||
let (tm_funnel_tx, tm_funnel_rx) = channel();
|
let (tm_funnel_tx, tm_funnel_rx) = channel();
|
||||||
@ -90,16 +92,7 @@ fn main() {
|
|||||||
tm_store.backing_pool(),
|
tm_store.backing_pool(),
|
||||||
tm_funnel_tx.clone(),
|
tm_funnel_tx.clone(),
|
||||||
);
|
);
|
||||||
let verif_cfg = VerificationReporterCfg::new(
|
let verif_cfg = VerificationReporterCfg::new(PUS_APID, 1, 2, 8).unwrap();
|
||||||
PUS_APID,
|
|
||||||
Box::new(seq_count_provider_verif),
|
|
||||||
#[allow(clippy::box_default)]
|
|
||||||
Box::new(SeqCountProviderSimple::default()),
|
|
||||||
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.
|
||||||
let verif_reporter = VerificationReporterWithSender::new(&verif_cfg, Box::new(verif_sender));
|
let verif_reporter = VerificationReporterWithSender::new(&verif_cfg, Box::new(verif_sender));
|
||||||
@ -143,9 +136,7 @@ fn main() {
|
|||||||
sock_addr,
|
sock_addr,
|
||||||
verif_reporter: verif_reporter.clone(),
|
verif_reporter: verif_reporter.clone(),
|
||||||
event_sender,
|
event_sender,
|
||||||
// event_request_tx,
|
|
||||||
request_map,
|
request_map,
|
||||||
seq_count_provider: seq_count_provider_tmtc,
|
|
||||||
};
|
};
|
||||||
let tc_args = TcArgs {
|
let tc_args = TcArgs {
|
||||||
tc_source: tc_source_wrapper.clone(),
|
tc_source: tc_source_wrapper.clone(),
|
||||||
@ -222,12 +213,32 @@ fn main() {
|
|||||||
let jh1 = thread::Builder::new()
|
let jh1 = thread::Builder::new()
|
||||||
.name("TM Funnel".to_string())
|
.name("TM Funnel".to_string())
|
||||||
.spawn(move || {
|
.spawn(move || {
|
||||||
|
let mut tm_buf: [u8; 2048] = [0; 2048];
|
||||||
let tm_funnel = TmFunnel {
|
let tm_funnel = TmFunnel {
|
||||||
tm_server_tx,
|
tm_server_tx,
|
||||||
tm_funnel_rx,
|
tm_funnel_rx,
|
||||||
};
|
};
|
||||||
loop {
|
loop {
|
||||||
if let Ok(addr) = tm_funnel.tm_funnel_rx.recv() {
|
if let Ok(addr) = tm_funnel.tm_funnel_rx.recv() {
|
||||||
|
// Read the TM, set sequence counter and message counter, and finally write
|
||||||
|
// it back with the updated CRC
|
||||||
|
let shared_pool = tm_store.backing_pool();
|
||||||
|
let mut pool_guard = shared_pool.write().expect("Locking TM pool failed");
|
||||||
|
let tm_raw = pool_guard
|
||||||
|
.modify(&addr)
|
||||||
|
.expect("Reading TM from pool failed");
|
||||||
|
tm_buf[0..tm_raw.len()].copy_from_slice(&tm_raw);
|
||||||
|
let (mut tm, size) =
|
||||||
|
PusTm::from_bytes(&tm_buf, 7).expect("Creating TM from raw slice failed");
|
||||||
|
tm.sp_header.set_apid(PUS_APID);
|
||||||
|
tm.sp_header
|
||||||
|
.set_seq_count(seq_count_provider.get_and_increment());
|
||||||
|
let entry = msg_counter_map.entry(tm.service()).or_insert(0);
|
||||||
|
tm.sec_header.msg_counter = *entry;
|
||||||
|
*entry += 1;
|
||||||
|
tm.calc_crc_on_serialization = true;
|
||||||
|
tm.write_to_bytes(tm_raw)
|
||||||
|
.expect("Writing PUS TM back failed");
|
||||||
tm_funnel
|
tm_funnel
|
||||||
.tm_server_tx
|
.tm_server_tx
|
||||||
.send(addr)
|
.send(addr)
|
||||||
@ -245,7 +256,7 @@ fn main() {
|
|||||||
let mut sender = MpscTmtcInStoreSender::new(
|
let mut sender = MpscTmtcInStoreSender::new(
|
||||||
1,
|
1,
|
||||||
"event_sender",
|
"event_sender",
|
||||||
tm_store.backing_pool(),
|
tm_store_event.backing_pool(),
|
||||||
tm_funnel_tx,
|
tm_funnel_tx,
|
||||||
);
|
);
|
||||||
let mut time_provider = TimeProvider::new_with_u16_days(0, 0);
|
let mut time_provider = TimeProvider::new_with_u16_days(0, 0);
|
||||||
|
@ -4,7 +4,6 @@ use satrs_core::params::Params;
|
|||||||
use satrs_core::pool::StoreAddr;
|
use satrs_core::pool::StoreAddr;
|
||||||
use satrs_core::pus::verification::{FailParams, StdVerifReporterWithSender};
|
use satrs_core::pus::verification::{FailParams, StdVerifReporterWithSender};
|
||||||
use satrs_core::pus::AcceptedTc;
|
use satrs_core::pus::AcceptedTc;
|
||||||
use satrs_core::seq_count::SeqCountProviderSyncClonable;
|
|
||||||
use satrs_core::spacepackets::ecss::PusServiceId;
|
use satrs_core::spacepackets::ecss::PusServiceId;
|
||||||
use satrs_core::spacepackets::tc::PusTc;
|
use satrs_core::spacepackets::tc::PusTc;
|
||||||
use satrs_core::spacepackets::time::cds::TimeProvider;
|
use satrs_core::spacepackets::time::cds::TimeProvider;
|
||||||
@ -35,8 +34,6 @@ pub struct PusReceiver {
|
|||||||
pub struct PusTmArgs {
|
pub struct PusTmArgs {
|
||||||
/// All verification reporting is done with this reporter.
|
/// All verification reporting is done with this reporter.
|
||||||
pub verif_reporter: StdVerifReporterWithSender,
|
pub verif_reporter: StdVerifReporterWithSender,
|
||||||
/// Sequence count provider for TMs sent from within pus demultiplexer
|
|
||||||
pub seq_count_provider: SeqCountProviderSyncClonable,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PusTmArgs {
|
impl PusTmArgs {
|
||||||
|
@ -15,7 +15,6 @@ use crate::pus::{PusReceiver, PusTcArgs, PusTcMpscRouter, PusTmArgs};
|
|||||||
use crate::requests::RequestWithToken;
|
use crate::requests::RequestWithToken;
|
||||||
use satrs_core::pool::{SharedPool, StoreAddr, StoreError};
|
use satrs_core::pool::{SharedPool, StoreAddr, StoreError};
|
||||||
use satrs_core::pus::verification::StdVerifReporterWithSender;
|
use satrs_core::pus::verification::StdVerifReporterWithSender;
|
||||||
use satrs_core::seq_count::SeqCountProviderSyncClonable;
|
|
||||||
use satrs_core::spacepackets::ecss::{PusPacket, SerializablePusPacket};
|
use satrs_core::spacepackets::ecss::{PusPacket, SerializablePusPacket};
|
||||||
use satrs_core::spacepackets::tc::PusTc;
|
use satrs_core::spacepackets::tc::PusTc;
|
||||||
use satrs_core::spacepackets::SpHeader;
|
use satrs_core::spacepackets::SpHeader;
|
||||||
@ -29,7 +28,6 @@ pub struct OtherArgs {
|
|||||||
pub verif_reporter: StdVerifReporterWithSender,
|
pub verif_reporter: StdVerifReporterWithSender,
|
||||||
pub event_sender: Sender<(EventU32, Option<Params>)>,
|
pub event_sender: Sender<(EventU32, Option<Params>)>,
|
||||||
pub request_map: HashMap<u32, Sender<RequestWithToken>>,
|
pub request_map: HashMap<u32, Sender<RequestWithToken>>,
|
||||||
pub seq_count_provider: SeqCountProviderSyncClonable,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct TmArgs {
|
pub struct TmArgs {
|
||||||
@ -153,7 +151,6 @@ pub fn core_tmtc_task(
|
|||||||
) {
|
) {
|
||||||
let pus_tm_args = PusTmArgs {
|
let pus_tm_args = PusTmArgs {
|
||||||
verif_reporter: args.verif_reporter,
|
verif_reporter: args.verif_reporter,
|
||||||
seq_count_provider: args.seq_count_provider.clone(),
|
|
||||||
};
|
};
|
||||||
let pus_tc_args = PusTcArgs {
|
let pus_tc_args = PusTcArgs {
|
||||||
pus_router,
|
pus_router,
|
||||||
|
Loading…
Reference in New Issue
Block a user