Class CTaskTimerService#

Inheritance Relationships#

Base Types#

Class Documentation#

class CTaskTimerService : public sdv::CSdvObject, public sdv::IObjectControl, public sdv::core::ITaskTimer#

Task timer class to execute task periodically.

Public Functions

CTaskTimerService()#

Constructor configure and initializes the timer.

virtual ~CTaskTimerService() override#

Destructor cleans up the timer if there is no active task and delete it after.

virtual void Initialize(const sdv::u8string &ssObjectConfig) override#

Initialize the object. Overload of sdv::IObjectControl::Initialize.

Parameters:

ssObjectConfig[in] Optional configuration string.

virtual sdv::EObjectStatus GetStatus() const override#

Get the current status of the object. Overload of sdv::IObjectControl::GetStatus.

Returns:

Return the current status of the object.

virtual void SetOperationMode(sdv::EOperationMode eMode) override#

Set the component operation mode. Overload of sdv::IObjectControl::SetOperationMode.

Parameters:

eMode[in] The operation mode, the component should run in.

virtual void Shutdown() override#

Shutdown called before the object is destroyed. Overload of sdv::IObjectControl::Shutdown.

Attention

Implement calls to other SDV objects here as this is no longer considered safe during the destructor of the object! After a call to shutdown any threads/callbacks/etc that could call other SDV objects need to have been stopped. The SDV object itself is to remain in a state where it can respond to calls to its interfaces as other objects may still call it during the shutdown sequence! Any subsequent call to GetStatus should return EObjectStatus::destruction_pending

virtual sdv::IInterfaceAccess *CreateTimer(uint32_t uiPeriod, sdv::IInterfaceAccess *pTask) override#

Method to execute the user-defined task periodically until ShutdownTask is called.

Parameters:
  • uiPeriod[in] The time period in milliseconds in which the task should executed.

  • pTask[in] Interface to the task object exposing the ITaskExecute interface. The object must be kept alive until the timer has been destroyed.

Returns:

Returns an interface to the task timer object. Use sdv::IObjectDestroy to terminate the timer.

void RemoveTimer(CTimer *pTimer)#

Remove the timer from from the timer map.

Parameters:

pTimer[in] Pointer to the timer object to remove.