Merge branch 'development' of https://egit.irs.uni-stuttgart.de/eive/fsfw into development

This commit is contained in:
Jakob Meier 2021-03-04 19:14:12 +01:00
commit 41e30dcb6c
8 changed files with 61 additions and 47 deletions

View File

@ -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).

View File

@ -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);
} }

View File

@ -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;

View File

@ -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
) )

View File

@ -1,5 +1,5 @@
target_sources(${LIB_FSFW_NAME} target_sources(${LIB_FSFW_NAME}
PRIVATE PRIVATE
SharedRingBuffer.cpp SharedRingBuffer.cpp
SimpleRingBuffer.cpp SimpleRingBuffer.cpp
) )

View File

@ -229,20 +229,3 @@ void PoolDataSetBase::setReadCommitProtectionBehaviour(
this->timeoutTypeForSingleVars = timeoutType; this->timeoutTypeForSingleVars = timeoutType;
this->mutexTimeoutForSingleVars = mutexTimeout; this->mutexTimeoutForSingleVars = mutexTimeout;
} }
/* We really should supply the container as a template argument instead of writing sth like this */
//PoolDataSetBase::PoolDataSetBase(const PoolDataSetBase &otherSet):
// fillCount(otherSet.fillCount), state(otherSet.state),
// maxFillCount(otherSet.maxFillCount),
// protectEveryReadCommitCall(otherSet.protectEveryReadCommitCall),
// timeoutTypeForSingleVars(otherSet.timeoutTypeForSingleVars),
// mutexTimeoutForSingleVars(otherSet.mutexTimeoutForSingleVars) {
// if(registeredVariables != nullptr and otherSet.registeredVariables != nullptr) {
// std::memcpy(reinterpret_cast<void*>(*(this->registeredVariables)),
// reinterpret_cast<const void*>(*(otherSet.registeredVariables)),
// fillCount * sizeof(PoolVariableIF*));
// }
//}
//
//const PoolDataSetBase& PoolDataSetBase::operator=(const PoolDataSetBase &otherSet) {
//}

View File

@ -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);

View File

@ -7,6 +7,7 @@
#include "../ipc/QueueFactory.h" #include "../ipc/QueueFactory.h"
#include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcpacket/pus/TcPacketStored.h"
#include "../tmtcpacket/pus/TmPacketStored.h" #include "../tmtcpacket/pus/TmPacketStored.h"
#include "../serviceinterface/ServiceInterface.h"
object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT;
object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT; object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT;
@ -104,9 +105,27 @@ ReturnValue_t CommandingServiceBase::initialize() {
void CommandingServiceBase::handleCommandQueue() { void CommandingServiceBase::handleCommandQueue() {
CommandMessage reply; CommandMessage reply;
ReturnValue_t result = RETURN_FAILED; ReturnValue_t result = RETURN_FAILED;
for (result = commandQueue->receiveMessage(&reply); result == RETURN_OK; while(true) {
result = commandQueue->receiveMessage(&reply)) { result = commandQueue->receiveMessage(&reply);
handleCommandMessage(&reply); if (result == HasReturnvaluesIF::RETURN_OK) {
handleCommandMessage(&reply);
continue;
}
else if(result == MessageQueueIF::EMPTY) {
break;
}
else {
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::warning << "CommandingServiceBase::handleCommandQueue: Receiving message failed"
"with code" << result << std::endl;
#else
sif::printWarning("CommandingServiceBase::handleCommandQueue: Receiving message "
"failed with code %d\n", result);
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
#endif /* FSFW_VERBOSE_LEVEL >= 1 */
break;
}
} }
} }