some tweaks and test update
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit
Some checks failed
Rust/spacepackets/pipeline/head There was a failure building this commit
This commit is contained in:
parent
eca7e09d19
commit
c0e70daf58
@ -790,6 +790,10 @@ impl<'raw_data> PusTcReader<'raw_data> {
|
|||||||
Ok((pus_tc, total_len))
|
Ok((pus_tc, total_len))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn raw_data(&self) -> &[u8] {
|
||||||
|
self.raw_data
|
||||||
|
}
|
||||||
|
|
||||||
pub fn len_packed(&self) -> usize {
|
pub fn len_packed(&self) -> usize {
|
||||||
self.sp_header.total_len()
|
self.sp_header.total_len()
|
||||||
}
|
}
|
||||||
@ -854,8 +858,7 @@ impl PartialEq<PusTcReader<'_>> for PusTcCreator<'_> {
|
|||||||
#[cfg(all(test, feature = "std"))]
|
#[cfg(all(test, feature = "std"))]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::ecss::tc::{
|
use crate::ecss::tc::{
|
||||||
GenericPusTcSecondaryHeader, PusTc, PusTcCreator, PusTcReader, PusTcSecondaryHeader,
|
GenericPusTcSecondaryHeader, PusTcCreator, PusTcReader, PusTcSecondaryHeader, ACK_ALL,
|
||||||
ACK_ALL,
|
|
||||||
};
|
};
|
||||||
use crate::ecss::PusVersion::PusC;
|
use crate::ecss::PusVersion::PusC;
|
||||||
use crate::ecss::{PusError, PusPacket, SerializablePusPacket};
|
use crate::ecss::{PusError, PusPacket, SerializablePusPacket};
|
||||||
|
@ -829,7 +829,7 @@ impl<'raw_data> PusTmReader<'raw_data> {
|
|||||||
|
|
||||||
/// If [Self] was constructed [Self::from_bytes], this function will return the slice it was
|
/// If [Self] was constructed [Self::from_bytes], this function will return the slice it was
|
||||||
/// constructed from. Otherwise, [None] will be returned.
|
/// constructed from. Otherwise, [None] will be returned.
|
||||||
pub fn raw_bytes(&self) -> &'raw_data [u8] {
|
pub fn raw_data(&self) -> &[u8] {
|
||||||
self.raw_data
|
self.raw_data
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1051,13 +1051,10 @@ mod tests {
|
|||||||
fn test_manual_field_update() {
|
fn test_manual_field_update() {
|
||||||
let mut sph = SpHeader::tm_unseg(0x123, 0x234, 0).unwrap();
|
let mut sph = SpHeader::tm_unseg(0x123, 0x234, 0).unwrap();
|
||||||
let tc_header = PusTmSecondaryHeader::new_simple(17, 2, dummy_timestamp());
|
let tc_header = PusTmSecondaryHeader::new_simple(17, 2, dummy_timestamp());
|
||||||
let mut tm = PusTm::new(&mut sph, tc_header, None, false);
|
let mut tm = PusTmCreator::new(&mut sph, tc_header, None, false);
|
||||||
tm.calc_crc_on_serialization = false;
|
tm.calc_crc_on_serialization = false;
|
||||||
assert_eq!(tm.data_len(), 0x00);
|
assert_eq!(tm.data_len(), 0x00);
|
||||||
let mut buf: [u8; 32] = [0; 32];
|
let mut buf: [u8; 32] = [0; 32];
|
||||||
let res = tm.write_to_bytes(&mut buf);
|
|
||||||
assert!(res.is_err());
|
|
||||||
assert!(matches!(res.unwrap_err(), PusError::CrcCalculationMissing));
|
|
||||||
tm.update_ccsds_data_len();
|
tm.update_ccsds_data_len();
|
||||||
assert_eq!(tm.data_len(), 15);
|
assert_eq!(tm.data_len(), 15);
|
||||||
tm.calc_own_crc16();
|
tm.calc_own_crc16();
|
||||||
|
Loading…
Reference in New Issue
Block a user