Merge branch 'mueller/master' into mueller/local-pool-update

This commit is contained in:
Robin Müller 2021-01-14 12:18:24 +01:00
commit 16f2468e60
11 changed files with 63 additions and 83 deletions

View File

@ -107,14 +107,16 @@ else()
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(WARNING_FLAGS if(NOT DEFINED FSFW_WARNING_FLAGS)
-Wall set(FSFW_WARNING_FLAGS
-Wextra -Wall
-Wshadow=local -Wextra
-Wimplicit-fallthrough=1 -Wshadow=local
-Wno-unused-parameter -Wimplicit-fallthrough=1
-Wno-psabi -Wno-unused-parameter
) -Wno-psabi
)
endif()
endif() endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@ -135,8 +137,7 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE
${FSFW_CONFIG_PATH_ABSOLUTE} ${FSFW_CONFIG_PATH_ABSOLUTE}
) )
# Machine specific options can be set with the ABI_FLAGS variable.
target_compile_options(${LIB_FSFW_NAME} PRIVATE target_compile_options(${LIB_FSFW_NAME} PRIVATE
${WARNING_FLAGS} ${FSFW_WARNING_FLAGS}
${COMPILER_FLAGS} ${COMPILER_FLAGS}
) )

View File

@ -26,10 +26,6 @@ object_id_t ExtendedControllerBase::getObjectId() const {
return SystemObject::getObjectId(); return SystemObject::getObjectId();
} }
AccessPoolManagerIF* ExtendedControllerBase::getAccessorHandle() {
return &poolManager;
}
uint32_t ExtendedControllerBase::getPeriodicOperationFrequency() const { uint32_t ExtendedControllerBase::getPeriodicOperationFrequency() const {
return this->executingTask->getPeriodMs(); return this->executingTask->getPeriodMs();
} }
@ -114,6 +110,6 @@ LocalPoolDataSetBase* ExtendedControllerBase::getDataSetHandle(sid_t sid) {
return nullptr; return nullptr;
} }
ProvidesDataPoolSubscriptionIF* ExtendedControllerBase::getSubscriptionInterface() { LocalDataPoolManager* ExtendedControllerBase::getHkManagerHandle() {
return &poolManager; return &poolManager;
} }

View File

@ -32,20 +32,10 @@ public:
virtual ReturnValue_t performOperation(uint8_t opCode) override; virtual ReturnValue_t performOperation(uint8_t opCode) override;
virtual ReturnValue_t initializeAfterTaskCreation() override; virtual ReturnValue_t initializeAfterTaskCreation() override;
/**
* Provides a subscription interface for objects which required updates on changed
* controller variables or datasets
* @return
*/
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override;
protected: protected:
LocalDataPoolManager poolManager; LocalDataPoolManager poolManager;
ActionHelper actionHelper; ActionHelper actionHelper;
//! Accessor handle required for internal handling
AccessPoolManagerIF* getAccessorHandle() override;
/** /**
* Implemented by child class. Handle all command messages which are * Implemented by child class. Handle all command messages which are
* not health, mode, action or housekeeping messages. * not health, mode, action or housekeeping messages.
@ -68,6 +58,7 @@ protected:
size_t size) override; size_t size) override;
/** HasLocalDatapoolIF overrides */ /** HasLocalDatapoolIF overrides */
virtual LocalDataPoolManager* getHkManagerHandle() override;
virtual object_id_t getObjectId() const override; virtual object_id_t getObjectId() const override;
virtual ReturnValue_t initializeLocalDataPool( virtual ReturnValue_t initializeLocalDataPool(
localpool::DataPool& localDataPoolMap, localpool::DataPool& localDataPoolMap,

View File

@ -120,17 +120,16 @@ public:
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
SerializeIF::Endianness streamEndianness) override; SerializeIF::Endianness streamEndianness) override;
/**
* Can be used to individually protect every read and commit call.
* @param protectEveryReadCommit
* @param mutexTimeout
*/
void setReadCommitProtectionBehaviour(bool protectEveryReadCommit,
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
uint32_t mutexTimeout = 20);
protected: protected:
/**
* Can be used to individually protect every read and commit call.
* @param protectEveryReadCommit
* @param mutexTimeout
*/
void setReadCommitProtectionBehaviour(bool protectEveryReadCommit,
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
uint32_t mutexTimeout = 20);
/** /**
* @brief The fill_count attribute ensures that the variables * @brief The fill_count attribute ensures that the variables
* register in the correct array position and that the maximum * register in the correct array position and that the maximum
@ -163,7 +162,7 @@ protected:
private: private:
bool protectEveryReadCommitCall = false; bool protectEveryReadCommitCall = false;
MutexIF::TimeoutType timeoutTypeForSingleVars; MutexIF::TimeoutType timeoutTypeForSingleVars = MutexIF::TimeoutType::WAITING;
uint32_t mutexTimeoutForSingleVars = 20; uint32_t mutexTimeoutForSingleVars = 20;
ReturnValue_t readVariable(uint16_t count); ReturnValue_t readVariable(uint16_t count);

View File

@ -2,6 +2,7 @@
#define FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_ #define FSFW_DATAPOOLLOCAL_HASLOCALDATAPOOLIF_H_
#include "localPoolDefinitions.h" #include "localPoolDefinitions.h"
#include "LocalDataPoolManager.h"
#include "../datapool/PoolEntryIF.h" #include "../datapool/PoolEntryIF.h"
#include "../serviceinterface/ServiceInterface.h" #include "../serviceinterface/ServiceInterface.h"
@ -14,7 +15,6 @@ class AccessPoolManagerIF;
class ProvidesDataPoolSubscriptionIF; class ProvidesDataPoolSubscriptionIF;
class LocalPoolDataSetBase; class LocalPoolDataSetBase;
class LocalPoolObjectBase; class LocalPoolObjectBase;
class LocalDataPoolManager;
/** /**
* @brief This interface is implemented by classes which posses a local data pool (not the * @brief This interface is implemented by classes which posses a local data pool (not the
@ -104,19 +104,32 @@ public:
* which allows subscriptions to dataset and variable updates in form of messages. * which allows subscriptions to dataset and variable updates in form of messages.
* The consumers can then read the most recent variable value by calling read with * The consumers can then read the most recent variable value by calling read with
* an own pool variable or set instance or using the deserialized snapshot data. * an own pool variable or set instance or using the deserialized snapshot data.
* Returns the HK manager casted to the required interface by default.
* @return * @return
*/ */
virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() = 0; virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() {
return getHkManagerHandle();
}
protected: protected:
/** /**
* Accessor handle required for internal handling. Not intended for users and therefore * Every class implementing this interface should have a local data pool manager. This
* declared protected. Users should instead use pool variables, sets or the subscription * function will return a reference to the manager.
* interface to access pool entries.
* @return * @return
*/ */
virtual AccessPoolManagerIF* getAccessorHandle() = 0; virtual LocalDataPoolManager* getHkManagerHandle() = 0;
/**
* Accessor handle required for internal handling. Not intended for users and therefore
* declared protected. Users should instead use pool variables, sets or the subscription
* interface to access pool entries. Returns the HK manager casted to a different interface
* by default.
* @return
*/
virtual AccessPoolManagerIF* getAccessorHandle() {
return getHkManagerHandle();
}
/** /**
* This function is used by the pool manager to get a valid dataset * This function is used by the pool manager to get a valid dataset

View File

@ -16,13 +16,15 @@ public:
readObject(readObject), mutexTimeout(mutexTimeout) { readObject(readObject), mutexTimeout(mutexTimeout) {
if(readObject != nullptr) { if(readObject != nullptr) {
readResult = readObject->read(timeoutType, mutexTimeout); readResult = readObject->read(timeoutType, mutexTimeout);
if(readResult != HasReturnvaluesIF::RETURN_OK) {
#if FSFW_VERBOSE_LEVEL == 1 #if FSFW_VERBOSE_LEVEL == 1
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PoolReadHelper: Read failed!" << std::endl; sif::error << "PoolReadHelper: Read failed!" << std::endl;
#else #else
sif::printError("PoolReadHelper: Read failed!\n"); sif::printError("PoolReadHelper: Read failed!\n");
#endif /* FSFW_PRINT_VERBOSITY_LEVEL == 1 */ #endif /* FSFW_PRINT_VERBOSITY_LEVEL == 1 */
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
}
} }
} }

View File

@ -1483,10 +1483,6 @@ void DeviceHandlerBase::setNormalDatapoolEntriesInvalid() {
} }
} }
AccessPoolManagerIF* DeviceHandlerBase::getAccessorHandle() {
return &poolManager;
}
void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
const char *functionName, ReturnValue_t errorCode, const char *functionName, ReturnValue_t errorCode,
const char *errorPrint) { const char *errorPrint) {
@ -1532,6 +1528,6 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
} }
ProvidesDataPoolSubscriptionIF* DeviceHandlerBase::getSubscriptionInterface() { LocalDataPoolManager* DeviceHandlerBase::getHkManagerHandle() {
return &poolManager; return &poolManager;
} }

View File

@ -518,14 +518,10 @@ protected:
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;
/** /**
* Provides the subscription handle which can be used by classes like controllers * Required for HasLocalDataPoolIF, return a handle to the local pool manager.
* to get messages on data updates.
* @return * @return
*/ */
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override; LocalDataPoolManager* getHkManagerHandle() override;
//! Accessor handle required for internal handling.
AccessPoolManagerIF* getAccessorHandle() override;
/** /**
* @brief Hook function for child handlers which is called once per * @brief Hook function for child handlers which is called once per

View File

@ -139,10 +139,6 @@ uint32_t InternalErrorReporter::getStoreHits() {
return value; return value;
} }
AccessPoolManagerIF* InternalErrorReporter::getAccessorHandle() {
return &poolManager;
}
void InternalErrorReporter::incrementStoreHits() { void InternalErrorReporter::incrementStoreHits() {
mutex->lockMutex(timeoutType, timeoutMs); mutex->lockMutex(timeoutType, timeoutMs);
storeHits++; storeHits++;
@ -201,6 +197,6 @@ void InternalErrorReporter::setMutexTimeout(MutexIF::TimeoutType timeoutType,
this->timeoutMs = timeoutMs; this->timeoutMs = timeoutMs;
} }
ProvidesDataPoolSubscriptionIF* InternalErrorReporter::getSubscriptionInterface() { LocalDataPoolManager* InternalErrorReporter::getHkManagerHandle() {
return &poolManager; return &poolManager;
} }

View File

@ -45,8 +45,7 @@ public:
LocalDataPoolManager& poolManager) override; LocalDataPoolManager& poolManager) override;
virtual dur_millis_t getPeriodicOperationFrequency() const override; virtual dur_millis_t getPeriodicOperationFrequency() const override;
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override; LocalDataPoolManager* getHkManagerHandle() override;
AccessPoolManagerIF* getAccessorHandle() override;
virtual ReturnValue_t initialize() override; virtual ReturnValue_t initialize() override;
virtual ReturnValue_t initializeAfterTaskCreation() override; virtual ReturnValue_t initializeAfterTaskCreation() override;

View File

@ -56,7 +56,7 @@ class LocalPoolOwnerBase: public SystemObject, public HasLocalDataPoolIF {
public: public:
LocalPoolOwnerBase( LocalPoolOwnerBase(
object_id_t objectId = objects::TEST_LOCAL_POOL_OWNER_BASE): object_id_t objectId = objects::TEST_LOCAL_POOL_OWNER_BASE):
SystemObject(objectId), hkManager(this, messageQueue), SystemObject(objectId), poolManager(this, messageQueue),
dataset(this, lpool::testSetId) { dataset(this, lpool::testSetId) {
messageQueue = new MessageQueueMockBase(); messageQueue = new MessageQueueMockBase();
} }
@ -72,7 +72,7 @@ public:
ReturnValue_t initializeHkManager() { ReturnValue_t initializeHkManager() {
if(not initialized) { if(not initialized) {
initialized = true; initialized = true;
return hkManager.initialize(messageQueue); return poolManager.initialize(messageQueue);
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -80,7 +80,7 @@ public:
ReturnValue_t initializeHkManagerAfterTaskCreation() { ReturnValue_t initializeHkManagerAfterTaskCreation() {
if(not initializedAfterTaskCreation) { if(not initializedAfterTaskCreation) {
initializedAfterTaskCreation = true; initializedAfterTaskCreation = true;
return hkManager.initializeAfterTaskCreation(); return poolManager.initializeAfterTaskCreation();
} }
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
@ -109,17 +109,8 @@ public:
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }
/** LocalDataPoolManager* getHkManagerHandle() override {
* This function can be used by data pool consumers to retrieve a handle return &poolManager;
* which allows subscriptions to dataset and variable updates.
* @return
*/
virtual ProvidesDataPoolSubscriptionIF* getSubscriptionInterface() override {
return &hkManager;
}
virtual AccessPoolManagerIF* getAccessorHandle() override {
return &hkManager;
} }
uint32_t getPeriodicOperationFrequency() const override { uint32_t getPeriodicOperationFrequency() const override {
@ -163,25 +154,25 @@ public:
} }
ReturnValue_t subscribeWrapperSetUpdate() { ReturnValue_t subscribeWrapperSetUpdate() {
return hkManager.subscribeForSetUpdateMessages(lpool::testSetId, return poolManager.subscribeForSetUpdateMessages(lpool::testSetId,
objects::NO_OBJECT, MessageQueueIF::NO_QUEUE, false); objects::NO_OBJECT, MessageQueueIF::NO_QUEUE, false);
} }
ReturnValue_t subscribeWrapperSetUpdateHk(bool diagnostics = false) { ReturnValue_t subscribeWrapperSetUpdateHk(bool diagnostics = false) {
return hkManager.subscribeForUpdatePackets(lpool::testSid, diagnostics, return poolManager.subscribeForUpdatePackets(lpool::testSid, diagnostics,
false, objects::HK_RECEIVER_MOCK); false, objects::HK_RECEIVER_MOCK);
} }
ReturnValue_t subscribeWrapperVariableUpdate(lp_id_t localPoolId) { ReturnValue_t subscribeWrapperVariableUpdate(lp_id_t localPoolId) {
return hkManager.subscribeForVariableUpdateMessages(localPoolId, return poolManager.subscribeForVariableUpdateMessages(localPoolId,
MessageQueueIF::NO_QUEUE, objects::NO_OBJECT, false); MessageQueueIF::NO_QUEUE, objects::NO_OBJECT, false);
} }
void resetSubscriptionList() { void resetSubscriptionList() {
hkManager.clearReceiversList(); poolManager.clearReceiversList();
} }
LocalDataPoolManager hkManager; LocalDataPoolManager poolManager;
LocalPoolTestDataSet dataset; LocalPoolTestDataSet dataset;
private: private: