QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
ScheduledTask.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QPointer>
4
5#include <memory>
6
7#include "RuntimeScheduler.h"
8
12{
13public:
14 ScheduledTask(RuntimeScheduler* scheduler, QObject* context);
16
17 Q_DISABLE_COPY_MOVE(ScheduledTask)
18
19 bool schedule(std::chrono::microseconds delay, RuntimeScheduler::Callback callback);
22 bool scheduleRepeating(std::chrono::microseconds interval, RuntimeScheduler::Callback callback);
23 void cancel();
24 bool active() const;
25
26private:
27 struct State
28 {
30 quint64 generation = 0;
31 };
32
33 QPointer<RuntimeScheduler> _scheduler;
34 QPointer<QObject> _context;
35 std::shared_ptr<State> _state;
36};
std::function< void()> Callback
bool scheduleRepeating(std::chrono::microseconds interval, RuntimeScheduler::Callback callback)
bool schedule(std::chrono::microseconds delay, RuntimeScheduler::Callback callback)
bool active() const