add packet_len direct method for SpHeader #152

Merged
muellerr merged 1 commits from sp-header-tweak into main 2025-09-10 21:05:56 +02:00
2 changed files with 8 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Added
- `SpHeader::packet_len` direct method.
- `AckFlags` which is implemented with `bitbybit::bitfield`
- `ApidOutOfRangeError` and `SequenceCountOutOfRangeError`
- Added PUS A legacy support for telecommands inside the `ecss.tc_pus_a` module

View File

@@ -302,6 +302,7 @@ pub trait CcsdsPacket {
/// Retrieve data length field
fn data_len(&self) -> u16;
/// Retrieve the total packet size based on the data length field
#[inline]
fn packet_len(&self) -> usize {
@@ -504,6 +505,12 @@ impl SpHeader {
}
}
/// Retrieve the total packet size based on the data length field
#[inline]
fn packet_len(&self) -> usize {
usize::from(self.data_len()) + CCSDS_HEADER_LEN + 1
}
#[inline]
pub fn set_seq_count(&mut self, seq_count: u14) {
self.psc.seq_count = seq_count;