From c3572e31a8d6845442cf8e54802d94477b2db64e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 25 Jun 2023 12:35:50 +0200 Subject: [PATCH] add API to set msg counter --- CHANGELOG.md | 2 +- src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.cpp | 6 ++++++ src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 487f3736..b4e9ab8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## Fixes - - Important bugfix in CFDP PDU header format: The entity length field and the transaction sequence number fields stored the actual length of the field instead of the length minus 1 like specified in the CFDP standard. @@ -26,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - add CFDP subsystem ID https://egit.irs.uni-stuttgart.de/fsfw/fsfw/pulls/742 +- `PusTmZcWriter` now exposes API to set message counter field. ## Changed - Bump ETL version to 20.35.14 diff --git a/src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.cpp b/src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.cpp index 6a9f6235..d897aff9 100644 --- a/src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.cpp @@ -24,3 +24,9 @@ void PusTmZeroCopyWriter::updateErrorControl() { crcStart[0] = (crc16 >> 8) & 0xff; crcStart[1] = crc16 & 0xff; } + +void PusTmZeroCopyWriter::setMessageCount(uint16_t msgCount) { + size_t serSize = 0; + SerializeAdapter::serialize(&msgCount, const_cast(pointers.secHeaderStart + 3), + &serSize, 2, SerializeIF::Endianness::NETWORK); +} diff --git a/src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h b/src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h index 36c43f51..66ef1405 100644 --- a/src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h +++ b/src/fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h @@ -14,6 +14,7 @@ class PusTmZeroCopyWriter : public PusTmReader { PusTmZeroCopyWriter(TimeReaderIF& timeReader, uint8_t* data, size_t size); void setSequenceCount(uint16_t seqCount); + void setMessageCount(uint16_t msgCount); void updateErrorControl(); private: