Update package 2 #22
@ -81,4 +81,7 @@ now
|
|||||||
For the fsfw, this can be done by checking the processor define FSFW_CPP_OSTREAM_ENABLED from FSFWConfig.h.
|
For the fsfw, this can be done by checking the processor define FSFW_CPP_OSTREAM_ENABLED from FSFWConfig.h.
|
||||||
For mission code, developers need to replace sif:: calls by the printf counterparts, but only if the CPP stream are excluded.
|
For mission code, developers need to replace sif:: calls by the printf counterparts, but only if the CPP stream are excluded.
|
||||||
If this is not the case, everything should work as usual.
|
If this is not the case, everything should work as usual.
|
||||||
-
|
|
||||||
|
### PUS Parameter Service 20
|
||||||
|
|
||||||
|
Added PUS parameter service 20 (only custom subservices available).
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "../ipc/MessageQueueSenderIF.h"
|
#include "../ipc/MessageQueueSenderIF.h"
|
||||||
#include "../objectmanager/ObjectManagerIF.h"
|
#include "../objectmanager/ObjectManagerIF.h"
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
|
|
||||||
ActionHelper::ActionHelper(HasActionsIF* setOwner,
|
ActionHelper::ActionHelper(HasActionsIF* setOwner,
|
||||||
MessageQueueIF* useThisQueue) :
|
MessageQueueIF* useThisQueue) :
|
||||||
@ -86,13 +87,20 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
|
|||||||
uint8_t *dataPtr;
|
uint8_t *dataPtr;
|
||||||
size_t maxSize = data->getSerializedSize();
|
size_t maxSize = data->getSerializedSize();
|
||||||
if (maxSize == 0) {
|
if (maxSize == 0) {
|
||||||
//No error, there's simply nothing to report.
|
/* No error, there's simply nothing to report. */
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize,
|
ReturnValue_t result = ipcStore->getFreeElement(&storeAddress, maxSize,
|
||||||
&dataPtr);
|
&dataPtr);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ActionHelper::reportData: Getting free element from IPC store failed!" <<
|
||||||
|
std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ActionHelper::reportData: Getting free element from IPC "
|
||||||
|
"store failed!\n");
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
result = data->serialize(&dataPtr, &size, maxSize,
|
result = data->serialize(&dataPtr, &size, maxSize,
|
||||||
@ -101,14 +109,13 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
|
|||||||
ipcStore->deleteData(storeAddress);
|
ipcStore->deleteData(storeAddress);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
// We don't need to report the objectId, as we receive REQUESTED data
|
|
||||||
// before the completion success message.
|
/* We don't need to report the objectId, as we receive REQUESTED data before the completion
|
||||||
// True aperiodic replies need to be reported with
|
success message. True aperiodic replies need to be reported with another dedicated message. */
|
||||||
// another dedicated message.
|
|
||||||
ActionMessage::setDataReply(&reply, replyId, storeAddress);
|
ActionMessage::setDataReply(&reply, replyId, storeAddress);
|
||||||
|
|
||||||
// If the sender needs to be hidden, for example to handle packet
|
/* If the sender needs to be hidden, for example to handle packet
|
||||||
// as unrequested reply, this will be done here.
|
as unrequested reply, this will be done here. */
|
||||||
if (hideSender) {
|
if (hideSender) {
|
||||||
result = MessageQueueSenderIF::sendMessage(reportTo, &reply);
|
result = MessageQueueSenderIF::sendMessage(reportTo, &reply);
|
||||||
}
|
}
|
||||||
@ -132,6 +139,11 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
|
|||||||
store_address_t storeAddress;
|
store_address_t storeAddress;
|
||||||
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
|
ReturnValue_t result = ipcStore->addData(&storeAddress, data, dataSize);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "ActionHelper::reportData: Adding data to IPC store failed!" << std::endl;
|
||||||
|
#else
|
||||||
|
sif::printWarning("ActionHelper::reportData: Adding data to IPC store failed!\n");
|
||||||
|
#endif
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,14 +152,12 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't need to report the objectId, as we receive REQUESTED data
|
/* We don't need to report the objectId, as we receive REQUESTED data before the completion
|
||||||
// before the completion success message.
|
success message. True aperiodic replies need to be reported with another dedicated message. */
|
||||||
// True aperiodic replies need to be reported with
|
|
||||||
// another dedicated message.
|
|
||||||
ActionMessage::setDataReply(&reply, replyId, storeAddress);
|
ActionMessage::setDataReply(&reply, replyId, storeAddress);
|
||||||
|
|
||||||
// If the sender needs to be hidden, for example to handle packet
|
/* If the sender needs to be hidden, for example to handle packet
|
||||||
// as unrequested reply, this will be done here.
|
as unrequested reply, this will be done here. */
|
||||||
if (hideSender) {
|
if (hideSender) {
|
||||||
result = MessageQueueSenderIF::sendMessage(reportTo, &reply);
|
result = MessageQueueSenderIF::sendMessage(reportTo, &reply);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
//! Increase of value of this per step
|
//! Increase of value of this per step
|
||||||
static const uint8_t STEP_OFFSET = 1;
|
static const uint8_t STEP_OFFSET = 1;
|
||||||
HasActionsIF* owner;//!< Pointer to the owner
|
//! Pointer to the owner
|
||||||
|
HasActionsIF* owner;
|
||||||
//! Queue to be used as response sender, has to be set in ctor or with
|
//! Queue to be used as response sender, has to be set in ctor or with
|
||||||
//! setQueueToUse
|
//! setQueueToUse
|
||||||
MessageQueueIF* queueToUse;
|
MessageQueueIF* queueToUse;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
target_sources(${LIB_FSFW_NAME}
|
target_sources(${LIB_FSFW_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
ActionHelper.cpp
|
ActionHelper.cpp
|
||||||
ActionMessage.cpp
|
ActionMessage.cpp
|
||||||
CommandActionHelper.cpp
|
CommandActionHelper.cpp
|
||||||
SimpleActionHelper.cpp
|
SimpleActionHelper.cpp
|
||||||
)
|
)
|
@ -1,5 +1,5 @@
|
|||||||
target_sources(${LIB_FSFW_NAME}
|
target_sources(${LIB_FSFW_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
SharedRingBuffer.cpp
|
SharedRingBuffer.cpp
|
||||||
SimpleRingBuffer.cpp
|
SimpleRingBuffer.cpp
|
||||||
)
|
)
|
@ -1,5 +1,6 @@
|
|||||||
#include "PoolDataSetBase.h"
|
#include "PoolDataSetBase.h"
|
||||||
#include "../serviceinterface/ServiceInterfaceStream.h"
|
#include "../serviceinterface/ServiceInterfaceStream.h"
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
PoolDataSetBase::PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
||||||
const size_t maxFillCount):
|
const size_t maxFillCount):
|
||||||
|
@ -39,8 +39,12 @@ public:
|
|||||||
* supply a pointer to this dataset to PoolVariable
|
* supply a pointer to this dataset to PoolVariable
|
||||||
* initializations to register pool variables.
|
* initializations to register pool variables.
|
||||||
*/
|
*/
|
||||||
PoolDataSetBase(PoolVariableIF** registeredVariablesArray,
|
PoolDataSetBase(PoolVariableIF** registeredVariablesArray, const size_t maxFillCount);
|
||||||
const size_t maxFillCount);
|
|
||||||
|
/* Forbidden for now */
|
||||||
|
PoolDataSetBase(const PoolDataSetBase& otherSet) = delete;
|
||||||
|
const PoolDataSetBase& operator=(const PoolDataSetBase& otherSet) = delete;
|
||||||
|
|
||||||
virtual~ PoolDataSetBase();
|
virtual~ PoolDataSetBase();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,8 +67,7 @@ public:
|
|||||||
* - @c SET_WAS_ALREADY_READ if read() is called twice without calling
|
* - @c SET_WAS_ALREADY_READ if read() is called twice without calling
|
||||||
* commit() in between
|
* commit() in between
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t read(
|
virtual ReturnValue_t read(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
|
||||||
uint32_t lockTimeout = 20) override;
|
uint32_t lockTimeout = 20) override;
|
||||||
/**
|
/**
|
||||||
* @brief The commit call initializes writing back the registered variables.
|
* @brief The commit call initializes writing back the registered variables.
|
||||||
@ -84,8 +87,7 @@ public:
|
|||||||
* - @c COMMITING_WITHOUT_READING if set was not read yet and
|
* - @c COMMITING_WITHOUT_READING if set was not read yet and
|
||||||
* contains non write-only variables
|
* contains non write-only variables
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t commit(
|
virtual ReturnValue_t commit(MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
||||||
MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING,
|
|
||||||
uint32_t lockTimeout = 20) override;
|
uint32_t lockTimeout = 20) override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,9 +67,19 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(
|
|||||||
|
|
||||||
|
|
||||||
LocalPoolDataSetBase::~LocalPoolDataSetBase() {
|
LocalPoolDataSetBase::~LocalPoolDataSetBase() {
|
||||||
|
/* We only delete objects which were created in the class constructor */
|
||||||
if(periodicHelper != nullptr) {
|
if(periodicHelper != nullptr) {
|
||||||
delete periodicHelper;
|
delete periodicHelper;
|
||||||
}
|
}
|
||||||
|
/* In case set was read but not comitted, we commit all variables with an invalid state */
|
||||||
|
if(state == States::STATE_SET_WAS_READ) {
|
||||||
|
for (uint16_t count = 0; count < fillCount; count++) {
|
||||||
|
if(registeredVariables[count] != nullptr) {
|
||||||
|
registeredVariables[count]->setValid(false);
|
||||||
|
registeredVariables[count]->commit(MutexIF::TimeoutType::WAITING, 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t LocalPoolDataSetBase::lockDataPool(
|
ReturnValue_t LocalPoolDataSetBase::lockDataPool(
|
||||||
|
@ -97,12 +97,18 @@ public:
|
|||||||
* @brief The destructor automatically manages writing the valid
|
* @brief The destructor automatically manages writing the valid
|
||||||
* information of variables.
|
* information of variables.
|
||||||
* @details
|
* @details
|
||||||
* In case the data set was read out, but not committed(indicated by state),
|
* In case the data set was read out, but not committed (indicated by state),
|
||||||
* the destructor parses all variables that are still registered to the set.
|
* the destructor parses all variables that are still registered to the set.
|
||||||
* For each, the valid flag in the data pool is set to "invalid".
|
* For each, the valid flag in the data pool is set to "invalid".
|
||||||
*/
|
*/
|
||||||
~LocalPoolDataSetBase();
|
~LocalPoolDataSetBase();
|
||||||
|
|
||||||
|
/* The copy constructor and assingment constructor are forbidden for now.
|
||||||
|
The use-cases are limited and the first step would be to implement them properly for the
|
||||||
|
base class */
|
||||||
|
LocalPoolDataSetBase(const LocalPoolDataSetBase& otherSet) = delete;
|
||||||
|
const LocalPoolDataSetBase& operator=(const LocalPoolDataSetBase& otherSet) = delete;
|
||||||
|
|
||||||
void setValidityBufferGeneration(bool withValidityBuffer);
|
void setValidityBufferGeneration(bool withValidityBuffer);
|
||||||
|
|
||||||
sid_t getSid() const;
|
sid_t getSid() const;
|
||||||
@ -153,6 +159,7 @@ public:
|
|||||||
bool hasChanged() const override;
|
bool hasChanged() const override;
|
||||||
|
|
||||||
object_id_t getCreatorObjectId();
|
object_id_t getCreatorObjectId();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
sid_t sid;
|
sid_t sid;
|
||||||
//! This mutex is used if the data is created by one object only.
|
//! This mutex is used if the data is created by one object only.
|
||||||
|
@ -20,12 +20,10 @@ class LocalPoolObjectBase: public PoolVariableIF,
|
|||||||
public HasReturnvaluesIF,
|
public HasReturnvaluesIF,
|
||||||
public MarkChangedIF {
|
public MarkChangedIF {
|
||||||
public:
|
public:
|
||||||
LocalPoolObjectBase(lp_id_t poolId,
|
LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
|
||||||
HasLocalDataPoolIF* hkOwner, DataSetIF* dataSet,
|
|
||||||
pool_rwm_t setReadWriteMode);
|
pool_rwm_t setReadWriteMode);
|
||||||
|
|
||||||
LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId,
|
LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId, DataSetIF* dataSet = nullptr,
|
||||||
DataSetIF* dataSet = nullptr,
|
|
||||||
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
pool_rwm_t setReadWriteMode = pool_rwm_t::VAR_READ_WRITE);
|
||||||
|
|
||||||
void setReadWriteMode(pool_rwm_t newReadWriteMode);
|
void setReadWriteMode(pool_rwm_t newReadWriteMode);
|
||||||
|
Loading…
Reference in New Issue
Block a user