diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 0442be89..3994dc12 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 1290742c..b2b4798d 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_ */