Some improvements for time stamper API

This commit is contained in:
Robin Müller 2022-09-05 14:44:35 +02:00
parent 04bff7a522
commit d64ad71529
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
22 changed files with 105 additions and 92 deletions

View File

@ -8,7 +8,7 @@
#include "../serialize/SerialLinkedListAdapter.h" #include "../serialize/SerialLinkedListAdapter.h"
#include "../serialize/SerializeElement.h" #include "../serialize/SerializeElement.h"
#include "../serviceinterface/ServiceInterface.h" #include "../serviceinterface/ServiceInterface.h"
#include "../timemanager/TimeStamperIF.h" #include "../timemanager/TimeWriterIF.h"
#include "HasMonitorsIF.h" #include "HasMonitorsIF.h"
#include "MonitoringIF.h" #include "MonitoringIF.h"
#include "monitoringConf.h" #include "monitoringConf.h"
@ -34,9 +34,9 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
SerializeElement<T> limitValue; SerializeElement<T> limitValue;
SerializeElement<ReturnValue_t> oldState; SerializeElement<ReturnValue_t> oldState;
SerializeElement<ReturnValue_t> newState; SerializeElement<ReturnValue_t> newState;
uint8_t rawTimestamp[TimeStamperIF::MAXIMUM_TIMESTAMP_LEN] = {}; uint8_t rawTimestamp[TimeWriterIF::MAXIMUM_TIMESTAMP_LEN] = {};
SerializeElement<SerialBufferAdapter<uint8_t>> timestampSerializer; SerializeElement<SerialBufferAdapter<uint8_t>> timestampSerializer;
TimeStamperIF* timeStamper; TimeWriterIF* timeStamper;
MonitoringReportContent() MonitoringReportContent()
: SerialLinkedListAdapter<SerializeIF>(&parameterObjectId), : SerialLinkedListAdapter<SerializeIF>(&parameterObjectId),
monitorId(0), monitorId(0),
@ -79,7 +79,7 @@ class MonitoringReportContent : public SerialLinkedListAdapter<SerializeIF> {
} }
bool checkAndSetStamper() { bool checkAndSetStamper() {
if (timeStamper == nullptr) { if (timeStamper == nullptr) {
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(timeStamperId); timeStamper = ObjectManager::instance()->get<TimeWriterIF>(timeStamperId);
if (timeStamper == nullptr) { if (timeStamper == nullptr) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "MonitoringReportContent::checkAndSetStamper: " sif::error << "MonitoringReportContent::checkAndSetStamper: "

View File

@ -564,7 +564,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;
} }
if(fromTimestamp > toTimestamp) { if (fromTimestamp > toTimestamp) {
return INVALID_TIME_WINDOW; return INVALID_TIME_WINDOW;
} }
itBegin = telecommandMap.begin(); itBegin = telecommandMap.begin();
@ -573,7 +573,7 @@ inline ReturnValue_t Service11TelecommandScheduling<MAX_NUM_TCS>::getMapFilterFr
itBegin++; itBegin++;
} }
//start looking for end beginning at begin // start looking for end beginning at begin
itEnd = itBegin; itEnd = itBegin;
while (itEnd->first <= toTimestamp && itEnd != telecommandMap.end()) { while (itEnd->first <= toTimestamp && itEnd != telecommandMap.end()) {
itEnd++; itEnd++;

View File

@ -11,7 +11,7 @@ Service1TelecommandVerification::Service1TelecommandVerification(object_id_t obj
uint16_t apid, uint8_t serviceId, uint16_t apid, uint8_t serviceId,
object_id_t targetDestination, object_id_t targetDestination,
uint16_t messageQueueDepth, uint16_t messageQueueDepth,
TimeStamperIF* timeStamper) TimeWriterIF* timeStamper)
: SystemObject(objectId), : SystemObject(objectId),
apid(apid), apid(apid),
serviceId(serviceId), serviceId(serviceId),
@ -134,7 +134,7 @@ ReturnValue_t Service1TelecommandVerification::initialize() {
storeHelper.setTmStore(*tmStore); storeHelper.setTmStore(*tmStore);
} }
if (timeStamper == nullptr) { if (timeStamper == nullptr) {
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER); timeStamper = ObjectManager::instance()->get<TimeWriterIF>(objects::TIME_STAMPER);
if (timeStamper == nullptr) { if (timeStamper == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }

View File

@ -47,7 +47,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
Service1TelecommandVerification(object_id_t objectId, uint16_t apid, uint8_t serviceId, Service1TelecommandVerification(object_id_t objectId, uint16_t apid, uint8_t serviceId,
object_id_t targetDestination, uint16_t messageQueueDepth, object_id_t targetDestination, uint16_t messageQueueDepth,
TimeStamperIF* timeStamper = nullptr); TimeWriterIF* timeStamper = nullptr);
~Service1TelecommandVerification() override; ~Service1TelecommandVerification() override;
/** /**
@ -87,7 +87,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
TmStoreHelper storeHelper; TmStoreHelper storeHelper;
TmStoreAndSendWrapper tmHelper; TmStoreAndSendWrapper tmHelper;
InternalErrorReporterIF* errReporter = nullptr; InternalErrorReporterIF* errReporter = nullptr;
TimeStamperIF* timeStamper = nullptr; TimeWriterIF* timeStamper = nullptr;
StorageManagerIF* tmStore = nullptr; StorageManagerIF* tmStore = nullptr;
MessageQueueIF* tmQueue = nullptr; MessageQueueIF* tmQueue = nullptr;

View File

@ -6,11 +6,6 @@
CdsShortTimeStamper::CdsShortTimeStamper(object_id_t objectId) : SystemObject(objectId) {} CdsShortTimeStamper::CdsShortTimeStamper(object_id_t objectId) : SystemObject(objectId) {}
ReturnValue_t CdsShortTimeStamper::addTimeStamp(uint8_t *buffer, const uint8_t maxSize) {
size_t serLen = 0;
return serialize(&buffer, &serLen, maxSize, SerializeIF::Endianness::NETWORK);
}
ReturnValue_t CdsShortTimeStamper::serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t CdsShortTimeStamper::serialize(uint8_t **buffer, size_t *size, size_t maxSize,
SerializeIF::Endianness streamEndianness) const { SerializeIF::Endianness streamEndianness) const {
if (*size + getSerializedSize() > maxSize) { if (*size + getSerializedSize() > maxSize) {
@ -33,15 +28,22 @@ size_t CdsShortTimeStamper::getSerializedSize() const { return getTimestampSize(
ReturnValue_t CdsShortTimeStamper::deSerialize(const uint8_t **buffer, size_t *size, ReturnValue_t CdsShortTimeStamper::deSerialize(const uint8_t **buffer, size_t *size,
SerializeIF::Endianness streamEndianness) { SerializeIF::Endianness streamEndianness) {
return returnvalue::FAILED; if (size == nullptr or buffer == nullptr) {
} return returnvalue::FAILED;
}
ReturnValue_t CdsShortTimeStamper::readTimeStamp(const uint8_t *buffer, size_t maxSize) { if (*size < getTimestampSize()) {
if (maxSize < getTimestampSize()) {
return SerializeIF::STREAM_TOO_SHORT; return SerializeIF::STREAM_TOO_SHORT;
} }
size_t foundLen = 0; size_t foundLen = 0;
return CCSDSTime::convertFromCcsds(&readTime, buffer, &foundLen, maxSize); if (((**buffer >> 4) & 0b111) != CCSDSTime::TimeCodeIdentification::CDS) {
return BAD_TIMESTAMP;
}
auto res = CCSDSTime::convertFromCcsds(&readTime, *buffer, &foundLen, *size);
if (res == returnvalue::OK) {
*size -= getSerializedSize();
*buffer += getSerializedSize();
}
return res;
} }
timeval &CdsShortTimeStamper::getTime() { return readTime; } timeval &CdsShortTimeStamper::getTime() { return readTime; }

View File

@ -3,7 +3,7 @@
#include "CCSDSTime.h" #include "CCSDSTime.h"
#include "TimeReaderIF.h" #include "TimeReaderIF.h"
#include "TimeStamperIF.h" #include "TimeWriterIF.h"
#include "fsfw/objectmanager/SystemObject.h" #include "fsfw/objectmanager/SystemObject.h"
/** /**
@ -15,7 +15,7 @@
* overriding the #addTimeStamp function. * overriding the #addTimeStamp function.
* @ingroup utility * @ingroup utility
*/ */
class CdsShortTimeStamper : public TimeStamperIF, public TimeReaderIF, public SystemObject { class CdsShortTimeStamper : public TimeWriterIF, public TimeReaderIF, public SystemObject {
public: public:
static constexpr size_t TIMESTAMP_LEN = 7; static constexpr size_t TIMESTAMP_LEN = 7;
/** /**
@ -25,20 +25,11 @@ class CdsShortTimeStamper : public TimeStamperIF, public TimeReaderIF, public Sy
*/ */
explicit CdsShortTimeStamper(object_id_t objectId); explicit CdsShortTimeStamper(object_id_t objectId);
/**
* Adds a CCSDS CDC short 8 byte timestamp to the given buffer.
* This function can be overriden to use a custom timestamp.
* @param buffer
* @param maxSize
* @return
*/
ReturnValue_t addTimeStamp(uint8_t *buffer, uint8_t maxSize) override;
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
Endianness streamEndianness) const override; Endianness streamEndianness) const override;
[[nodiscard]] size_t getSerializedSize() const override; [[nodiscard]] size_t getSerializedSize() const override;
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size, ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override; Endianness streamEndianness) override;
ReturnValue_t readTimeStamp(const uint8_t *buffer, size_t maxSize) override;
timeval &getTime() override; timeval &getTime() override;
[[nodiscard]] size_t getTimestampSize() const override; [[nodiscard]] size_t getTimestampSize() const override;

View File

@ -5,12 +5,28 @@
#include "TimeStampIF.h" #include "TimeStampIF.h"
#include "fsfw/returnvalues/returnvalue.h" #include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeIF.h"
class TimeReaderIF : public TimeStampIF { class TimeReaderIF : public SerializeIF, public TimeStampIF {
public: public:
~TimeReaderIF() override = default; ~TimeReaderIF() override = default;
virtual ReturnValue_t readTimeStamp(const uint8_t* buffer, size_t maxSize) = 0;
virtual timeval& getTime() = 0; virtual timeval& getTime() = 0;
[[nodiscard]] size_t getSerializedSize() const override { return getTimestampSize(); }
ReturnValue_t readTimeStamp(const uint8_t* buf, size_t maxSize) {
size_t dummy = 0;
return deSerialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
}
private:
/**
* Forbidden, use dedicated IF @TimeWriterIF
*/
[[nodiscard]] ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override {
return returnvalue::FAILED;
}
}; };
#endif // FSFW_TIMEMANAGER_TIMEREADERIF_H #endif // FSFW_TIMEMANAGER_TIMEREADERIF_H

View File

@ -1,23 +0,0 @@
#ifndef FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
#define FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
#include "TimeStampIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeIF.h"
/**
* A class implementing this IF provides facilities to add a time stamp to the
* buffer provided.
* Implementors need to ensure that calling the method is thread-safe, i.e.
* addTimeStamp may be called in parallel from a different context.
*/
class TimeStamperIF : public SerializeIF, public TimeStampIF {
public:
virtual ReturnValue_t addTimeStamp(uint8_t* buffer, uint8_t maxSize) = 0;
~TimeStamperIF() override = default;
size_t getTimestampSize() const override { return getSerializedSize(); }
protected:
};
#endif /* FSFW_TIMEMANAGER_TIMESTAMPERIF_H_ */

View File

@ -0,0 +1,34 @@
#ifndef FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
#define FSFW_TIMEMANAGER_TIMESTAMPERIF_H_
#include "TimeStampIF.h"
#include "fsfw/returnvalues/returnvalue.h"
#include "fsfw/serialize/SerializeIF.h"
/**
* A class implementing this IF provides facilities to add a time stamp to the
* buffer provided.
* Implementors need to ensure that calling the method is thread-safe, i.e.
* addTimeStamp may be called in parallel from a different context.
*/
class TimeWriterIF : public SerializeIF, public TimeStampIF {
public:
~TimeWriterIF() override = default;
[[nodiscard]] size_t getTimestampSize() const override { return getSerializedSize(); }
ReturnValue_t addTimeStamp(uint8_t *buf, size_t maxSize) {
size_t dummy = 0;
return serialize(buf, dummy, maxSize, SerializeIF::Endianness::NETWORK);
}
private:
/**
* Forbidden, use dedicated IF @TimeReaderIF
*/
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
Endianness streamEndianness) override {
return returnvalue::FAILED;
}
};
#endif /* FSFW_TIMEMANAGER_TIMESTAMPERIF_H_ */

View File

@ -7,7 +7,7 @@
#include "fsfw/serialize/SerialLinkedListAdapter.h" #include "fsfw/serialize/SerialLinkedListAdapter.h"
#include "fsfw/serialize/SerializeElement.h" #include "fsfw/serialize/SerializeElement.h"
#include "fsfw/timemanager/CCSDSTime.h" #include "fsfw/timemanager/CCSDSTime.h"
#include "fsfw/timemanager/TimeStamperIF.h" #include "fsfw/timemanager/TimeWriterIF.h"
#include "fsfw/tmtcpacket/pus/tm/PusTmMinimal.h" #include "fsfw/tmtcpacket/pus/tm/PusTmMinimal.h"
#include "tmStorageConf.h" #include "tmStorageConf.h"

View File

@ -3,7 +3,7 @@
#include <utility> #include <utility>
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include "fsfw/timemanager/TimeStamperIF.h" #include "fsfw/timemanager/TimeWriterIF.h"
PusTmCreator::PusTmCreator(SpacePacketParams initSpParams, PusTmParams initPusParams) PusTmCreator::PusTmCreator(SpacePacketParams initSpParams, PusTmParams initPusParams)
: pusParams(initPusParams), spCreator(std::move(initSpParams)) { : pusParams(initPusParams), spCreator(std::move(initSpParams)) {
@ -30,7 +30,7 @@ uint8_t PusTmCreator::getSubService() const { return pusParams.secHeader.subserv
PusTmParams& PusTmCreator::getParams() { return pusParams; } PusTmParams& PusTmCreator::getParams() { return pusParams; }
void PusTmCreator::setTimeStamper(TimeStamperIF& timeStamper_) { void PusTmCreator::setTimeStamper(TimeWriterIF& timeStamper_) {
pusParams.secHeader.timeStamper = &timeStamper_; pusParams.secHeader.timeStamper = &timeStamper_;
updateSpLengthField(); updateSpLengthField();
} }
@ -106,7 +106,7 @@ ReturnValue_t PusTmCreator::deSerialize(const uint8_t** buffer, size_t* size,
return returnvalue::FAILED; return returnvalue::FAILED;
} }
TimeStamperIF* PusTmCreator::getTimestamper() const { return pusParams.secHeader.timeStamper; } TimeWriterIF* PusTmCreator::getTimestamper() const { return pusParams.secHeader.timeStamper; }
SpacePacketParams& PusTmCreator::getSpParams() { return spCreator.getParams(); } SpacePacketParams& PusTmCreator::getSpParams() { return spCreator.getParams(); }

View File

@ -8,12 +8,12 @@
struct PusTmSecHeader { struct PusTmSecHeader {
PusTmSecHeader() = default; PusTmSecHeader() = default;
PusTmSecHeader(uint8_t service, uint8_t subservice, TimeStamperIF* timeStamper) PusTmSecHeader(uint8_t service, uint8_t subservice, TimeWriterIF* timeStamper)
: service(service), subservice(subservice), timeStamper(timeStamper) {} : service(service), subservice(subservice), timeStamper(timeStamper) {}
uint8_t service = 0; uint8_t service = 0;
uint8_t subservice = 0; uint8_t subservice = 0;
TimeStamperIF* timeStamper = nullptr; TimeWriterIF* timeStamper = nullptr;
uint8_t pusVersion = ecss::PusVersion::PUS_C; uint8_t pusVersion = ecss::PusVersion::PUS_C;
uint8_t scTimeRefStatus = 0; uint8_t scTimeRefStatus = 0;
uint16_t messageTypeCounter = 0; uint16_t messageTypeCounter = 0;
@ -26,10 +26,10 @@ struct PusTmParams {
PusTmParams(PusTmSecHeader secHeader, util::DataWrapper dataWrapper) PusTmParams(PusTmSecHeader secHeader, util::DataWrapper dataWrapper)
: secHeader(secHeader), dataWrapper(dataWrapper) {} : secHeader(secHeader), dataWrapper(dataWrapper) {}
PusTmParams(uint8_t service, uint8_t subservice, TimeStamperIF* timeStamper) PusTmParams(uint8_t service, uint8_t subservice, TimeWriterIF* timeStamper)
: secHeader(service, subservice, timeStamper) {} : secHeader(service, subservice, timeStamper) {}
PusTmParams(uint8_t service, uint8_t subservice, TimeStamperIF* timeStamper, PusTmParams(uint8_t service, uint8_t subservice, TimeWriterIF* timeStamper,
util::DataWrapper dataWrapper_) util::DataWrapper dataWrapper_)
: PusTmParams(service, subservice, timeStamper) { : PusTmParams(service, subservice, timeStamper) {
dataWrapper = dataWrapper_; dataWrapper = dataWrapper_;
@ -38,7 +38,7 @@ struct PusTmParams {
util::DataWrapper dataWrapper{}; util::DataWrapper dataWrapper{};
}; };
class TimeStamperIF; class TimeWriterIF;
/** /**
* This class provides a high-level interface to create PUS TM packets and then @serialize * This class provides a high-level interface to create PUS TM packets and then @serialize
@ -56,7 +56,7 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
PusTmCreator(SpacePacketParams initSpParams, PusTmParams initPusParams); PusTmCreator(SpacePacketParams initSpParams, PusTmParams initPusParams);
~PusTmCreator() override = default; ~PusTmCreator() override = default;
void setTimeStamper(TimeStamperIF& timeStamper); void setTimeStamper(TimeWriterIF& timeStamper);
/** /**
* This function disables the CRC16 calculation on serialization. This is useful to avoid * This function disables the CRC16 calculation on serialization. This is useful to avoid
* duplicate calculation if some lower level component needs to update fields like the sequence * duplicate calculation if some lower level component needs to update fields like the sequence
@ -86,7 +86,7 @@ class PusTmCreator : public SerializeIF, public PusTmIF, public CustomUserDataIF
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize, ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
Endianness streamEndianness) const override; Endianness streamEndianness) const override;
[[nodiscard]] size_t getSerializedSize() const override; [[nodiscard]] size_t getSerializedSize() const override;
[[nodiscard]] TimeStamperIF* getTimestamper() const; [[nodiscard]] TimeWriterIF* getTimestamper() const;
ReturnValue_t setRawUserData(const uint8_t* data, size_t len) override; ReturnValue_t setRawUserData(const uint8_t* data, size_t len) override;
ReturnValue_t setSerializableUserData(SerializeIF& serializable) override; ReturnValue_t setSerializableUserData(SerializeIF& serializable) override;

View File

@ -4,7 +4,7 @@
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
#include "fsfw/timemanager/TimeStamperIF.h" #include "fsfw/timemanager/TimeWriterIF.h"
#include "fsfw/tmtcpacket/pus/PusIF.h" #include "fsfw/tmtcpacket/pus/PusIF.h"
#include "fsfw/tmtcpacket/pus/defs.h" #include "fsfw/tmtcpacket/pus/defs.h"

View File

@ -104,7 +104,7 @@ ReturnValue_t CommandingServiceBase::initialize() {
// This avoids duplicate calculation of the CRC16 // This avoids duplicate calculation of the CRC16
tmStoreHelper.disableCrcCalculation(); tmStoreHelper.disableCrcCalculation();
if (tmTimeStamper == nullptr) { if (tmTimeStamper == nullptr) {
tmTimeStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER); tmTimeStamper = ObjectManager::instance()->get<TimeWriterIF>(objects::TIME_STAMPER);
if (tmTimeStamper == nullptr) { if (tmTimeStamper == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED; return ObjectManagerIF::CHILD_INIT_FAILED;
} }

View File

@ -272,7 +272,7 @@ class CommandingServiceBase : public SystemObject,
MessageQueueIF* commandQueue = nullptr; MessageQueueIF* commandQueue = nullptr;
MessageQueueIF* requestQueue = nullptr; MessageQueueIF* requestQueue = nullptr;
TimeStamperIF* tmTimeStamper = nullptr; TimeWriterIF* tmTimeStamper = nullptr;
VerificationReporterIF* verificationReporter; VerificationReporterIF* verificationReporter;
InternalErrorReporterIF* errReporter = nullptr; InternalErrorReporterIF* errReporter = nullptr;

View File

@ -178,7 +178,7 @@ ReturnValue_t PusServiceBase::initializeTmStoreHelper(TmStoreHelper& tmStoreHelp
} }
if (psbParams.timeStamper == nullptr) { if (psbParams.timeStamper == nullptr) {
auto timerStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER); auto timerStamper = ObjectManager::instance()->get<TimeWriterIF>(objects::TIME_STAMPER);
if (timerStamper != nullptr) { if (timerStamper != nullptr) {
tmStoreHelper.setTimeStamper(*timerStamper); tmStoreHelper.setTimeStamper(*timerStamper);
} }

View File

@ -65,7 +65,7 @@ struct PsbParams {
* register itself at that object. * register itself at that object.
*/ */
PUSDistributorIF* pusDistributor = nullptr; PUSDistributorIF* pusDistributor = nullptr;
TimeStamperIF* timeStamper = nullptr; TimeWriterIF* timeStamper = nullptr;
}; };
namespace Factory { namespace Factory {

View File

@ -17,7 +17,6 @@
*/ */
class SpacePacketParser { class SpacePacketParser {
public: public:
struct FoundPacketInfo { struct FoundPacketInfo {
size_t startIdx = 0; size_t startIdx = 0;
size_t sizeFound = 0; size_t sizeFound = 0;
@ -51,9 +50,7 @@ class SpacePacketParser {
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize, ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
FoundPacketInfo& packetInfo); FoundPacketInfo& packetInfo);
size_t getAmountRead() { size_t getAmountRead() { return amountRead; }
return amountRead;
}
void reset() { void reset() {
nextStartIdx = 0; nextStartIdx = 0;

View File

@ -11,7 +11,7 @@ TmStoreHelper::TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore) :
} }
TmStoreHelper::TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore, TmStoreHelper::TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore,
TimeStamperIF& timeStamper) TimeWriterIF& timeStamper)
: tmStore(&tmStore) { : tmStore(&tmStore) {
creator.setApid(defaultApid); creator.setApid(defaultApid);
creator.setTimeStamper(timeStamper); creator.setTimeStamper(timeStamper);
@ -59,7 +59,7 @@ ReturnValue_t TmStoreHelper::addPacketToStore() {
SerializeIF::Endianness::NETWORK); SerializeIF::Endianness::NETWORK);
} }
void TmStoreHelper::setTimeStamper(TimeStamperIF& timeStamper_) { void TmStoreHelper::setTimeStamper(TimeWriterIF& timeStamper_) {
creator.setTimeStamper(timeStamper_); creator.setTimeStamper(timeStamper_);
} }
@ -67,7 +67,7 @@ void TmStoreHelper::setApid(uint16_t apid) { creator.setApid(apid); }
PusTmCreator& TmStoreHelper::getCreatorRef() { return creator; } PusTmCreator& TmStoreHelper::getCreatorRef() { return creator; }
TimeStamperIF* TmStoreHelper::getTimeStamper() const { return creator.getTimestamper(); } TimeWriterIF* TmStoreHelper::getTimeStamper() const { return creator.getTimestamper(); }
uint16_t TmStoreHelper::getApid() const { return creator.getApid(); } uint16_t TmStoreHelper::getApid() const { return creator.getApid(); }

View File

@ -4,14 +4,14 @@
#include "fsfw/internalerror/InternalErrorReporterIF.h" #include "fsfw/internalerror/InternalErrorReporterIF.h"
#include "fsfw/ipc/MessageQueueMessageIF.h" #include "fsfw/ipc/MessageQueueMessageIF.h"
#include "fsfw/storagemanager/StorageManagerIF.h" #include "fsfw/storagemanager/StorageManagerIF.h"
#include "fsfw/timemanager/TimeStamperIF.h" #include "fsfw/timemanager/TimeWriterIF.h"
#include "fsfw/tmtcpacket/pus/tm/PusTmCreator.h" #include "fsfw/tmtcpacket/pus/tm/PusTmCreator.h"
class TmStoreHelper { class TmStoreHelper {
public: public:
explicit TmStoreHelper(uint16_t defaultApid); explicit TmStoreHelper(uint16_t defaultApid);
TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore); TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore);
TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore, TimeStamperIF& timeStamper); TmStoreHelper(uint16_t defaultApid, StorageManagerIF& tmStore, TimeWriterIF& timeStamper);
void disableCrcCalculation(); void disableCrcCalculation();
[[nodiscard]] bool crcCalculationEnabled() const; [[nodiscard]] bool crcCalculationEnabled() const;
@ -20,8 +20,8 @@ class TmStoreHelper {
PusTmCreator& getCreatorRef(); PusTmCreator& getCreatorRef();
void setTimeStamper(TimeStamperIF& timeStamper); void setTimeStamper(TimeWriterIF& timeStamper);
[[nodiscard]] TimeStamperIF* getTimeStamper() const; [[nodiscard]] TimeWriterIF* getTimeStamper() const;
[[nodiscard]] StorageManagerIF* getTmStore() const; [[nodiscard]] StorageManagerIF* getTmStore() const;
void setTmStore(StorageManagerIF& store); void setTmStore(StorageManagerIF& store);

View File

@ -4,9 +4,9 @@
#include <array> #include <array>
#include "fsfw/timemanager/TimeReaderIF.h" #include "fsfw/timemanager/TimeReaderIF.h"
#include "fsfw/timemanager/TimeStamperIF.h" #include "fsfw/timemanager/TimeWriterIF.h"
class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF { class CdsShortTimestamperMock : public TimeWriterIF, public TimeReaderIF {
public: public:
unsigned int serializeCallCount = 0; unsigned int serializeCallCount = 0;
unsigned int deserializeCallCount = 0; unsigned int deserializeCallCount = 0;
@ -61,7 +61,6 @@ class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
} }
[[nodiscard]] size_t getTimestampSize() const override { return getSerializedSize(); } [[nodiscard]] size_t getTimestampSize() const override { return getSerializedSize(); }
ReturnValue_t addTimeStamp(uint8_t *buffer, uint8_t maxSize) override { return 0; }
void reset() { void reset() {
serializeCallCount = 0; serializeCallCount = 0;
@ -75,9 +74,6 @@ class CdsShortTimestamperMock : public TimeStamperIF, public TimeReaderIF {
serFailRetval = returnvalue::FAILED; serFailRetval = returnvalue::FAILED;
} }
ReturnValue_t readTimeStamp(const uint8_t *buffer, size_t maxSize) override {
return deSerialize(&buffer, &maxSize, SerializeIF::Endianness::NETWORK);
}
timeval &getTime() override { return dummyTime; } timeval &getTime() override { return dummyTime; }
private: private:

View File

@ -7,8 +7,8 @@
#include "tmtc/pusIds.h" #include "tmtc/pusIds.h"
TEST_CASE("PUS Service 11", "[pus-srvc11]") { TEST_CASE("PUS Service 11", "[pus-srvc11]") {
Service11TelecommandScheduling<13> pusService11({objects::PUS_SERVICE_11_TC_SCHEDULER, Service11TelecommandScheduling<13> pusService11(
apid::DEFAULT_APID, pus::PUS_SERVICE_11}, nullptr); {objects::PUS_SERVICE_11_TC_SCHEDULER, apid::DEFAULT_APID, pus::PUS_SERVICE_11}, nullptr);
// TODO test something... // TODO test something...
} }