From 9a858eb54c5603ccd3cbd2423cdaf87b20f0c0c4 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Tue, 14 Dec 2021 19:39:38 +0100 Subject: [PATCH 1/2] introduced protected function to break doSendRead --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 9 +++++++++ src/fsfw/devicehandlers/DeviceHandlerBase.h | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 535113fd..a4e30448 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -684,6 +684,11 @@ void DeviceHandlerBase::doGetWrite() { void DeviceHandlerBase::doSendRead() { ReturnValue_t result; + result = doSendReadHook(); + if (result != RETURN_OK){ + return; + } + size_t replyLen = 0; if(cookieInfo.pendingCommand != deviceCommandMap.end()) { replyLen = getNextReplyLength(cookieInfo.pendingCommand->first); @@ -950,6 +955,10 @@ void DeviceHandlerBase::commandSwitch(ReturnValue_t onOff) { } } +ReturnValue_t DeviceHandlerBase::doSendReadHook() { + return RETURN_OK; +} + ReturnValue_t DeviceHandlerBase::getSwitches(const uint8_t **switches, uint8_t *numberOfSwitches) { return DeviceHandlerBase::NO_SWITCH; diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 4bc54ac4..1de70ad5 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -1094,6 +1094,12 @@ protected: */ void commandSwitch(ReturnValue_t onOff); + /** + * @brief This function can be used to insert device specific code during the do-send-read + * step. + */ + virtual ReturnValue_t doSendReadHook(); + private: /** From eb58a8d954139918f518fcf2d3929601e7089485 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Sun, 19 Dec 2021 11:33:12 +0100 Subject: [PATCH 2/2] virtual printset function --- src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp | 4 ++++ src/fsfw/datapoollocal/LocalPoolDataSetBase.h | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp index d1ac0c7f..3f68a881 100644 --- a/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp +++ b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp @@ -321,3 +321,7 @@ float LocalPoolDataSetBase::getCollectionInterval() const { return 0.0; } } + +void LocalPoolDataSetBase::printSet() { + return; +} diff --git a/src/fsfw/datapoollocal/LocalPoolDataSetBase.h b/src/fsfw/datapoollocal/LocalPoolDataSetBase.h index 822e2cb8..aa99f5b5 100644 --- a/src/fsfw/datapoollocal/LocalPoolDataSetBase.h +++ b/src/fsfw/datapoollocal/LocalPoolDataSetBase.h @@ -176,6 +176,11 @@ public: */ float getCollectionInterval() const; + /** + * @brief Can be overwritten by a specific implementation of a dataset to print the set. + */ + virtual void printSet(); + protected: sid_t sid; //! This mutex is used if the data is created by one object only. @@ -234,7 +239,6 @@ protected: PeriodicHousekeepingHelper* periodicHelper = nullptr; LocalDataPoolManager* poolManager = nullptr; - };