The plugin timer class for plugins. More...
Header: | #include <PluginTimer> |
The plugin timer class for plugins.
The plugin timer allows to trigger repeating actions in a device plugin. This timer does not represent a precise timer should be used for not time critical things. The PluginTimerManager will schedule the requested timer as needed and trigger the timeout() method.
\chapter
Example
In order to do something repeatedly in a DevicePlugin you can register a new PluginTimer like this:
devicepluginexample.h
#include "plugintimer.h" class DevicePluginExample : public DevicePlugin { ... public: void init() override; private: PluginTimer *m_pluginTimer = nullptr; private slots: void onPluginTimerTimeout(); ... };
devicepluginexample.cpp
void DevicePluginExample::init() { m_pluginTimer = hardwareManager()->pluginTimerManager()->registerTimer(10); connect(m_pluginTimer, &PluginTimer::timeout, this, &DevicePluginExample::onPluginTimerTimeout); } DevicePluginExample::~DevicePluginExample() { hardwareManager()->pluginTimerManager()->unregisterTimer(m_pluginTimer); }
See also PluginTimerManager.