The plugin timer class for plugins. More...
Header: | #include <PluginTimer> |
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.
[pure virtual]
void PluginTimer::pause()Pauses the timer.
See also running().
[pure virtual]
void PluginTimer::resume()Resumes the timer. If the timer was not on paused, this method has no effect.
See also pause().
[pure virtual]
void PluginTimer::start()Starts the timer.
See also running() and runningChanged().
[pure virtual]
void PluginTimer::stop()Stops the timer.
See also running() and runningChanged().