tdebluez
libtdebluez/interfaces/objectmanagerProxy.cpp
Go to the documentation of this file.
1 // File autogenerated
2 
3 // declaration include
4 #include "objectmanagerProxy.h"
5 
6 // TQt includes
7 #include <tqstring.h>
8 #include <tqstringlist.h>
9 
10 // TQt D-Bus includes
11 #include <tqdbusdata.h>
12 #include <tqdbusdatalist.h>
13 #include <tqdbusdatamap.h>
14 #include <tqdbuserror.h>
15 #include <tqdbusmessage.h>
16 #include <tqdbusobjectpath.h>
17 #include <tqdbusproxy.h>
18 
19 
20 namespace org
21 {
22 namespace freedesktop
23 {
24 namespace DBus
25 {
26 
27 ObjectManagerProxy::ObjectManagerProxy(const TQString& service, const TQString& path, TQObject* parent, const char* name)
28  : TQObject(parent, name),
29  m_baseProxy(new TQT_DBusProxy())
30 {
31  m_baseProxy->setInterface("org.freedesktop.DBus.ObjectManager");
32  m_baseProxy->setPath(path);
33  m_baseProxy->setService(service);
34 
35  TQObject::connect(m_baseProxy, TQ_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
36  this, TQ_SLOT(slotHandleDBusSignal(const TQT_DBusMessage&)));
37 }
38 
40 {
41  delete m_baseProxy;
42 }
43 
44 void ObjectManagerProxy::setConnection(const TQT_DBusConnection& connection)
45 {
46  m_baseProxy->setConnection(connection);
47 }
48 
50 {
51  TQValueList<TQT_DBusData> parameters;
52 
53 
54  TQT_DBusMessage reply = m_baseProxy->sendWithReply("GetManagedObjects", parameters, &error);
55 
56  if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
57 
58  if (reply.count() != 1) return false;
59 
60  bool ok = false;
61 
62  objects = reply.front().toObjectPathKeyMap(&ok);
63  if (!ok) return false;
64 
65  return true;
66 }
67 
68 void ObjectManagerProxy::slotHandleDBusSignal(const TQT_DBusMessage& message)
69 {
70  if (message.member() == "InterfacesAdded")
71  {
72  TQT_DBusObjectPath _object = message[0].toObjectPath();
73  TQT_DBusDataMap< TQString > _interfaces = message[1].toStringKeyMap();
74 
75  emit InterfacesAdded(_object, _interfaces);
76  }
77  else if (message.member() == "InterfacesRemoved")
78  {
79  TQT_DBusObjectPath _object = message[0].toObjectPath();
80  TQStringList _interfaces = message[1].toList().toTQStringList();
81 
82  emit InterfacesRemoved(_object, _interfaces);
83  }
84 }
85 
86 }; // namespace DBus
87 
88 }; // namespace freedesktop
89 
90 }; // namespace org
91 
92 #include "objectmanagerProxy.moc"
93 
94 // End of File
95 
ObjectManagerProxy(const TQString &service, const TQString &path, TQObject *parent=0, const char *name=0)
virtual void slotHandleDBusSignal(const TQT_DBusMessage &message)
virtual bool GetManagedObjects(TQT_DBusDataMap< TQT_DBusObjectPath > &objects, TQT_DBusError &error)
void InterfacesAdded(const TQT_DBusObjectPath &object, const TQT_DBusDataMap< TQString > &interfaces)
void InterfacesRemoved(const TQT_DBusObjectPath &object, const TQStringList &interfaces)