blob: 6924fdcc6b1ef97ed110872ee847f2c22f3abc0c (
plain)
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
63
64
65
66
67
68
69
70
71
72
73
74
|
#ifndef _DBUS_THREAD_
#define _DBUS_THREAD_
#include <QList>
#include <QtDBus/QtDBus>
#include <QtCore/QObject>
#include <QtCore/QCoreApplication>
#include <dbus/dbus.h>
typedef QList<QThread*> Threads;
typedef QList<QObject*> Servers;
class Maintainer : public QObject
{
Q_OBJECT
public:
Maintainer(Threads* t);
~Maintainer();
protected:
void timerEvent(QTimerEvent *e);
int timerID;
Threads* threads;
bool allOnline;
};
class DbusSpammer : public QThread
{
public:
DbusSpammer(int id, QString service, int messageLen);
~DbusSpammer();
void run();
DBusConnection* myBus;
DBusMessage* myMessage;
bool firstTime;
bool exitThread;
int threadID;
const char* pszSpamData;
QString spamData;
QString serviceName;
protected:
void timerEvent(QTimerEvent *e);
int timerID;
};
class DbusServer: public QThread
{
Q_OBJECT
public:
DbusServer(int id);
~DbusServer();
const QString& getServiceName() { return serviceName; }
const int getServiceID() { return serviceID; }
void run();
private:
QDBusConnection* myBus;
QString serviceName;
int serviceID;
public slots:
Q_SCRIPTABLE QString ping(const QString &arg);
};
#endif // _DBUS_THREAD_
|