From 369b03f279ddd2febe62d77d70eb7ef8a2baa3c5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 10 Dec 2025 11:33:34 +0100 Subject: [PATCH] USLP reader getter functions --- CHANGELOG.md | 2 ++ src/uslp/mod.rs | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 843f5bf..9fcb4d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Added `SequenceCounterOnFile` which persists the sequence counter by writing it to a file. - Added `SequenceCounter::set` method which allows manually setting an initial value. - Added `CcsdsPacketReader::raw_data` full data getter. +- `UslpFrameCreator` constructor +- Additional reader methods on `UslpFrameReader` ## Removed diff --git a/src/uslp/mod.rs b/src/uslp/mod.rs index 55f751a..5c4c037 100644 --- a/src/uslp/mod.rs +++ b/src/uslp/mod.rs @@ -99,7 +99,7 @@ pub struct PrimaryHeader { pub source_or_dest_field: SourceOrDestField, /// Virtual channel ID. pub vc_id: u6, - /// MAP ID. + /// Multiplexer Access Point (MAP) ID. pub map_id: u4, frame_len_field: u16, /// Bypass sequence control flag. @@ -642,6 +642,29 @@ impl<'buf> TransferFrameReader<'buf> { self.primary_header.len_frame() } + /// Virtual channel ID. + #[inline] + pub fn vc_id(&self) -> u6 { + self.primary_header.vc_id + } + /// Multiplexer Access Point (MAP) ID. + #[inline] + pub fn map_id(&self) -> u4 { + self.primary_header.map_id + } + + /// Spacecraft ID. + #[inline] + pub fn spacecraft_id(&self) -> u16 { + self.primary_header.spacecraft_id + } + + /// Source or destination field. + #[inline] + pub fn source_or_dest_field(&self) -> SourceOrDestField { + self.primary_header.source_or_dest_field + } + /// Primary header. #[inline] pub fn primary_header(&self) -> &PrimaryHeader { -- 2.43.0