-
Notifications
You must be signed in to change notification settings - Fork 3
/
object.h
70 lines (52 loc) · 1.9 KB
/
object.h
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
#ifndef __DBUS2VDR_OBJECT_H
#define __DBUS2VDR_OBJECT_H
#include <gio/gio.h>
#include <vdr/thread.h>
#include <vdr/tools.h>
class cDBusConnection;
class cDBusObject;
typedef void (*cDBusMethodFunc)(cDBusObject *Object, GVariant *Parameters, GDBusMethodInvocation *Invocation);
class cDBusMethod : public cListObject
{
private:
friend class cDBusObject;
const char *_name;
cDBusMethodFunc _method;
cDBusMethod(const char *Name, cDBusMethodFunc Method)
:_name(Name),_method(Method)
{
};
};
class cDBusObject : public cListObject
{
private:
friend class cDBusConnection;
static void do_work(gpointer data, gpointer user_data);
static void handle_method_call(GDBusConnection *connection,
const gchar *sender,
const gchar *object_path,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
GDBusMethodInvocation *invocation,
gpointer user_data);
gchar *_path;
GDBusNodeInfo *_introspection_data;
GArray *_registration_ids;
cDBusConnection *_connection;
cList<cDBusMethod> _methods;
static const GDBusInterfaceVTable _interface_vtable;
void SetConnection(cDBusConnection *Connection) { _connection = Connection; };
void Register(void);
void Unregister(void);
protected:
void SetPath(const char *Path);
void AddMethod(const char *Name, cDBusMethodFunc Method);
public:
static void FreeThreadPool(void);
cDBusObject(const char *Path, const char *XmlNodeInfo);
virtual ~cDBusObject(void);
cDBusConnection *Connection(void) const { return _connection; };
const gchar *Path(void) const { return _path; };
};
#endif