-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTaskModelNotifier.hpp
More file actions
62 lines (51 loc) · 1.23 KB
/
TaskModelNotifier.hpp
File metadata and controls
62 lines (51 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include <QObject>
#include <map>
#include <vector>
#include <unistd.h>
namespace RTT
{
namespace corba
{
class TaskContextProxy;
}
}
namespace orocos_cpp
{
class NameService;
}
class TaskModelNotifier : public QObject
{
Q_OBJECT
std::map<std::string, RTT::corba::TaskContextProxy *> nameToRegisteredTask;
std::vector<std::string > disconnectedTasks;
orocos_cpp::NameService *nameService;
bool isRunning;
void queryTasks();
int connect_trials;
const int max_connect_trials = 10;
int numTasks;
public:
explicit TaskModelNotifier(QObject* parent = 0);
signals:
void updateTask(RTT::corba::TaskContextProxy* task, const std::string &taskName, bool reconnect);
void finished();
void updateNameServiceStatus(const std::string &status);
void updateTasksStatus(const std::string &status);
public slots:
void stopNotifier();
void initializeNameService(const std::string &nameServiceIP);
orocos_cpp::NameService *getNameService()
{
return nameService;
}
void run()
{
isRunning = true;
while (isRunning)
{
queryTasks();
usleep(1000); //FIXME usleep...
}
emit finished();
}
};