Merge remote-tracking branch 'origin/gaisser_fixes_subsystem' into gaisser_fixes_subsystem
This commit is contained in:
commit
4fd443f70b
@ -1,5 +1,13 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
|
||||
option(FSFW_GENERATE_SECTIONS
|
||||
"Generate function and data sections. Required to remove unused code" ON
|
||||
)
|
||||
|
||||
if(FSFW_GENERATE_SECTIONS)
|
||||
option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON)
|
||||
endif()
|
||||
|
||||
option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON)
|
||||
# Options to exclude parts of the FSFW from compilation.
|
||||
option(FSFW_USE_RMAP "Compile with RMAP" ON)
|
||||
@ -26,15 +34,22 @@ if(NOT OS_FSFW)
|
||||
|
||||
endif()
|
||||
|
||||
set(FSFW_OSAL_DEFINITION FSFW_HOST)
|
||||
|
||||
if(${OS_FSFW} STREQUAL host)
|
||||
set(OS_FSFW_NAME "Host")
|
||||
elseif(${OS_FSFW} STREQUAL linux)
|
||||
set(OS_FSFW_NAME "Linux")
|
||||
set(FSFW_OSAL_DEFINITION FSFW_LINUX)
|
||||
elseif(${OS_FSFW} STREQUAL freertos)
|
||||
set(OS_FSFW_NAME "FreeRTOS")
|
||||
target_link_libraries(${LIB_FSFW_NAME} ${LIB_OS_NAME})
|
||||
set(FSFW_OSAL_DEFINITION FSFW_FREERTOS)
|
||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
||||
${LIB_OS_NAME}
|
||||
)
|
||||
elseif(${OS_FSFW} STREQUAL rtems)
|
||||
set(OS_FSFW_NAME "RTEMS")
|
||||
set(FSFW_OSAL_DEFINITION FSFW_RTEMS)
|
||||
else()
|
||||
message(WARNING
|
||||
"Invalid operating system for FSFW specified! Setting to host.."
|
||||
@ -43,6 +58,14 @@ else()
|
||||
set(OS_FSFW "host")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${LIB_FSFW_NAME} PRIVATE
|
||||
${FSFW_OSAL_DEFINITION}
|
||||
)
|
||||
|
||||
target_compile_definitions(${LIB_FSFW_NAME} INTERFACE
|
||||
${FSFW_OSAL_DEFINITION}
|
||||
)
|
||||
|
||||
message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.")
|
||||
|
||||
add_subdirectory(action)
|
||||
@ -88,6 +111,7 @@ add_subdirectory(timemanager)
|
||||
add_subdirectory(tmstorage)
|
||||
add_subdirectory(tmtcpacket)
|
||||
add_subdirectory(tmtcservices)
|
||||
add_subdirectory(unittest)
|
||||
|
||||
# The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it.
|
||||
# If this is not given, we include the default configuration and emit a warning.
|
||||
@ -107,6 +131,21 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(INCLUDE_PATH ${FSFW_ADDITIONAL_INC_PATH})
|
||||
if(IS_ABSOLUTE ${INCLUDE_PATH})
|
||||
set(CURR_ABS_INC_PATH "${FREERTOS_PATH}")
|
||||
else()
|
||||
get_filename_component(CURR_ABS_INC_PATH
|
||||
${INCLUDE_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
if(CMAKE_VERBOSE)
|
||||
message(STATUS "FSFW include path: ${CURR_ABS_INC_PATH}")
|
||||
endif()
|
||||
|
||||
list(APPEND FSFW_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH})
|
||||
endforeach()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(NOT DEFINED FSFW_WARNING_FLAGS)
|
||||
set(FSFW_WARNING_FLAGS
|
||||
@ -117,7 +156,20 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
-Wno-psabi
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
if(FSFW_GENERATE_SECTIONS)
|
||||
target_compile_options(${LIB_FSFW_NAME} PRIVATE
|
||||
"-ffunction-sections"
|
||||
"-fdata-sections"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FSFW_REMOVE_UNUSED_CODE)
|
||||
target_link_options(${LIB_FSFW_NAME} PRIVATE
|
||||
"Wl,--gc-sections"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FSFW_WARNING_SHADOW_LOCAL_GCC)
|
||||
list(APPEND WARNING_FLAGS "-Wshadow=local")
|
||||
endif()
|
||||
@ -132,6 +184,7 @@ endif()
|
||||
target_include_directories(${LIB_FSFW_NAME} INTERFACE
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${FSFW_CONFIG_PATH_ABSOLUTE}
|
||||
${FSFW_ADD_INC_PATHS_ABS}
|
||||
)
|
||||
|
||||
# Includes path required to compile FSFW itself as well
|
||||
@ -140,9 +193,14 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE
|
||||
target_include_directories(${LIB_FSFW_NAME} PRIVATE
|
||||
${CMAKE_SOURCE_DIR}
|
||||
${FSFW_CONFIG_PATH_ABSOLUTE}
|
||||
${FSFW_ADD_INC_PATHS_ABS}
|
||||
)
|
||||
|
||||
target_compile_options(${LIB_FSFW_NAME} PRIVATE
|
||||
${FSFW_WARNING_FLAGS}
|
||||
${COMPILER_FLAGS}
|
||||
)
|
||||
|
||||
target_link_libraries(${LIB_FSFW_NAME} PRIVATE
|
||||
${FSFW_ADDITIONAL_LINK_LIBS}
|
||||
)
|
@ -3,9 +3,9 @@
|
||||
|
||||
const char* const FSFW_VERSION_NAME = "ASTP";
|
||||
|
||||
#define FSFW_VERSION 0
|
||||
#define FSFW_SUBVERSION 0
|
||||
#define FSFW_REVISION 1
|
||||
#define FSFW_VERSION 1
|
||||
#define FSFW_SUBVERSION 0
|
||||
#define FSFW_REVISION 0
|
||||
|
||||
|
||||
|
||||
|
@ -147,11 +147,6 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
|
||||
return result;
|
||||
}
|
||||
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
ipcStore->deleteData(storeAddress);
|
||||
return result;
|
||||
}
|
||||
|
||||
/* We don't need to report the objectId, as we receive REQUESTED data before the completion
|
||||
success message. True aperiodic replies need to be reported with another dedicated message. */
|
||||
ActionMessage::setDataReply(&reply, replyId, storeAddress);
|
||||
|
@ -8,7 +8,9 @@
|
||||
*/
|
||||
template<typename T, size_t MAX_SIZE, typename count_t = uint8_t>
|
||||
class FixedArrayList: public ArrayList<T, count_t> {
|
||||
static_assert(MAX_SIZE <= (pow(2,sizeof(count_t)*8)-1), "count_t is not large enough to hold MAX_SIZE");
|
||||
#if !defined(_MSC_VER)
|
||||
static_assert(MAX_SIZE <= (std::pow(2,sizeof(count_t)*8)-1), "count_t is not large enough to hold MAX_SIZE");
|
||||
#endif
|
||||
private:
|
||||
T data[MAX_SIZE];
|
||||
public:
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "SharedRingBuffer.h"
|
||||
#include "../ipc/MutexFactory.h"
|
||||
#include "../ipc/MutexHelper.h"
|
||||
#include "../ipc/MutexGuard.h"
|
||||
|
||||
SharedRingBuffer::SharedRingBuffer(object_id_t objectId, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes):
|
||||
@ -17,6 +17,9 @@ SharedRingBuffer::SharedRingBuffer(object_id_t objectId, uint8_t *buffer,
|
||||
mutex = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
|
||||
SharedRingBuffer::~SharedRingBuffer() {
|
||||
MutexFactory::instance()->deleteMutex(mutex);
|
||||
}
|
||||
|
||||
void SharedRingBuffer::setToUseReceiveSizeFIFO(size_t fifoDepth) {
|
||||
this->fifoDepth = fifoDepth;
|
||||
|
@ -26,6 +26,18 @@ public:
|
||||
*/
|
||||
SharedRingBuffer(object_id_t objectId, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes);
|
||||
/**
|
||||
* This constructor takes an external buffer with the specified size.
|
||||
* @param buffer
|
||||
* @param size
|
||||
* @param overwriteOld
|
||||
* If the ring buffer is overflowing at a write operartion, the oldest data
|
||||
* will be overwritten.
|
||||
*/
|
||||
SharedRingBuffer(object_id_t objectId, uint8_t* buffer, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes);
|
||||
|
||||
virtual~ SharedRingBuffer();
|
||||
|
||||
/**
|
||||
* @brief This function can be used to add an optional FIFO to the class
|
||||
@ -37,16 +49,7 @@ public:
|
||||
*/
|
||||
void setToUseReceiveSizeFIFO(size_t fifoDepth);
|
||||
|
||||
/**
|
||||
* This constructor takes an external buffer with the specified size.
|
||||
* @param buffer
|
||||
* @param size
|
||||
* @param overwriteOld
|
||||
* If the ring buffer is overflowing at a write operartion, the oldest data
|
||||
* will be overwritten.
|
||||
*/
|
||||
SharedRingBuffer(object_id_t objectId, uint8_t* buffer, const size_t size,
|
||||
bool overwriteOld, size_t maxExcessBytes);
|
||||
|
||||
|
||||
/**
|
||||
* Unless a read-only constant value is read, all operations on the
|
||||
@ -66,7 +69,7 @@ public:
|
||||
|
||||
/**
|
||||
* The mutex handle can be accessed directly, for example to perform
|
||||
* the lock with the #MutexHelper for a RAII compliant lock operation.
|
||||
* the lock with the #MutexGuard for a RAII compliant lock operation.
|
||||
* @return
|
||||
*/
|
||||
MutexIF* getMutexHandle() const;
|
||||
|
@ -17,14 +17,6 @@ ReturnValue_t ExtendedControllerBase::executeAction(ActionId_t actionId,
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
ReturnValue_t ExtendedControllerBase::initializeLocalDataPool(
|
||||
localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) {
|
||||
/* Needs to be overriden and implemented by child class. */
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
object_id_t ExtendedControllerBase::getObjectId() const {
|
||||
return SystemObject::getObjectId();
|
||||
}
|
||||
@ -107,14 +99,6 @@ MessageQueueId_t ExtendedControllerBase::getCommandQueue() const {
|
||||
return commandQueue->getId();
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase* ExtendedControllerBase::getDataSetHandle(sid_t sid) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "ExtendedControllerBase::getDataSetHandle: No child "
|
||||
<< " implementation provided, returning nullptr!" << std::endl;
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LocalDataPoolManager* ExtendedControllerBase::getHkManagerHandle() {
|
||||
return &poolManager;
|
||||
}
|
||||
|
@ -61,11 +61,11 @@ protected:
|
||||
/* HasLocalDatapoolIF overrides */
|
||||
virtual LocalDataPoolManager* getHkManagerHandle() override;
|
||||
virtual object_id_t getObjectId() const override;
|
||||
virtual ReturnValue_t initializeLocalDataPool(
|
||||
localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override;
|
||||
virtual uint32_t getPeriodicOperationFrequency() const override;
|
||||
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||
|
||||
virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||
LocalDataPoolManager& poolManager) override = 0;
|
||||
virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ HkSwitchHelper::HkSwitchHelper(EventReportingProxyIF* eventProxy) :
|
||||
}
|
||||
|
||||
HkSwitchHelper::~HkSwitchHelper() {
|
||||
// TODO Auto-generated destructor stub
|
||||
QueueFactory::instance()->deleteMessageQueue(actionQueue);
|
||||
}
|
||||
|
||||
ReturnValue_t HkSwitchHelper::initialize() {
|
||||
|
@ -8,13 +8,16 @@
|
||||
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
||||
const size_t maxFillCount):
|
||||
registeredVariables(registeredVariablesArray),
|
||||
maxFillCount(maxFillCount) {
|
||||
}
|
||||
maxFillCount(maxFillCount) {}
|
||||
|
||||
PoolDataSetBase::~PoolDataSetBase() {}
|
||||
|
||||
|
||||
ReturnValue_t PoolDataSetBase::registerVariable(PoolVariableIF *variable) {
|
||||
if(registeredVariables == nullptr) {
|
||||
/* Underlying container invalid */
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
if (state != States::STATE_SET_UNINITIALISED) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "DataSet::registerVariable: Call made in wrong position." << std::endl;
|
||||
@ -61,11 +64,11 @@ ReturnValue_t PoolDataSetBase::read(MutexIF::TimeoutType timeoutType,
|
||||
}
|
||||
else {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "DataSet::read(): Call made in wrong position. Don't forget to commit"
|
||||
" member datasets!" << std::endl;
|
||||
sif::warning << "PoolDataSetBase::read: Call made in wrong position. Don't forget to "
|
||||
"commit member datasets!" << std::endl;
|
||||
#else
|
||||
sif::printError("DataSet::read(): Call made in wrong position. Don't forget to commit"
|
||||
" member datasets!\n");
|
||||
sif::printWarning("PoolDataSetBase::read: Call made in wrong position. Don't forget to "
|
||||
"commit member datasets!\n");
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
result = SET_WAS_ALREADY_READ;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@
|
||||
* and unlock a data pool and read/commit semantics.
|
||||
*/
|
||||
class PoolDataSetIF:
|
||||
public DataSetIF,
|
||||
public ReadCommitIF {
|
||||
virtual public DataSetIF,
|
||||
virtual public ReadCommitIF {
|
||||
public:
|
||||
virtual~ PoolDataSetIF() {};
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
template <typename T>
|
||||
PoolEntry<T>::PoolEntry(std::initializer_list<T> initValue, bool setValid ):
|
||||
length(initValue.size()), valid(setValid) {
|
||||
length(static_cast<uint8_t>(initValue.size())), valid(setValid) {
|
||||
this->address = new T[this->length];
|
||||
if(initValue.size() == 0) {
|
||||
std::memset(this->address, 0, this->getByteSize());
|
||||
|
@ -1,13 +1,15 @@
|
||||
#ifndef FRAMEWORK_DATAPOOL_SHAREDDATASETIF_H_
|
||||
#define FRAMEWORK_DATAPOOL_SHAREDDATASETIF_H_
|
||||
|
||||
#include "PoolDataSetIF.h"
|
||||
|
||||
class SharedDataSetIF: public PoolDataSetIF {
|
||||
class SharedDataSetIF {
|
||||
public:
|
||||
virtual ~SharedDataSetIF() {};
|
||||
|
||||
private:
|
||||
virtual ReturnValue_t lockDataset(dur_millis_t mutexTimeout) = 0;
|
||||
virtual ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType,
|
||||
dur_millis_t mutexTimeout) = 0;
|
||||
virtual ReturnValue_t unlockDataset() = 0;
|
||||
};
|
||||
|
||||
|
@ -65,34 +65,45 @@ public:
|
||||
* usually be the period the pool owner performs its periodic operation.
|
||||
* @return
|
||||
*/
|
||||
virtual uint32_t getPeriodicOperationFrequency() const = 0;
|
||||
virtual dur_millis_t getPeriodicOperationFrequency() const = 0;
|
||||
|
||||
/**
|
||||
* @brief This function will be called by the manager if an update
|
||||
* notification is received.
|
||||
* @details HasLocalDataPoolIF
|
||||
* Can be overriden by the child class to handle changed datasets.
|
||||
* @param sid
|
||||
* @param storeId If a snapshot was requested, data will be located inside
|
||||
* @param sid SID of the updated set
|
||||
* @param storeId If a snapshot was requested, data will be located inside
|
||||
* the IPC store with this store ID.
|
||||
* @param clearMessage If this is set to true, the pool manager will take care of
|
||||
* clearing the store automatically
|
||||
*/
|
||||
virtual void handleChangedDataset(sid_t sid,
|
||||
store_address_t storeId = storeId::INVALID_STORE_ADDRESS) {
|
||||
return;
|
||||
store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
|
||||
bool* clearMessage = nullptr) {
|
||||
if(clearMessage != nullptr) {
|
||||
*clearMessage = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function will be called by the manager if an update
|
||||
* notification is received.
|
||||
* @details
|
||||
* Can be overriden by the child class to handle changed pool IDs.
|
||||
* @param sid
|
||||
* @param storeId If a snapshot was requested, data will be located inside
|
||||
* Can be overriden by the child class to handle changed pool variables.
|
||||
* @param gpid GPID of the updated variable.
|
||||
* @param storeId If a snapshot was requested, data will be located inside
|
||||
* the IPC store with this store ID.
|
||||
* @param clearMessage Relevant for snapshots. If the boolean this points to is set to true,
|
||||
* the pool manager will take care of clearing the store automatically
|
||||
* after the callback.
|
||||
*/
|
||||
virtual void handleChangedPoolVariable(gp_id_t globPoolId,
|
||||
store_address_t storeId = storeId::INVALID_STORE_ADDRESS) {
|
||||
return;
|
||||
virtual void handleChangedPoolVariable(gp_id_t gpid,
|
||||
store_address_t storeId = storeId::INVALID_STORE_ADDRESS,
|
||||
bool* clearMessage = nullptr) {
|
||||
if(clearMessage != nullptr) {
|
||||
*clearMessage = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "../housekeeping/AcceptsHkPacketsIF.h"
|
||||
#include "../timemanager/CCSDSTime.h"
|
||||
#include "../ipc/MutexFactory.h"
|
||||
#include "../ipc/MutexHelper.h"
|
||||
#include "../ipc/MutexGuard.h"
|
||||
#include "../ipc/QueueFactory.h"
|
||||
|
||||
#include <array>
|
||||
@ -38,7 +38,11 @@ LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQue
|
||||
hkQueue = queueToUse;
|
||||
}
|
||||
|
||||
LocalDataPoolManager::~LocalDataPoolManager() {}
|
||||
LocalDataPoolManager::~LocalDataPoolManager() {
|
||||
if(mutex != nullptr) {
|
||||
MutexFactory::instance()->deleteMutex(mutex);
|
||||
}
|
||||
}
|
||||
|
||||
ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) {
|
||||
if(queueToUse == nullptr) {
|
||||
@ -132,13 +136,16 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
|
||||
ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver,
|
||||
ReturnValue_t& status) {
|
||||
if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) {
|
||||
// Update packets shall only be generated from datasets.
|
||||
/* Update packets shall only be generated from datasets. */
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner,
|
||||
receiver.dataId.sid);
|
||||
if(dataSet == nullptr) {
|
||||
return DATASET_NOT_FOUND;
|
||||
}
|
||||
if(dataSet->hasChanged()) {
|
||||
// prepare and send update notification
|
||||
/* Prepare and send update notification */
|
||||
ReturnValue_t result = generateHousekeepingPacket(
|
||||
receiver.dataId.sid, dataSet, true);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -328,7 +335,7 @@ void LocalDataPoolManager::handleChangeResetLogic(
|
||||
toReset->setChanged(false);
|
||||
}
|
||||
/* All recipients have been notified, reset the changed flag */
|
||||
if(changeInfo.currentUpdateCounter <= 1) {
|
||||
else if(changeInfo.currentUpdateCounter <= 1) {
|
||||
toReset->setChanged(false);
|
||||
changeInfo.currentUpdateCounter = 0;
|
||||
}
|
||||
@ -372,7 +379,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid,
|
||||
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enableReporting);
|
||||
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics);
|
||||
LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, collectionInterval,
|
||||
owner->getPeriodicOperationFrequency(), isDiagnostics);
|
||||
owner->getPeriodicOperationFrequency());
|
||||
}
|
||||
|
||||
hkReceivers.push_back(hkReceiver);
|
||||
@ -398,7 +405,6 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid,
|
||||
hkReceiver.destinationQueue = hkReceiverObject->getHkQueue();
|
||||
|
||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||
if(dataSet != nullptr) {
|
||||
LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, true);
|
||||
LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics);
|
||||
@ -516,11 +522,19 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(
|
||||
}
|
||||
|
||||
case(HousekeepingMessage::REPORT_DIAGNOSTICS_REPORT_STRUCTURES): {
|
||||
return generateSetStructurePacket(sid, true);
|
||||
result = generateSetStructurePacket(sid, true);
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case(HousekeepingMessage::REPORT_HK_REPORT_STRUCTURES): {
|
||||
return generateSetStructurePacket(sid, false);
|
||||
result = generateSetStructurePacket(sid, false);
|
||||
if(result == HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case(HousekeepingMessage::MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL):
|
||||
case(HousekeepingMessage::MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL): {
|
||||
@ -540,14 +554,15 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(
|
||||
case(HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT):
|
||||
case(HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT): {
|
||||
LocalPoolDataSetBase* dataSet =HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||
if(command == HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT
|
||||
and LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
|
||||
return WRONG_HK_PACKET_TYPE;
|
||||
result = WRONG_HK_PACKET_TYPE;
|
||||
break;
|
||||
}
|
||||
else if(command == HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT
|
||||
and not LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
|
||||
return WRONG_HK_PACKET_TYPE;
|
||||
result = WRONG_HK_PACKET_TYPE;
|
||||
break;
|
||||
}
|
||||
return generateHousekeepingPacket(HousekeepingMessage::getSid(message),
|
||||
dataSet, true);
|
||||
@ -566,14 +581,22 @@ ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage(
|
||||
case(HousekeepingMessage::UPDATE_SNAPSHOT_SET): {
|
||||
store_address_t storeId;
|
||||
HousekeepingMessage::getUpdateSnapshotSetCommand(message, &storeId);
|
||||
owner->handleChangedDataset(sid, storeId);
|
||||
bool clearMessage = true;
|
||||
owner->handleChangedDataset(sid, storeId, &clearMessage);
|
||||
if(clearMessage) {
|
||||
message->clear();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
case(HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE): {
|
||||
store_address_t storeId;
|
||||
gp_id_t globPoolId = HousekeepingMessage::getUpdateSnapshotVariableCommand(message,
|
||||
&storeId);
|
||||
owner->handleChangedPoolVariable(globPoolId, storeId);
|
||||
bool clearMessage = true;
|
||||
owner->handleChangedPoolVariable(globPoolId, storeId, &clearMessage);
|
||||
if(clearMessage) {
|
||||
message->clear();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
@ -616,7 +639,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
||||
LocalPoolDataSetBase* dataSet, bool forDownlink,
|
||||
MessageQueueId_t destination) {
|
||||
if(dataSet == nullptr) {
|
||||
// Configuration error.
|
||||
/* Configuration error. */
|
||||
printWarningOrError(sif::OutputTypes::OUT_WARNING,
|
||||
"generateHousekeepingPacket",
|
||||
DATASET_NOT_FOUND);
|
||||
@ -632,7 +655,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
||||
return result;
|
||||
}
|
||||
|
||||
// and now we set a HK message and send it the HK packet destination.
|
||||
/* Now we set a HK message and send it the HK packet destination. */
|
||||
CommandMessage hkMessage;
|
||||
if(LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) {
|
||||
HousekeepingMessage::setHkDiagnosticsReply(&hkMessage, sid, storeId);
|
||||
@ -642,7 +665,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
||||
}
|
||||
|
||||
if(hkQueue == nullptr) {
|
||||
// error, no queue available to send packet with.
|
||||
/* Error, no queue available to send packet with. */
|
||||
printWarningOrError(sif::OutputTypes::OUT_WARNING,
|
||||
"generateHousekeepingPacket",
|
||||
QUEUE_OR_DESTINATION_INVALID);
|
||||
@ -650,7 +673,7 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
|
||||
}
|
||||
if(destination == MessageQueueIF::NO_QUEUE) {
|
||||
if(hkDestinationId == MessageQueueIF::NO_QUEUE) {
|
||||
// error, all destinations invalid
|
||||
/* Error, all destinations invalid */
|
||||
printWarningOrError(sif::OutputTypes::OUT_WARNING,
|
||||
"generateHousekeepingPacket",
|
||||
QUEUE_OR_DESTINATION_INVALID);
|
||||
@ -729,6 +752,12 @@ void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) {
|
||||
ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid,
|
||||
bool enable, bool isDiagnostics) {
|
||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||
if(dataSet == nullptr) {
|
||||
printWarningOrError(sif::OutputTypes::OUT_WARNING, "togglePeriodicGeneration",
|
||||
DATASET_NOT_FOUND);
|
||||
return DATASET_NOT_FOUND;
|
||||
}
|
||||
|
||||
if((LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and not isDiagnostics) or
|
||||
(not LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and isDiagnostics)) {
|
||||
return WRONG_HK_PACKET_TYPE;
|
||||
@ -746,6 +775,12 @@ ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid,
|
||||
ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid,
|
||||
float newCollectionInterval, bool isDiagnostics) {
|
||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||
if(dataSet == nullptr) {
|
||||
printWarningOrError(sif::OutputTypes::OUT_WARNING, "changeCollectionInterval",
|
||||
DATASET_NOT_FOUND);
|
||||
return DATASET_NOT_FOUND;
|
||||
}
|
||||
|
||||
bool targetIsDiagnostics = LocalPoolDataSetAttorney::isDiagnostics(*dataSet);
|
||||
if((targetIsDiagnostics and not isDiagnostics) or
|
||||
(not targetIsDiagnostics and isDiagnostics)) {
|
||||
@ -756,7 +791,7 @@ ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid,
|
||||
LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet);
|
||||
|
||||
if(periodicHelper == nullptr) {
|
||||
// config error
|
||||
/* Configuration error, set might not have a corresponding pool manager */
|
||||
return PERIODIC_HELPER_INVALID;
|
||||
}
|
||||
|
||||
@ -766,13 +801,11 @@ ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid,
|
||||
|
||||
ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
||||
bool isDiagnostics) {
|
||||
// Get and check dataset first.
|
||||
//LocalPoolDataSetBase* dataSet = owner->getDataSetHandle(sid);
|
||||
/* Get and check dataset first. */
|
||||
LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid);
|
||||
if(dataSet == nullptr) {
|
||||
printWarningOrError(sif::OutputTypes::OUT_WARNING,
|
||||
"performPeriodicHkGeneration",
|
||||
DATASET_NOT_FOUND);
|
||||
"performPeriodicHkGeneration", DATASET_NOT_FOUND);
|
||||
return DATASET_NOT_FOUND;
|
||||
}
|
||||
|
||||
@ -831,6 +864,10 @@ ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid,
|
||||
void LocalDataPoolManager::clearReceiversList() {
|
||||
/* Clear the vector completely and releases allocated memory. */
|
||||
HkReceivers().swap(hkReceivers);
|
||||
/* Also clear the reset helper if it exists */
|
||||
if(hkUpdateResetList != nullptr) {
|
||||
HkUpdateResetList().swap(*hkUpdateResetList);
|
||||
}
|
||||
}
|
||||
|
||||
MutexIF* LocalDataPoolManager::getLocalPoolMutex() {
|
||||
@ -843,6 +880,7 @@ object_id_t LocalDataPoolManager::getCreatorObjectId() const {
|
||||
|
||||
void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
|
||||
const char* functionName, ReturnValue_t error, const char* errorPrint) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
if(errorPrint == nullptr) {
|
||||
if(error == DATASET_NOT_FOUND) {
|
||||
errorPrint = "Dataset not found";
|
||||
@ -871,33 +909,32 @@ void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType,
|
||||
errorPrint = "Unknown error";
|
||||
}
|
||||
}
|
||||
object_id_t objectId = 0xffffffff;
|
||||
if(owner != nullptr) {
|
||||
objectId = owner->getObjectId();
|
||||
}
|
||||
|
||||
if(outputType == sif::OutputTypes::OUT_WARNING) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::warning << "LocalDataPoolManager::" << functionName
|
||||
<< ": Object ID 0x" << std::setw(8) << std::setfill('0')
|
||||
<< std::hex << owner->getObjectId() << " | " << errorPrint
|
||||
<< std::dec << std::setfill(' ') << std::endl;
|
||||
sif::warning << "LocalDataPoolManager::" << functionName << ": Object ID 0x" <<
|
||||
std::setw(8) << std::setfill('0') << std::hex << objectId << " | " << errorPrint <<
|
||||
std::dec << std::setfill(' ') << std::endl;
|
||||
#else
|
||||
sif::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
|
||||
functionName, owner->getObjectId(), errorPrint);
|
||||
functionName, objectId, errorPrint);
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||
}
|
||||
else if(outputType == sif::OutputTypes::OUT_ERROR) {
|
||||
#if FSFW_VERBOSE_LEVEL >= 1
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "LocalDataPoolManager::" << functionName
|
||||
<< ": Object ID 0x" << std::setw(8) << std::setfill('0')
|
||||
<< std::hex << owner->getObjectId() << " | " << errorPrint
|
||||
<< std::dec << std::setfill(' ') << std::endl;
|
||||
sif::error << "LocalDataPoolManager::" << functionName << ": Object ID 0x" <<
|
||||
std::setw(8) << std::setfill('0') << std::hex << objectId << " | " << errorPrint <<
|
||||
std::dec << std::setfill(' ') << std::endl;
|
||||
#else
|
||||
sif::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n",
|
||||
functionName, owner->getObjectId(), errorPrint);
|
||||
functionName, objectId, errorPrint);
|
||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
|
||||
}
|
||||
#endif /* #if FSFW_VERBOSE_LEVEL >= 1 */
|
||||
}
|
||||
|
||||
LocalDataPoolManager* LocalDataPoolManager::getPoolManagerHandle() {
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "../ipc/MutexIF.h"
|
||||
#include "../ipc/CommandMessage.h"
|
||||
#include "../ipc/MessageQueueIF.h"
|
||||
#include "../ipc/MutexHelper.h"
|
||||
#include "../ipc/MutexGuard.h"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
@ -391,6 +391,10 @@ protected:
|
||||
|
||||
template<class T> inline
|
||||
ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId, PoolEntry<T> **poolEntry) {
|
||||
if(poolEntry == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
auto poolIter = localPoolMap.find(localPoolId);
|
||||
if (poolIter == localPoolMap.end()) {
|
||||
printWarningOrError(sif::OutputTypes::OUT_WARNING, "fetchPoolEntry",
|
||||
|
@ -44,7 +44,7 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner,
|
||||
|
||||
LocalPoolDataSetBase::LocalPoolDataSetBase(sid_t sid, PoolVariableIF** registeredVariablesArray,
|
||||
const size_t maxNumberOfVariables):
|
||||
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||
HasLocalDataPoolIF* hkOwner = objectManager->get<HasLocalDataPoolIF>(
|
||||
sid.objectId);
|
||||
if(hkOwner != nullptr) {
|
||||
@ -58,8 +58,7 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(sid_t sid, PoolVariableIF** registere
|
||||
this->sid = sid;
|
||||
}
|
||||
|
||||
LocalPoolDataSetBase::LocalPoolDataSetBase(
|
||||
PoolVariableIF **registeredVariablesArray,
|
||||
LocalPoolDataSetBase::LocalPoolDataSetBase(PoolVariableIF **registeredVariablesArray,
|
||||
const size_t maxNumberOfVariables, bool protectEveryReadCommitCall):
|
||||
PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) {
|
||||
this->setReadCommitProtectionBehaviour(protectEveryReadCommitCall);
|
||||
@ -95,14 +94,23 @@ ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(uint8_t **buffer
|
||||
size_t *size, size_t maxSize,
|
||||
SerializeIF::Endianness streamEndianness) const {
|
||||
ReturnValue_t result = HasReturnvaluesIF::RETURN_OK;
|
||||
uint8_t validityMaskSize = std::ceil(static_cast<float>(fillCount)/8.0);
|
||||
uint8_t validityMask[validityMaskSize] = {};
|
||||
const uint8_t validityMaskSize = std::ceil(static_cast<float>(fillCount)/8.0);
|
||||
uint8_t* validityPtr = nullptr;
|
||||
#ifdef _MSC_VER
|
||||
/* Use a std::vector here because MSVC will (rightly) not create a fixed size array
|
||||
with a non constant size specifier */
|
||||
std::vector<uint8_t> validityMask(validityMaskSize);
|
||||
validityPtr = validityMask.data();
|
||||
#else
|
||||
uint8_t validityMask[validityMaskSize] = {0};
|
||||
validityPtr = validityMask;
|
||||
#endif
|
||||
uint8_t validBufferIndex = 0;
|
||||
uint8_t validBufferIndexBit = 0;
|
||||
for (uint16_t count = 0; count < fillCount; count++) {
|
||||
if(registeredVariables[count]->isValid()) {
|
||||
/* Set bit at correct position */
|
||||
bitutil::bitSet(validityMask + validBufferIndex, validBufferIndexBit);
|
||||
bitutil::bitSet(validityPtr + validBufferIndex, validBufferIndexBit);
|
||||
}
|
||||
if(validBufferIndexBit == 7) {
|
||||
validBufferIndex ++;
|
||||
@ -123,7 +131,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(uint8_t **buffer
|
||||
return SerializeIF::BUFFER_TOO_SHORT;
|
||||
}
|
||||
// copy validity buffer to end
|
||||
std::memcpy(*buffer, validityMask, validityMaskSize);
|
||||
std::memcpy(*buffer, validityPtr, validityMaskSize);
|
||||
*size += validityMaskSize;
|
||||
return result;
|
||||
}
|
||||
@ -262,11 +270,9 @@ bool LocalPoolDataSetBase::getReportingEnabled() const {
|
||||
return reportingEnabled;
|
||||
}
|
||||
|
||||
void LocalPoolDataSetBase::initializePeriodicHelper(
|
||||
float collectionInterval, dur_millis_t minimumPeriodicInterval,
|
||||
bool isDiagnostics, uint8_t nonDiagIntervalFactor) {
|
||||
periodicHelper->initialize(collectionInterval, minimumPeriodicInterval,
|
||||
isDiagnostics, nonDiagIntervalFactor);
|
||||
void LocalPoolDataSetBase::initializePeriodicHelper(float collectionInterval,
|
||||
dur_millis_t minimumPeriodicInterval, uint8_t nonDiagIntervalFactor) {
|
||||
periodicHelper->initialize(collectionInterval, minimumPeriodicInterval, nonDiagIntervalFactor);
|
||||
}
|
||||
|
||||
void LocalPoolDataSetBase::setChanged(bool changed) {
|
||||
@ -306,3 +312,12 @@ void LocalPoolDataSetBase::setAllVariablesReadOnly() {
|
||||
registeredVariables[idx]->setReadWriteMode(pool_rwm_t::VAR_READ);
|
||||
}
|
||||
}
|
||||
|
||||
float LocalPoolDataSetBase::getCollectionInterval() const {
|
||||
if(periodicHelper != nullptr) {
|
||||
return periodicHelper->getCollectionIntervalInSeconds();
|
||||
}
|
||||
else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
@ -166,6 +166,16 @@ public:
|
||||
|
||||
object_id_t getCreatorObjectId();
|
||||
|
||||
bool getReportingEnabled() const;
|
||||
|
||||
/**
|
||||
* Returns the current periodic HK generation interval this set
|
||||
* belongs to a HK manager and the interval is not 0. Otherwise,
|
||||
* returns 0.0
|
||||
* @return
|
||||
*/
|
||||
float getCollectionInterval() const;
|
||||
|
||||
protected:
|
||||
sid_t sid;
|
||||
//! This mutex is used if the data is created by one object only.
|
||||
@ -180,11 +190,9 @@ protected:
|
||||
*/
|
||||
bool reportingEnabled = false;
|
||||
void setReportingEnabled(bool enabled);
|
||||
bool getReportingEnabled() const;
|
||||
|
||||
void initializePeriodicHelper(float collectionInterval,
|
||||
dur_millis_t minimumPeriodicInterval,
|
||||
bool isDiagnostics, uint8_t nonDiagIntervalFactor = 5);
|
||||
void initializePeriodicHelper(float collectionInterval, dur_millis_t minimumPeriodicInterval,
|
||||
uint8_t nonDiagIntervalFactor = 5);
|
||||
|
||||
/**
|
||||
* If the valid state of a dataset is always relevant to the whole
|
||||
|
@ -25,7 +25,7 @@ inline LocalPoolVector<T, vectorSize>::LocalPoolVector(gp_id_t globalPoolId,
|
||||
template<typename T, uint16_t vectorSize>
|
||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::read(
|
||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||
MutexHelper(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||
MutexGuard(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||
return readWithoutLock();
|
||||
}
|
||||
template<typename T, uint16_t vectorSize>
|
||||
@ -64,7 +64,7 @@ inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(bool valid,
|
||||
template<typename T, uint16_t vectorSize>
|
||||
inline ReturnValue_t LocalPoolVector<T, vectorSize>::commit(
|
||||
MutexIF::TimeoutType timeoutType, uint32_t timeoutMs) {
|
||||
MutexHelper(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||
MutexGuard(LocalDpManagerAttorney::getMutexHandle(*hkManager), timeoutType, timeoutMs);
|
||||
return commitWithoutLock();
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,37 @@
|
||||
#include "SharedLocalDataSet.h"
|
||||
|
||||
|
||||
SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId, sid_t sid,
|
||||
const size_t maxSize): SystemObject(objectId),
|
||||
LocalPoolDataSetBase(sid, nullptr, maxSize) {
|
||||
LocalPoolDataSetBase(sid, nullptr, maxSize), poolVarVector(maxSize) {
|
||||
this->setContainer(poolVarVector.data());
|
||||
datasetLock = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
|
||||
ReturnValue_t SharedLocalDataSet::lockDataset(dur_millis_t mutexTimeout) {
|
||||
return datasetLock->lockMutex(MutexIF::TimeoutType::WAITING, mutexTimeout);
|
||||
SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId,
|
||||
HasLocalDataPoolIF *owner, uint32_t setId,
|
||||
const size_t maxSize): SystemObject(objectId),
|
||||
LocalPoolDataSetBase(owner, setId, nullptr, maxSize), poolVarVector(maxSize) {
|
||||
this->setContainer(poolVarVector.data());
|
||||
datasetLock = MutexFactory::instance()->createMutex();
|
||||
}
|
||||
|
||||
ReturnValue_t SharedLocalDataSet::lockDataset(MutexIF::TimeoutType timeoutType,
|
||||
dur_millis_t mutexTimeout) {
|
||||
if(datasetLock != nullptr) {
|
||||
return datasetLock->lockMutex(timeoutType, mutexTimeout);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
|
||||
SharedLocalDataSet::~SharedLocalDataSet() {
|
||||
MutexFactory::instance()->deleteMutex(datasetLock);
|
||||
}
|
||||
|
||||
ReturnValue_t SharedLocalDataSet::unlockDataset() {
|
||||
return datasetLock->unlockMutex();
|
||||
if(datasetLock != nullptr) {
|
||||
return datasetLock->unlockMutex();
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
@ -11,16 +11,22 @@
|
||||
* multiple threads. It provides a lock in addition to all other functionalities provided
|
||||
* by the LocalPoolDataSetBase class.
|
||||
*
|
||||
* TODO: override and protect read, commit and some other calls used by pool manager.
|
||||
* The user is completely responsible for lockingand unlocking the dataset when using the
|
||||
* shared dataset.
|
||||
*/
|
||||
class SharedLocalDataSet:
|
||||
public SystemObject,
|
||||
public LocalPoolDataSetBase,
|
||||
public SharedDataSetIF {
|
||||
public:
|
||||
SharedLocalDataSet(object_id_t objectId, sid_t sid,
|
||||
SharedLocalDataSet(object_id_t objectId, HasLocalDataPoolIF* owner, uint32_t setId,
|
||||
const size_t maxSize);
|
||||
ReturnValue_t lockDataset(dur_millis_t mutexTimeout) override;
|
||||
SharedLocalDataSet(object_id_t objectId, sid_t sid, const size_t maxSize);
|
||||
|
||||
virtual~ SharedLocalDataSet();
|
||||
|
||||
ReturnValue_t lockDataset(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
||||
dur_millis_t mutexTimeout = 20) override;
|
||||
ReturnValue_t unlockDataset() override;
|
||||
private:
|
||||
|
||||
|
12
datapoollocal/datapoollocal.h
Normal file
12
datapoollocal/datapoollocal.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_
|
||||
#define FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_
|
||||
|
||||
/* Collected related headers */
|
||||
#include "LocalPoolVariable.h"
|
||||
#include "LocalPoolVector.h"
|
||||
#include "StaticLocalDataSet.h"
|
||||
#include "LocalDataSet.h"
|
||||
#include "SharedLocalDataSet.h"
|
||||
|
||||
|
||||
#endif /* FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ */
|
@ -14,9 +14,8 @@ private:
|
||||
}
|
||||
|
||||
static void initializePeriodicHelper(LocalPoolDataSetBase& set, float collectionInterval,
|
||||
uint32_t minimumPeriodicIntervalMs,
|
||||
bool isDiagnostics, uint8_t nonDiagIntervalFactor = 5) {
|
||||
set.initializePeriodicHelper(collectionInterval, minimumPeriodicIntervalMs, isDiagnostics,
|
||||
uint32_t minimumPeriodicIntervalMs, uint8_t nonDiagIntervalFactor = 5) {
|
||||
set.initializePeriodicHelper(collectionInterval, minimumPeriodicIntervalMs,
|
||||
nonDiagIntervalFactor);
|
||||
}
|
||||
|
||||
|
@ -96,11 +96,11 @@ union gp_id_t {
|
||||
return raw == INVALID_GPID;
|
||||
}
|
||||
|
||||
bool operator==(const sid_t& other) const {
|
||||
bool operator==(const gp_id_t& other) const {
|
||||
return raw == other.raw;
|
||||
}
|
||||
|
||||
bool operator!=(const sid_t& other) const {
|
||||
bool operator!=(const gp_id_t& other) const {
|
||||
return not (raw == other.raw);
|
||||
}
|
||||
};
|
||||
|
@ -40,6 +40,13 @@
|
||||
//! Specify whether a special mode store is used for Subsystem components.
|
||||
#define FSFW_USE_MODESTORE 0
|
||||
|
||||
//! Defines if the real time scheduler for linux should be used.
|
||||
//! If set to 0, this will also disable priority settings for linux
|
||||
//! as most systems will not allow to set nice values without privileges
|
||||
//! For embedded linux system set this to 1.
|
||||
//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run
|
||||
#define FSFW_USE_REALTIME_FOR_LINUX 1
|
||||
|
||||
namespace fsfwconfig {
|
||||
//! Default timestamp size. The default timestamp will be an eight byte CDC
|
||||
//! short timestamp.
|
||||
@ -52,11 +59,12 @@ static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120;
|
||||
|
||||
//! Defines the FIFO depth of each commanding service base which
|
||||
//! also determines how many commands a CSB service can handle in one cycle
|
||||
//! simulataneously. This will increase the required RAM for
|
||||
//! simultaneously. This will increase the required RAM for
|
||||
//! each CSB service !
|
||||
static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6;
|
||||
|
||||
static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124;
|
||||
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FSFWCONFIG_H_ */
|
||||
|
@ -1483,7 +1483,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
|
||||
if(errorCode == ObjectManagerIF::CHILD_INIT_FAILED) {
|
||||
errorPrint = "Initialization error";
|
||||
}
|
||||
if(errorCode == HasReturnvaluesIF::RETURN_FAILED) {
|
||||
else if(errorCode == HasReturnvaluesIF::RETURN_FAILED) {
|
||||
if(errorType == sif::OutputTypes::OUT_WARNING) {
|
||||
errorPrint = "Generic Warning";
|
||||
}
|
||||
@ -1495,6 +1495,9 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
|
||||
errorPrint = "Unknown error";
|
||||
}
|
||||
}
|
||||
if(functionName == nullptr) {
|
||||
functionName = "unknown function";
|
||||
}
|
||||
|
||||
if(errorType == sif::OutputTypes::OUT_WARNING) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
@ -1504,7 +1507,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
|
||||
<< std::setfill(' ') << std::endl;
|
||||
#else
|
||||
sif::printWarning("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n",
|
||||
this->getObjectId(), errorPrint);
|
||||
functionName, this->getObjectId(), errorPrint);
|
||||
#endif
|
||||
}
|
||||
else if(errorType == sif::OutputTypes::OUT_ERROR) {
|
||||
@ -1515,7 +1518,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType,
|
||||
<< std::setfill(' ') << std::endl;
|
||||
#else
|
||||
sif::printError("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n",
|
||||
this->getObjectId(), errorPrint);
|
||||
functionName, this->getObjectId(), errorPrint);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
DeviceHandlerIF::DEFAULT_THERMAL_STATE_POOL_ID,
|
||||
lp_id_t thermalRequestPoolId =
|
||||
DeviceHandlerIF::DEFAULT_THERMAL_HEATING_REQUEST_POOL_ID,
|
||||
uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID);
|
||||
uint32_t thermalSetId = DeviceHandlerIF::DEFAULT_THERMAL_SET_ID);
|
||||
/**
|
||||
* @brief Helper function to ease device handler development.
|
||||
* This will instruct the transition to MODE_ON immediately
|
||||
|
@ -16,9 +16,9 @@ ReturnValue_t HealthDevice::performOperation(uint8_t opCode) {
|
||||
CommandMessage command;
|
||||
ReturnValue_t result = commandQueue->receiveMessage(&command);
|
||||
if (result == HasReturnvaluesIF::RETURN_OK) {
|
||||
healthHelper.handleHealthCommand(&command);
|
||||
result = healthHelper.handleHealthCommand(&command);
|
||||
}
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
return result;
|
||||
}
|
||||
|
||||
ReturnValue_t HealthDevice::initialize() {
|
||||
|
@ -109,6 +109,6 @@ bool EventMessage::isClearedEventMessage() {
|
||||
return getEvent() == INVALID_EVENT;
|
||||
}
|
||||
|
||||
size_t EventMessage::getMinimumMessageSize() {
|
||||
size_t EventMessage::getMinimumMessageSize() const {
|
||||
return EVENT_MESSAGE_SIZE;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
|
||||
protected:
|
||||
static const Event INVALID_EVENT = 0;
|
||||
virtual size_t getMinimumMessageSize();
|
||||
virtual size_t getMinimumMessageSize() const override;
|
||||
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ void arrayprinter::printHex(const uint8_t *data, size_t size,
|
||||
#else
|
||||
// General format: 0x01, 0x02, 0x03 so it is number of chars times 6
|
||||
// plus line break plus small safety margin.
|
||||
char printBuffer[(size + 1) * 7 + 1];
|
||||
char printBuffer[(size + 1) * 7 + 1] = {};
|
||||
size_t currentPos = 0;
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
// To avoid buffer overflows.
|
||||
@ -67,7 +67,9 @@ void arrayprinter::printHex(const uint8_t *data, size_t size,
|
||||
}
|
||||
}
|
||||
}
|
||||
#if FSFW_DISABLE_PRINTOUT == 0
|
||||
printf("[%s]\n", printBuffer);
|
||||
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -92,7 +94,7 @@ void arrayprinter::printDec(const uint8_t *data, size_t size,
|
||||
#else
|
||||
// General format: 32, 243, -12 so it is number of chars times 5
|
||||
// plus line break plus small safety margin.
|
||||
char printBuffer[(size + 1) * 5 + 1];
|
||||
char printBuffer[(size + 1) * 5 + 1] = {};
|
||||
size_t currentPos = 0;
|
||||
for(size_t i = 0; i < size; i++) {
|
||||
// To avoid buffer overflows.
|
||||
@ -108,7 +110,9 @@ void arrayprinter::printDec(const uint8_t *data, size_t size,
|
||||
}
|
||||
}
|
||||
}
|
||||
#if FSFW_DISABLE_PRINTOUT == 0
|
||||
printf("[%s]\n", printBuffer);
|
||||
#endif /* FSFW_DISABLE_PRINTOUT == 0 */
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "HealthTable.h"
|
||||
#include "../ipc/MutexHelper.h"
|
||||
#include "../ipc/MutexGuard.h"
|
||||