From b81b458ba6cc5c6819b9dae6045e25469a1d43cc Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 15:44:18 +0200 Subject: [PATCH 01/11] exec task if new init function, some corrections --- ipc/CommandMessage.cpp | 5 ++--- osal/host/FixedTimeslotTask.cpp | 2 +- osal/host/QueueMapManager.h | 2 +- tasks/ExecutableObjectIF.h | 13 +++++++++++-- tasks/FixedSequenceSlot.cpp | 1 + tmtcservices/CommandingServiceBase.cpp | 4 ++-- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ipc/CommandMessage.cpp b/ipc/CommandMessage.cpp index e1d4dfae1..0aeaa79af 100644 --- a/ipc/CommandMessage.cpp +++ b/ipc/CommandMessage.cpp @@ -84,9 +84,8 @@ void CommandMessage::setToUnknownCommand() { void CommandMessage::setReplyRejected(ReturnValue_t reason, Command_t initialCommand) { - std::memcpy(getData(), &reason, sizeof(reason)); - std::memcpy(getData() + sizeof(reason), &initialCommand, - sizeof(initialCommand)); + setParameter(reason); + setParameter2(initialCommand); } ReturnValue_t CommandMessage::getReplyRejectedReason( diff --git a/osal/host/FixedTimeslotTask.cpp b/osal/host/FixedTimeslotTask.cpp index 48d11843f..dac399f6b 100644 --- a/osal/host/FixedTimeslotTask.cpp +++ b/osal/host/FixedTimeslotTask.cpp @@ -92,7 +92,7 @@ ReturnValue_t FixedTimeslotTask::sleepFor(uint32_t ms) { void FixedTimeslotTask::taskFunctionality() { // A local iterator for the Polling Sequence Table is created to // find the start time for the first entry. - SlotListIter slotListIter = pollingSeqTable.current; + FixedSlotSequence::SlotListIter slotListIter = pollingSeqTable.current; // Get start time for first entry. chron_ms interval(slotListIter->pollingTimeMs); auto currentStartTime { diff --git a/osal/host/QueueMapManager.h b/osal/host/QueueMapManager.h index 34f0fc957..499b1622a 100644 --- a/osal/host/QueueMapManager.h +++ b/osal/host/QueueMapManager.h @@ -36,7 +36,7 @@ public: private: //! External instantiation is forbidden. QueueMapManager(); - std::atomic queueCounter = MessageQueueIF::NO_QUEUE + 1; + std::atomic queueCounter = 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; diff --git a/tasks/ExecutableObjectIF.h b/tasks/ExecutableObjectIF.h index 516b4084b..f66b53dab 100644 --- a/tasks/ExecutableObjectIF.h +++ b/tasks/ExecutableObjectIF.h @@ -43,9 +43,18 @@ public: * a reference to the executing task * @param task_ Pointer to the taskIF of this task */ - virtual void setTaskIF(PeriodicTaskIF* task_) { + virtual void setTaskIF(PeriodicTaskIF* task_) {}; - } + /** + * This function will be called after the object was assigned to a specific + * task. + * + * Example: Can be used to get task execution frequency. + * The task is created after initialize() and the object ctors have been + * called so the execution frequency can't be cached in initialize() + * @return + */ + //virtual ReturnValue_t initializeAfterTaskCreation() = 0; }; #endif /* EXECUTABLEOBJECTIF_H_ */ diff --git a/tasks/FixedSequenceSlot.cpp b/tasks/FixedSequenceSlot.cpp index c46b4fc00..430ce0199 100644 --- a/tasks/FixedSequenceSlot.cpp +++ b/tasks/FixedSequenceSlot.cpp @@ -9,6 +9,7 @@ FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime, if(executingTask != nullptr) { handler->setTaskIF(executingTask); } + //handler->initializeAfterTaskCreation(); } FixedSequenceSlot::~FixedSequenceSlot() {} diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index acf663893..5a48bd63a 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -109,8 +109,8 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) { * command as failure parameter 1 */ if(reply->getCommand() == CommandMessage::REPLY_REJECTED and result == RETURN_FAILED) { - result = reply->getReplyRejectedReason( - reinterpret_cast(&failureParameter1)); + result = reply->getReplyRejectedReason(); + failureParameter1 = iter->command; } switch (result) { From d5d968a39365b2b0c285d8f283a054050e94be3b Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 15:46:16 +0200 Subject: [PATCH 02/11] some more correctioons --- datapoollocal/LocalDataPoolManager.cpp | 24 ++++++++++++------------ ipc/CommandMessage.cpp | 6 ++---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index bc57468a0..55d36a9a9 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -105,18 +105,18 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid) { } // and now we set a HK message and send it the HK packet destination. - //HousekeepingMessage hkMessage; -// hkMessage.setHkReportMessage(sid, storeId); -// if(hkQueue == nullptr) { -// return QUEUE_NOT_SET; -// } -// -// if(currentHkPacketDestination != MessageQueueIF::NO_QUEUE) { -// result = hkQueue->sendMessage(currentHkPacketDestination, &hkMessage); -// } -// else { -// result = hkQueue->sendToDefault(&hkMessage); -// } + CommandMessage hkMessage; + HousekeepingMessage::setHkReportMessage(&hkMessage, sid, storeId); + if(hkQueue == nullptr) { + return QUEUE_NOT_SET; + } + + if(currentHkPacketDestination != MessageQueueIF::NO_QUEUE) { + result = hkQueue->sendMessage(currentHkPacketDestination, &hkMessage); + } + else { + result = hkQueue->sendToDefault(&hkMessage); + } return result; } diff --git a/ipc/CommandMessage.cpp b/ipc/CommandMessage.cpp index 0aeaa79af..1470fe85f 100644 --- a/ipc/CommandMessage.cpp +++ b/ipc/CommandMessage.cpp @@ -90,11 +90,9 @@ void CommandMessage::setReplyRejected(ReturnValue_t reason, ReturnValue_t CommandMessage::getReplyRejectedReason( Command_t *initialCommand) const { - ReturnValue_t reason = HasReturnvaluesIF::RETURN_FAILED; - std::memcpy(&reason, getData(), sizeof(reason)); + ReturnValue_t reason = getParameter(); if(initialCommand != nullptr) { - std::memcpy(initialCommand, getData() + sizeof(reason), - sizeof(Command_t)); + *initialCommand = getParameter2(); } return reason; } From 003e70bf4785a8b9e57a8f8ab5f67ae0b0dfade3 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 15:55:20 +0200 Subject: [PATCH 03/11] new initializeAfterTaskCreation() --- osal/FreeRTOS/PeriodicTask.cpp | 3 ++- osal/linux/PeriodicPosixTask.cpp | 4 +++- osal/rtems/MultiObjectTask.cpp | 3 ++- tasks/ExecutableObjectIF.h | 25 +++++++++---------------- tasks/FixedSequenceSlot.cpp | 2 +- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/osal/FreeRTOS/PeriodicTask.cpp b/osal/FreeRTOS/PeriodicTask.cpp index 170eb0a48..2ebfebf40 100644 --- a/osal/FreeRTOS/PeriodicTask.cpp +++ b/osal/FreeRTOS/PeriodicTask.cpp @@ -94,7 +94,8 @@ ReturnValue_t PeriodicTask::addComponent(object_id_t object, bool setTaskIF) { if(setTaskIF) { newObject->setTaskIF(this); } - return HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result = newObject->initializeAfterTaskCreation(); + return result; } uint32_t PeriodicTask::getPeriodMs() const { diff --git a/osal/linux/PeriodicPosixTask.cpp b/osal/linux/PeriodicPosixTask.cpp index db4005b04..b811274b6 100644 --- a/osal/linux/PeriodicPosixTask.cpp +++ b/osal/linux/PeriodicPosixTask.cpp @@ -36,7 +36,9 @@ ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object, if(setTaskIF) { newObject->setTaskIF(this); } - return HasReturnvaluesIF::RETURN_OK; + + ReturnValue_t result = newObject->initializeAfterTaskCreation(); + return result; } ReturnValue_t PeriodicPosixTask::sleepFor(uint32_t ms) { diff --git a/osal/rtems/MultiObjectTask.cpp b/osal/rtems/MultiObjectTask.cpp index bb8c2c817..6b9c8c8ea 100644 --- a/osal/rtems/MultiObjectTask.cpp +++ b/osal/rtems/MultiObjectTask.cpp @@ -78,7 +78,8 @@ ReturnValue_t MultiObjectTask::addComponent(object_id_t object) { return HasReturnvaluesIF::RETURN_FAILED; } objectList.push_back(newObject); - return HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result = newObject->initializeAfterTaskCreation(); + return result; } uint32_t MultiObjectTask::getPeriodMs() const { diff --git a/tasks/ExecutableObjectIF.h b/tasks/ExecutableObjectIF.h index f66b53dab..d716cdfbb 100644 --- a/tasks/ExecutableObjectIF.h +++ b/tasks/ExecutableObjectIF.h @@ -1,15 +1,5 @@ -/** - * @file ExecutableObjectIF.h - * - * @brief This file contains the definition for the ExecutableObjectIF interface. - * - * @author Bastian Baetz - * - * @date 12.03.2012 - */ - -#ifndef EXECUTABLEOBJECTIF_H_ -#define EXECUTABLEOBJECTIF_H_ +#ifndef FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_ +#define FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_ class PeriodicTaskIF; @@ -20,6 +10,7 @@ class PeriodicTaskIF; * @brief The interface provides a method to execute objects within a task. * @details The performOperation method, that is required by the interface is * executed cyclically within a task context. + * @author Bastian Baetz */ class ExecutableObjectIF { public: @@ -46,15 +37,17 @@ public: virtual void setTaskIF(PeriodicTaskIF* task_) {}; /** - * This function will be called after the object was assigned to a specific - * task. + * This function should be called after the object was assigned to a + * specific task. * * Example: Can be used to get task execution frequency. * The task is created after initialize() and the object ctors have been * called so the execution frequency can't be cached in initialize() * @return */ - //virtual ReturnValue_t initializeAfterTaskCreation() = 0; + virtual ReturnValue_t initializeAfterTaskCreation() { + return HasReturnvaluesIF::RETURN_OK; + } }; -#endif /* EXECUTABLEOBJECTIF_H_ */ +#endif /* FRAMEWORK_TASKS_EXECUTABLEOBJECTIF_H_ */ diff --git a/tasks/FixedSequenceSlot.cpp b/tasks/FixedSequenceSlot.cpp index 430ce0199..4331aadab 100644 --- a/tasks/FixedSequenceSlot.cpp +++ b/tasks/FixedSequenceSlot.cpp @@ -9,7 +9,7 @@ FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime, if(executingTask != nullptr) { handler->setTaskIF(executingTask); } - //handler->initializeAfterTaskCreation(); + handler->initializeAfterTaskCreation(); } FixedSequenceSlot::~FixedSequenceSlot() {} From ae6314d8cd43a0ad8f0c1a7b9bd567be378203d3 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 16:06:53 +0200 Subject: [PATCH 04/11] added task handle member --- tmtcservices/PusServiceBase.cpp | 11 +++++++++++ tmtcservices/PusServiceBase.h | 17 +++++++++++++---- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tmtcservices/PusServiceBase.cpp b/tmtcservices/PusServiceBase.cpp index f5d1e30bd..82e5ff5cc 100644 --- a/tmtcservices/PusServiceBase.cpp +++ b/tmtcservices/PusServiceBase.cpp @@ -32,6 +32,10 @@ ReturnValue_t PusServiceBase::performOperation(uint8_t opCode) { return RETURN_OK; } +void PusServiceBase::setTaskIF(PeriodicTaskIF* taskHandle) { + this->taskHandle = taskHandle; +} + void PusServiceBase::handleRequestQueue() { TmTcMessage message; ReturnValue_t result = RETURN_FAILED; @@ -108,3 +112,10 @@ ReturnValue_t PusServiceBase::initialize() { return RETURN_FAILED; } } + +ReturnValue_t PusServiceBase::initializeAfterTaskCreation() { + // If task parameters, for example task frequency are required, this + // function should be overriden and the system object task IF can + // be used to get those parameters. + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/tmtcservices/PusServiceBase.h b/tmtcservices/PusServiceBase.h index 39600c413..6d3d9bac6 100644 --- a/tmtcservices/PusServiceBase.h +++ b/tmtcservices/PusServiceBase.h @@ -96,11 +96,20 @@ public: * @return @c RETURN_OK if the periodic performService was successful. * @c RETURN_FAILED else. */ - ReturnValue_t performOperation(uint8_t opCode); - virtual uint16_t getIdentifier(); - MessageQueueId_t getRequestQueue(); - virtual ReturnValue_t initialize(); + ReturnValue_t performOperation(uint8_t opCode) override; + virtual uint16_t getIdentifier() override; + MessageQueueId_t getRequestQueue() override; + virtual ReturnValue_t initialize() override; + + virtual void setTaskIF(PeriodicTaskIF* taskHandle) override; + virtual ReturnValue_t initializeAfterTaskCreation() override; protected: + /** + * @brief Handle to the underlying task + * @details + * Will be set by setTaskIF(), which is called on task creation. + */ + PeriodicTaskIF* taskHandle = nullptr; /** * The APID of this instance of the Service. */ From 044aa259e6298bf8accff8c8ab53cd373ed186bc Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 16:37:55 +0200 Subject: [PATCH 05/11] dhb cached pst interval now --- devicehandlers/DeviceHandlerBase.cpp | 9 +++++++++ devicehandlers/DeviceHandlerBase.h | 11 +++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 0442be89b..3994dc125 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1374,6 +1374,15 @@ ReturnValue_t DeviceHandlerBase::changeCollectionInterval(sid_t sid, return HasReturnvaluesIF::RETURN_OK; } +ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() { + // In this function, the task handle should be valid in any case. + // We still check to be 1000 % sure :-) + if(executingTask != nullptr) { + pstIntervalMs = executingTask->getPeriodMs(); + } + return HasReturnvaluesIF::RETURN_OK; +} + DataSetIF* DeviceHandlerBase::getDataSetHandle(sid_t sid) { auto iter = deviceReplyMap.find(sid.ownerSetId); if(iter != deviceReplyMap.end()) { diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 1290742c3..b2b4798d6 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -11,6 +11,8 @@ #include #include #include +#include + #include #include #include @@ -18,6 +20,7 @@ #include #include #include + #include namespace Factory{ @@ -563,6 +566,8 @@ protected: /** This is the counter value from performOperation(). */ uint8_t pstStep = 0; + uint32_t pstIntervalMs = 0; + /** * Wiretapping flag: * @@ -1196,9 +1201,11 @@ private: ReturnValue_t handleDeviceHandlerMessage(CommandMessage *message); - void parseReply(const uint8_t* receivedData, - size_t receivedDataLen); + virtual ReturnValue_t initializeAfterTaskCreation() override; DataSetIF* getDataSetHandle(sid_t sid) override; + + void parseReply(const uint8_t* receivedData, + size_t receivedDataLen); }; #endif /* DEVICEHANDLERBASE_H_ */ From 691be0dcd4f6c8586b4a29b866bc7d9808d345c5 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 16:39:55 +0200 Subject: [PATCH 06/11] dhb doc improvements --- devicehandlers/DeviceHandlerBase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 3994dc125..cebe89531 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1375,8 +1375,8 @@ ReturnValue_t DeviceHandlerBase::changeCollectionInterval(sid_t sid, } ReturnValue_t DeviceHandlerBase::initializeAfterTaskCreation() { - // In this function, the task handle should be valid in any case. - // We still check to be 1000 % sure :-) + // In this function, the task handle should be valid if the task + // was implemented correctly. We still check to be 1000 % sure :-) if(executingTask != nullptr) { pstIntervalMs = executingTask->getPeriodMs(); } From 48df3cbe8382423b671d7b5d651e3b623f4e2d90 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 16:43:02 +0200 Subject: [PATCH 07/11] csb comment improved --- tmtcservices/CommandingServiceBase.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tmtcservices/CommandingServiceBase.h b/tmtcservices/CommandingServiceBase.h index 8806bd52b..37fa0a040 100644 --- a/tmtcservices/CommandingServiceBase.h +++ b/tmtcservices/CommandingServiceBase.h @@ -276,7 +276,6 @@ protected: void checkAndExecuteFifo(CommandMapIter iter); private: - /** * This method handles internal execution of a command, * once it has been started by @sa{startExecution()} in the request @@ -296,10 +295,13 @@ private: void handleCommandQueue(); /** + * @brief Handler function for request queue + * @details * Sequence of request queue handling: * isValidSubservice -> getMessageQueueAndObject -> startExecution - * Generates Start Success Reports TM[1,3] in subfunction @sa{startExecution()} - * or Start Failure Report TM[1,4] by using the TC Verification Service + * Generates a Start Success Reports TM[1,3] in subfunction + * @sa{startExecution()} or a Start Failure Report TM[1,4] by using the + * TC Verification Service. */ void handleRequestQueue(); From e2a36efce3d210c85c1ba924cd627a43b1cac922 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 16:47:58 +0200 Subject: [PATCH 08/11] csb changes taken over --- tmtcservices/CommandingServiceBase.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index 5a48bd63a..f8af15af6 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -57,7 +57,9 @@ ReturnValue_t CommandingServiceBase::initialize() { PUSDistributorIF* distributor = objectManager->get( packetSource); if (packetForwarding == nullptr or distributor == nullptr) { - return RETURN_FAILED; + sif::error << "CommandingServiceBase::intialize: Packet source or " + "packet destination invalid!" << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; } distributor->registerService(this); @@ -68,7 +70,9 @@ ReturnValue_t CommandingServiceBase::initialize() { TCStore = objectManager->get(objects::TC_STORE); if (IPCStore == nullptr or TCStore == nullptr) { - return RETURN_FAILED; + sif::error << "CommandingServiceBase::intialize: IPC store or TC store " + "not initialized yet!" << std::endl; + return ObjectManagerIF::CHILD_INIT_FAILED; } return RETURN_OK; @@ -109,8 +113,8 @@ void CommandingServiceBase::handleCommandMessage(CommandMessage* reply) { * command as failure parameter 1 */ if(reply->getCommand() == CommandMessage::REPLY_REJECTED and result == RETURN_FAILED) { - result = reply->getReplyRejectedReason(); - failureParameter1 = iter->command; + result = reply->getReplyRejectedReason(); + failureParameter1 = iter->command; } switch (result) { @@ -176,14 +180,14 @@ void CommandingServiceBase::handleReplyHandlerResult(ReturnValue_t result, } else { if (isStep) { - nextCommand->clear(); + nextCommand->clearCommandMessage(); verificationReporter.sendFailureReport( TC_VERIFY::PROGRESS_FAILURE, iter->tcInfo.ackFlags, iter->tcInfo.tcPacketId, iter->tcInfo.tcSequenceControl, sendResult, ++iter->step, failureParameter1, failureParameter2); } else { - nextCommand->clear(); + nextCommand->clearCommandMessage(); verificationReporter.sendFailureReport( TC_VERIFY::COMPLETION_FAILURE, iter->tcInfo.ackFlags, iter->tcInfo.tcPacketId, @@ -318,7 +322,7 @@ void CommandingServiceBase::startExecution(TcPacketStored *storedPacket, storedPacket->getPacketSequenceControl(); acceptPacket(TC_VERIFY::START_SUCCESS, storedPacket); } else { - command.clear(); + command.clearCommandMessage(); rejectPacket(TC_VERIFY::START_FAILURE, storedPacket, sendResult); checkAndExecuteFifo(iter); } @@ -335,7 +339,7 @@ void CommandingServiceBase::startExecution(TcPacketStored *storedPacket, acceptPacket(TC_VERIFY::COMPLETION_SUCCESS, storedPacket); checkAndExecuteFifo(iter); } else { - command.clear(); + command.clearCommandMessage(); rejectPacket(TC_VERIFY::START_FAILURE, storedPacket, sendResult); checkAndExecuteFifo(iter); } @@ -374,7 +378,7 @@ void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter iter) { void CommandingServiceBase::handleUnrequestedReply(CommandMessage* reply) { - reply->clear(); + reply->clearCommandMessage(); } From 85cc936d5da669f8f74ea02c87a8204f4a6235c4 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 29 Jun 2020 16:50:45 +0200 Subject: [PATCH 09/11] added back clear CommandMessage function --- ipc/CommandMessage.cpp | 4 ++++ ipc/CommandMessage.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ipc/CommandMessage.cpp b/ipc/CommandMessage.cpp index 1470fe85f..8c296abdd 100644 --- a/ipc/CommandMessage.cpp +++ b/ipc/CommandMessage.cpp @@ -68,6 +68,10 @@ size_t CommandMessage::getMinimumMessageSize() const { return MINIMUM_COMMAND_MESSAGE_SIZE; } +void CommandMessage::clearCommandMessage() { + clear(); +} + void CommandMessage::clear() { CommandMessageCleaner::clearCommandMessage(this); } diff --git a/ipc/CommandMessage.h b/ipc/CommandMessage.h index 021fa49ab..d843e4c54 100644 --- a/ipc/CommandMessage.h +++ b/ipc/CommandMessage.h @@ -111,7 +111,9 @@ public: ReturnValue_t getReplyRejectedReason( Command_t* initialCommand = nullptr) const override; + virtual void clear() override; + void clearCommandMessage(); /** * Extract message ID, which is the first byte of the command ID for the From 3a850018550b319476a4ec8b68bd75b035909df2 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 30 Jun 2020 00:48:48 +0200 Subject: [PATCH 10/11] bit setter correction --- datapoollocal/LocalDataSet.cpp | 7 +++---- datapoollocal/LocalDataSet.h | 10 +++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/datapoollocal/LocalDataSet.cpp b/datapoollocal/LocalDataSet.cpp index 27ad4bc2a..3fc8592e9 100644 --- a/datapoollocal/LocalDataSet.cpp +++ b/datapoollocal/LocalDataSet.cpp @@ -42,7 +42,7 @@ ReturnValue_t LocalDataSet::serializeWithValidityBuffer(uint8_t **buffer, if(registeredVariables[count]->isValid()) { // set validity buffer here. this->bitSetter(validityMask + validBufferIndex, - validBufferIndexBit, true); + validBufferIndexBit); if(validBufferIndexBit == 7) { validBufferIndex ++; validBufferIndexBit = 0; @@ -83,13 +83,12 @@ ReturnValue_t LocalDataSet::serializeLocalPoolIds(uint8_t** buffer, return HasReturnvaluesIF::RETURN_OK; } -void LocalDataSet::bitSetter(uint8_t* byte, uint8_t position, - bool value) const { +void LocalDataSet::bitSetter(uint8_t* byte, uint8_t position) const { if(position > 7) { sif::debug << "Pool Raw Access: Bit setting invalid position" << std::endl; return; } uint8_t shiftNumber = position + (7 - 2 * position); - *byte |= 1UL << shiftNumber; + *byte |= 1 << shiftNumber; } diff --git a/datapoollocal/LocalDataSet.h b/datapoollocal/LocalDataSet.h index 48138e631..aea699d85 100644 --- a/datapoollocal/LocalDataSet.h +++ b/datapoollocal/LocalDataSet.h @@ -98,14 +98,10 @@ private: LocalDataPoolManager* hkManager; /** - * Sets the bit at the bit-position of a byte provided by its address - * to the specified value (zero or one). - * @param byte Pointer to byte to bitset. - * @param position MSB first, 0 to 7 possible. - * @param value Value to set. - * @return + * Set n-th bit of a byte, with n being the position from 0 + * (most significant bit) to 7 (least significant bit) */ - void bitSetter(uint8_t* byte, uint8_t position, bool value) const; + void bitSetter(uint8_t* byte, uint8_t position) const; }; #endif /* FRAMEWORK_DATAPOOLLOCAL_LOCALDATASET_H_ */ From 1820b5f95c4e3d03c06cd7c0ee9b2fa6639adac9 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 30 Jun 2020 16:02:07 +0200 Subject: [PATCH 11/11] hotfix for copy ctor --- storagemanager/ConstStorageAccessor.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storagemanager/ConstStorageAccessor.h b/storagemanager/ConstStorageAccessor.h index cf8ca08fe..020030a9e 100644 --- a/storagemanager/ConstStorageAccessor.h +++ b/storagemanager/ConstStorageAccessor.h @@ -80,13 +80,13 @@ public: * @return */ ConstStorageAccessor& operator= (ConstStorageAccessor&&); - ConstStorageAccessor (ConstStorageAccessor&&); + ConstStorageAccessor(ConstStorageAccessor&&); //! The copy ctor and copy assignemnt should be deleted implicitely //! according to https://foonathan.net/2019/02/special-member-functions/ //! but I still deleted them to make it more explicit. (remember rule of 5). - ConstStorageAccessor& operator= (ConstStorageAccessor&) = delete; - ConstStorageAccessor (ConstStorageAccessor&) = delete; + ConstStorageAccessor& operator=(const ConstStorageAccessor&) = delete; + ConstStorageAccessor(const ConstStorageAccessor&) = delete; protected: const uint8_t* constDataPointer = nullptr; store_address_t storeId;