This commit is contained in:
@ -45,9 +45,10 @@ impl PusActionToRequestConverter for ExampleActionRequestConverter {
|
||||
FailParams::new_no_fail_data(time_stamp, &tmtc_err::NOT_ENOUGH_APP_DATA),
|
||||
)
|
||||
.expect("Sending start failure failed");
|
||||
return Err(PusPacketHandlingError::NotEnoughAppData(
|
||||
"Expected at least 4 bytes".into(),
|
||||
));
|
||||
return Err(PusPacketHandlingError::NotEnoughAppData {
|
||||
expected: 8,
|
||||
found: user_data.len(),
|
||||
});
|
||||
}
|
||||
let target_id = TargetAndApidId::from_pus_tc(tc).unwrap();
|
||||
let action_id = u32::from_be_bytes(user_data[4..8].try_into().unwrap());
|
||||
|
@ -50,9 +50,10 @@ impl PusHkToRequestConverter for ExampleHkRequestConverter {
|
||||
),
|
||||
)
|
||||
.expect("Sending start failure TM failed");
|
||||
return Err(PusPacketHandlingError::NotEnoughAppData(
|
||||
"Expected at least 8 bytes of app data".into(),
|
||||
));
|
||||
return Err(PusPacketHandlingError::NotEnoughAppData {
|
||||
expected: 4,
|
||||
found: 0,
|
||||
});
|
||||
}
|
||||
if user_data.len() < 8 {
|
||||
let err = if user_data.len() < 4 {
|
||||
@ -65,9 +66,10 @@ impl PusHkToRequestConverter for ExampleHkRequestConverter {
|
||||
verif_reporter
|
||||
.start_failure(token, FailParams::new(time_stamp, err, &user_data_len_raw))
|
||||
.expect("Sending start failure TM failed");
|
||||
return Err(PusPacketHandlingError::NotEnoughAppData(
|
||||
"Expected at least 8 bytes of app data".into(),
|
||||
));
|
||||
return Err(PusPacketHandlingError::NotEnoughAppData {
|
||||
expected: 8,
|
||||
found: 4,
|
||||
});
|
||||
}
|
||||
let subservice = tc.subservice();
|
||||
let target_id = TargetAndApidId::from_pus_tc(tc).expect("invalid tc format");
|
||||
@ -109,9 +111,10 @@ impl PusHkToRequestConverter for ExampleHkRequestConverter {
|
||||
),
|
||||
)
|
||||
.expect("Sending start failure TM failed");
|
||||
return Err(PusPacketHandlingError::NotEnoughAppData(
|
||||
"expected at least 8 bytes of app data".into(),
|
||||
));
|
||||
return Err(PusPacketHandlingError::NotEnoughAppData {
|
||||
expected: 12,
|
||||
found: user_data.len(),
|
||||
});
|
||||
}
|
||||
HkRequest::ModifyCollectionInterval(
|
||||
unique_id,
|
||||
|
@ -168,7 +168,7 @@ impl<const SERVICE_ID: u8> PusRoutingErrorHandler for GenericRoutingErrorHandler
|
||||
token: satrs::pus::verification::VerificationToken<
|
||||
satrs::pus::verification::TcStateAccepted,
|
||||
>,
|
||||
tc: &PusTcReader,
|
||||
_tc: &PusTcReader,
|
||||
error: Self::Error,
|
||||
time_stamp: &[u8],
|
||||
verif_reporter: &impl VerificationReportingProvider,
|
||||
@ -195,17 +195,13 @@ impl<const SERVICE_ID: u8> PusRoutingErrorHandler for GenericRoutingErrorHandler
|
||||
)
|
||||
.expect("Sending start failure failed");
|
||||
}
|
||||
GenericRoutingError::NotEnoughAppData => {
|
||||
let app_data_len = tc.app_data().len() as u32;
|
||||
let app_data_len_raw = app_data_len.to_be_bytes();
|
||||
GenericRoutingError::NotEnoughAppData { expected, found } => {
|
||||
let mut context_info = (found as u32).to_be_bytes().to_vec();
|
||||
context_info.extend_from_slice(&(expected as u32).to_be_bytes());
|
||||
verif_reporter
|
||||
.start_failure(
|
||||
token,
|
||||
FailParams::new(
|
||||
time_stamp,
|
||||
&tmtc_err::NOT_ENOUGH_APP_DATA,
|
||||
&app_data_len_raw,
|
||||
),
|
||||
FailParams::new(time_stamp, &tmtc_err::NOT_ENOUGH_APP_DATA, &context_info),
|
||||
)
|
||||
.expect("Sending start failure failed");
|
||||
}
|
||||
|
Reference in New Issue
Block a user