exec task if new init function, some corrections

This commit is contained in:
Robin Müller 2020-06-29 15:44:18 +02:00
parent ba5b8bd682
commit b81b458ba6
6 changed files with 18 additions and 9 deletions

View File

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

View File

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

View File

@ -36,7 +36,7 @@ public:
private:
//! External instantiation is forbidden.
QueueMapManager();
std::atomic<uint32_t> queueCounter = MessageQueueIF::NO_QUEUE + 1;
std::atomic<uint32_t> queueCounter = 1;
MutexIF* mapLock;
QueueMap queueMap;
static QueueMapManager* mqManagerInstance;

View File

@ -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_ */

View File

@ -9,6 +9,7 @@ FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime,
if(executingTask != nullptr) {
handler->setTaskIF(executingTask);
}
//handler->initializeAfterTaskCreation();
}
FixedSequenceSlot::~FixedSequenceSlot() {}

View File

@ -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<Command_t*>(&failureParameter1));
result = reply->getReplyRejectedReason();
failureParameter1 = iter->command;
}
switch (result) {