tdebluez
libtdebluez/interfaces/propertiesProxy.cpp
Go to the documentation of this file.
1// File autogenerated
2
3// declaration include
4#include "propertiesProxy.h"
5
6// TQt includes
7#include <tqmap.h>
8#include <tqstring.h>
9#include <tqstringlist.h>
10
11// TQt D-Bus includes
12#include <tqdbusdata.h>
13#include <tqdbusdatalist.h>
14#include <tqdbusdatamap.h>
15#include <tqdbuserror.h>
16#include <tqdbusmessage.h>
17#include <tqdbusproxy.h>
18#include <tqdbusvariant.h>
19
20
21namespace org
22{
23namespace freedesktop
24{
25namespace DBus
26{
27
28PropertiesProxy::PropertiesProxy(const TQString& service, const TQString& path, TQObject* parent, const char* name)
29 : TQObject(parent, name),
30 m_baseProxy(new TQT_DBusProxy())
31{
32 m_baseProxy->setInterface("org.freedesktop.DBus.Properties");
33 m_baseProxy->setPath(path);
34 m_baseProxy->setService(service);
35
36 TQObject::connect(m_baseProxy, TQ_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
37 this, TQ_SLOT(slotHandleDBusSignal(const TQT_DBusMessage&)));
38}
39
41{
42 delete m_baseProxy;
43}
44
45void PropertiesProxy::setConnection(const TQT_DBusConnection& connection)
46{
47 m_baseProxy->setConnection(connection);
48}
49
50bool PropertiesProxy::Get(const TQString& interface, const TQString& name, TQT_DBusVariant& value, TQT_DBusError& error)
51{
52 TQValueList<TQT_DBusData> parameters;
53
54 parameters << TQT_DBusData::fromString(interface);
55 parameters << TQT_DBusData::fromString(name);
56
57 TQT_DBusMessage reply = m_baseProxy->sendWithReply("Get", parameters, &error);
58
59 if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
60
61 if (reply.count() != 1) return false;
62
63 bool ok = false;
64
65 value = reply.front().toVariant(&ok);
66 if (!ok) return false;
67
68 return true;
69}
70
71bool PropertiesProxy::Set(const TQString& interface, const TQString& name, const TQT_DBusVariant& value, TQT_DBusError& error)
72{
73 TQValueList<TQT_DBusData> parameters;
74
75 parameters << TQT_DBusData::fromString(interface);
76 parameters << TQT_DBusData::fromString(name);
77 parameters << TQT_DBusData::fromVariant(value);
78
79 TQT_DBusMessage reply = m_baseProxy->sendWithReply("Set", parameters, &error);
80
81 if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
82 return true;
83}
84
85bool PropertiesProxy::GetAll(const TQString& interface, TQMap< TQString, TQT_DBusVariant >& properties, TQT_DBusError& error)
86{
87 TQValueList<TQT_DBusData> parameters;
88
89 parameters << TQT_DBusData::fromString(interface);
90
91 TQT_DBusMessage reply = m_baseProxy->sendWithReply("GetAll", parameters, &error);
92
93 if (reply.type() != TQT_DBusMessage::ReplyMessage) return false;
94
95 if (reply.count() != 1) return false;
96
97 bool ok = false;
98
99 bool subOK = false;
100
101 properties = reply.front().toStringKeyMap(&ok).toVariantMap(&subOK);
102 if (!subOK) return false;
103 if (!ok) return false;
104
105 return true;
106}
107
108void PropertiesProxy::slotHandleDBusSignal(const TQT_DBusMessage& message)
109{
110 if (message.member() == "PropertiesChanged")
111 {
112 TQString _interface = message[0].toString();
113 TQMap< TQString, TQT_DBusVariant > _changed_properties = message[1].toStringKeyMap().toVariantMap();
114 TQStringList _invalidated_properties = message[2].toList().toTQStringList();
115
116 emit PropertiesChanged(_interface, _changed_properties, _invalidated_properties);
117 }
118}
119
120}; // namespace DBus
121
122}; // namespace freedesktop
123
124}; // namespace org
125
126#include "propertiesProxy.moc"
127
128// End of File
129
void PropertiesChanged(const TQString &interface, const TQMap< TQString, TQT_DBusVariant > &changed_properties, const TQStringList &invalidated_properties)
virtual bool Set(const TQString &interface, const TQString &name, const TQT_DBusVariant &value, TQT_DBusError &error)
PropertiesProxy(const TQString &service, const TQString &path, TQObject *parent=0, const char *name=0)
virtual bool GetAll(const TQString &interface, TQMap< TQString, TQT_DBusVariant > &properties, TQT_DBusError &error)
virtual bool Get(const TQString &interface, const TQString &name, TQT_DBusVariant &value, TQT_DBusError &error)
virtual void slotHandleDBusSignal(const TQT_DBusMessage &message)
void setConnection(const TQT_DBusConnection &connection)