tdebluez
device1Proxy.cpp
Go to the documentation of this file.
1 // File autogenerated
2 
3 // declaration include
4 #include "device1Proxy.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 <tqdbusconnection.h>
13 #include <tqdbusdata.h>
14 #include <tqdbusdatalist.h>
15 #include <tqdbusdatamap.h>
16 #include <tqdbuserror.h>
17 #include <tqdbusmessage.h>
18 #include <tqdbusobjectpath.h>
19 #include <tqdbusproxy.h>
20 #include <tqdbusvariant.h>
21 
22 
23 namespace org
24 {
25 namespace bluez
26 {
27 
28 Device1Proxy::Device1Proxy(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.bluez.Device1");
33  m_baseProxy->setPath(path);
34  m_baseProxy->setService(service);
35 
36  TQObject::connect(m_baseProxy, TQ_SIGNAL(asyncReply(int, const TQT_DBusMessage&)),
37  this, TQ_SLOT(slotHandleAsyncReply(int, const TQT_DBusMessage&)));
38 }
39 
41 {
42  delete m_baseProxy;
43 }
44 
45 void Device1Proxy::setConnection(const TQT_DBusConnection& connection)
46 {
47  m_baseProxy->setConnection(connection);
48 }
49 
50 bool Device1Proxy::DisconnectAsync(int& asyncCallId, TQT_DBusError& error)
51 {
52  TQValueList<TQT_DBusData> parameters;
53 
54 
55  asyncCallId = m_baseProxy->sendWithAsyncReply("Disconnect", parameters);
56 
57  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "Disconnect";
58 
59  error = TQT_DBusError();
60  return (asyncCallId != 0);
61 }
62 
63 bool Device1Proxy::ConnectAsync(int& asyncCallId, TQT_DBusError& error)
64 {
65  TQValueList<TQT_DBusData> parameters;
66 
67 
68  asyncCallId = m_baseProxy->sendWithAsyncReply("Connect", parameters);
69 
70  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "Connect";
71 
72  error = TQT_DBusError();
73  return (asyncCallId != 0);
74 }
75 
76 bool Device1Proxy::ConnectProfileAsync(int& asyncCallId, const TQString& UUID, TQT_DBusError& error)
77 {
78  TQValueList<TQT_DBusData> parameters;
79 
80  parameters << TQT_DBusData::fromString(UUID);
81 
82  asyncCallId = m_baseProxy->sendWithAsyncReply("ConnectProfile", parameters);
83 
84  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "ConnectProfile";
85 
86  error = TQT_DBusError();
87  return (asyncCallId != 0);
88 }
89 
90 bool Device1Proxy::DisconnectProfileAsync(int& asyncCallId, const TQString& UUID, TQT_DBusError& error)
91 {
92  TQValueList<TQT_DBusData> parameters;
93 
94  parameters << TQT_DBusData::fromString(UUID);
95 
96  asyncCallId = m_baseProxy->sendWithAsyncReply("DisconnectProfile", parameters);
97 
98  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "DisconnectProfile";
99 
100  error = TQT_DBusError();
101  return (asyncCallId != 0);
102 }
103 
104 bool Device1Proxy::PairAsync(int& asyncCallId, TQT_DBusError& error)
105 {
106  TQValueList<TQT_DBusData> parameters;
107 
108 
109  asyncCallId = m_baseProxy->sendWithAsyncReply("Pair", parameters);
110 
111  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "Pair";
112 
113  error = TQT_DBusError();
114  return (asyncCallId != 0);
115 }
116 
117 bool Device1Proxy::CancelPairingAsync(int& asyncCallId, TQT_DBusError& error)
118 {
119  TQValueList<TQT_DBusData> parameters;
120 
121 
122  asyncCallId = m_baseProxy->sendWithAsyncReply("CancelPairing", parameters);
123 
124  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "CancelPairing";
125 
126  error = TQT_DBusError();
127  return (asyncCallId != 0);
128 }
129 
130 void Device1Proxy::setDBusProperty(const TQString& name, const TQT_DBusVariant& value, TQT_DBusError& error)
131 {
132  TQT_DBusConnection connection = m_baseProxy->connection();
133 
134  TQT_DBusMessage message = TQT_DBusMessage::methodCall(m_baseProxy->service(), m_baseProxy->path(), "org.freedesktop.DBus.Properties", "Set");
135 
136  message << TQT_DBusData::fromString(m_baseProxy->interface());
137  message << TQT_DBusData::fromString(name);
138  message << TQT_DBusData::fromVariant(value);
139 
140  connection.sendWithReply(message, &error);
141 }
142 
143 TQT_DBusVariant Device1Proxy::getDBusProperty(const TQString& name, TQT_DBusError& error) const
144 {
145  TQT_DBusConnection connection = m_baseProxy->connection();
146 
147  TQT_DBusMessage message = TQT_DBusMessage::methodCall(m_baseProxy->service(), m_baseProxy->path(), "org.freedesktop.DBus.Properties", "Get");
148 
149  message << TQT_DBusData::fromString(m_baseProxy->interface());
150  message << TQT_DBusData::fromString(name);
151 
152  TQT_DBusMessage reply = connection.sendWithReply(message, &error);
153 
154  if (reply.type() != TQT_DBusMessage::ReplyMessage) return TQT_DBusVariant();
155  if (reply.count() != 1) return TQT_DBusVariant();
156 
157  bool ok = false;
158  TQT_DBusVariant value = reply.front().toVariant(&ok);
159  if (!ok) return TQT_DBusVariant();
160 
161  return value;
162 }
163 
164 TQString Device1Proxy::getAddress(TQT_DBusError& error) const
165 {
166  TQT_DBusVariant variant = getDBusProperty("Address", error);
167 
168  if (error.isValid()) return TQString();
169 
170  bool ok = false;
171 
172  TQString result = variant.value.toString(&ok);
173  if (!ok) {}
174 
175  return result;
176 }
177 
178 TQString Device1Proxy::getName(TQT_DBusError& error) const
179 {
180  TQT_DBusVariant variant = getDBusProperty("Name", error);
181 
182  if (error.isValid()) return TQString();
183 
184  bool ok = false;
185 
186  TQString result = variant.value.toString(&ok);
187  if (!ok) {}
188 
189  return result;
190 }
191 
192 void Device1Proxy::setAlias(const TQString& value, TQT_DBusError& error)
193 {
194  TQT_DBusVariant variant;
195  variant.value = TQT_DBusData::fromString(value);
196  variant.signature = "s";
197 
198  setDBusProperty("Alias", variant, error);
199 }
200 
201 TQString Device1Proxy::getAlias(TQT_DBusError& error) const
202 {
203  TQT_DBusVariant variant = getDBusProperty("Alias", error);
204 
205  if (error.isValid()) return TQString();
206 
207  bool ok = false;
208 
209  TQString result = variant.value.toString(&ok);
210  if (!ok) {}
211 
212  return result;
213 }
214 
215 TQ_UINT32 Device1Proxy::getClass(TQT_DBusError& error) const
216 {
217  TQT_DBusVariant variant = getDBusProperty("Class", error);
218 
219  if (error.isValid()) return TQ_UINT32();
220 
221  bool ok = false;
222 
223  TQ_UINT32 result = variant.value.toUInt32(&ok);
224  if (!ok) {}
225 
226  return result;
227 }
228 
229 TQ_UINT16 Device1Proxy::getAppearance(TQT_DBusError& error) const
230 {
231  TQT_DBusVariant variant = getDBusProperty("Appearance", error);
232 
233  if (error.isValid()) return TQ_UINT16();
234 
235  bool ok = false;
236 
237  TQ_UINT16 result = variant.value.toUInt16(&ok);
238  if (!ok) {}
239 
240  return result;
241 }
242 
243 TQString Device1Proxy::getIcon(TQT_DBusError& error) const
244 {
245  TQT_DBusVariant variant = getDBusProperty("Icon", error);
246 
247  if (error.isValid()) return TQString();
248 
249  bool ok = false;
250 
251  TQString result = variant.value.toString(&ok);
252  if (!ok) {}
253 
254  return result;
255 }
256 
257 bool Device1Proxy::getPaired(TQT_DBusError& error) const
258 {
259  TQT_DBusVariant variant = getDBusProperty("Paired", error);
260 
261  if (error.isValid()) return bool();
262 
263  bool ok = false;
264 
265  bool result = variant.value.toBool(&ok);
266  if (!ok) {}
267 
268  return result;
269 }
270 
271 void Device1Proxy::setTrusted(bool value, TQT_DBusError& error)
272 {
273  TQT_DBusVariant variant;
274  variant.value = TQT_DBusData::fromBool(value);
275  variant.signature = "b";
276 
277  setDBusProperty("Trusted", variant, error);
278 }
279 
280 bool Device1Proxy::getTrusted(TQT_DBusError& error) const
281 {
282  TQT_DBusVariant variant = getDBusProperty("Trusted", error);
283 
284  if (error.isValid()) return bool();
285 
286  bool ok = false;
287 
288  bool result = variant.value.toBool(&ok);
289  if (!ok) {}
290 
291  return result;
292 }
293 
294 void Device1Proxy::setBlocked(bool value, TQT_DBusError& error)
295 {
296  TQT_DBusVariant variant;
297  variant.value = TQT_DBusData::fromBool(value);
298  variant.signature = "b";
299 
300  setDBusProperty("Blocked", variant, error);
301 }
302 
303 bool Device1Proxy::getBlocked(TQT_DBusError& error) const
304 {
305  TQT_DBusVariant variant = getDBusProperty("Blocked", error);
306 
307  if (error.isValid()) return bool();
308 
309  bool ok = false;
310 
311  bool result = variant.value.toBool(&ok);
312  if (!ok) {}
313 
314  return result;
315 }
316 
317 bool Device1Proxy::getLegacyPairing(TQT_DBusError& error) const
318 {
319  TQT_DBusVariant variant = getDBusProperty("LegacyPairing", error);
320 
321  if (error.isValid()) return bool();
322 
323  bool ok = false;
324 
325  bool result = variant.value.toBool(&ok);
326  if (!ok) {}
327 
328  return result;
329 }
330 
331 TQ_INT16 Device1Proxy::getRSSI(TQT_DBusError& error) const
332 {
333  TQT_DBusVariant variant = getDBusProperty("RSSI", error);
334 
335  if (error.isValid()) return TQ_INT16();
336 
337  bool ok = false;
338 
339  TQ_INT16 result = variant.value.toInt16(&ok);
340  if (!ok) {}
341 
342  return result;
343 }
344 
345 bool Device1Proxy::getConnected(TQT_DBusError& error) const
346 {
347  TQT_DBusVariant variant = getDBusProperty("Connected", error);
348 
349  if (error.isValid()) return bool();
350 
351  bool ok = false;
352 
353  bool result = variant.value.toBool(&ok);
354  if (!ok) {}
355 
356  return result;
357 }
358 
359 TQStringList Device1Proxy::getUUIDs(TQT_DBusError& error) const
360 {
361  TQT_DBusVariant variant = getDBusProperty("UUIDs", error);
362 
363  if (error.isValid()) return TQStringList();
364 
365  bool ok = false;
366 
367  bool subOK = false;
368 
369  TQStringList result = variant.value.toList(&ok).toTQStringList(&subOK);
370  if (!subOK) {}
371  if (!ok) {}
372 
373  return result;
374 }
375 
376 TQString Device1Proxy::getModalias(TQT_DBusError& error) const
377 {
378  TQT_DBusVariant variant = getDBusProperty("Modalias", error);
379 
380  if (error.isValid()) return TQString();
381 
382  bool ok = false;
383 
384  TQString result = variant.value.toString(&ok);
385  if (!ok) {}
386 
387  return result;
388 }
389 
390 TQT_DBusObjectPath Device1Proxy::getAdapter(TQT_DBusError& error) const
391 {
392  TQT_DBusVariant variant = getDBusProperty("Adapter", error);
393 
394  if (error.isValid()) return TQT_DBusObjectPath();
395 
396  bool ok = false;
397 
398  TQT_DBusObjectPath result = variant.value.toObjectPath(&ok);
399  if (!ok) {}
400 
401  return result;
402 }
403 
405 {
406  TQT_DBusVariant variant = getDBusProperty("ManufacturerData", error);
407 
408  if (error.isValid()) return TQMap< TQ_UINT16, TQT_DBusVariant >();
409 
410  bool ok = false;
411 
412  bool subOK = false;
413 
414  TQMap< TQ_UINT16, TQT_DBusVariant > result = variant.value.toUInt16KeyMap(&ok).toVariantMap(&subOK);
415  if (!subOK) {}
416  if (!ok) {}
417 
418  return result;
419 }
420 
422 {
423  TQT_DBusVariant variant = getDBusProperty("ServiceData", error);
424 
425  if (error.isValid()) return TQMap< TQString, TQT_DBusVariant >();
426 
427  bool ok = false;
428 
429  bool subOK = false;
430 
431  TQMap< TQString, TQT_DBusVariant > result = variant.value.toStringKeyMap(&ok).toVariantMap(&subOK);
432  if (!subOK) {}
433  if (!ok) {}
434 
435  return result;
436 }
437 
438 TQ_INT16 Device1Proxy::getTxPower(TQT_DBusError& error) const
439 {
440  TQT_DBusVariant variant = getDBusProperty("TxPower", error);
441 
442  if (error.isValid()) return TQ_INT16();
443 
444  bool ok = false;
445 
446  TQ_INT16 result = variant.value.toInt16(&ok);
447  if (!ok) {}
448 
449  return result;
450 }
451 
452 bool Device1Proxy::getServicesResolved(TQT_DBusError& error) const
453 {
454  TQT_DBusVariant variant = getDBusProperty("ServicesResolved", error);
455 
456  if (error.isValid()) return bool();
457 
458  bool ok = false;
459 
460  bool result = variant.value.toBool(&ok);
461  if (!ok) {}
462 
463  return result;
464 }
465 
466 void Device1Proxy::slotHandleAsyncReply(int asyncCallId, const TQT_DBusMessage& message)
467 {
468  TQMap<int, TQString>::iterator findIt = m_asyncCalls.find(asyncCallId);
469  if (findIt == m_asyncCalls.end()) return;
470 
471  const TQString signalName = findIt.data();
472  m_asyncCalls.erase(findIt);
473 
474  if (signalName == "Disconnect")
475  {
476  int _asyncCallId = asyncCallId;
477 
478  if (message.type() == TQT_DBusMessage::ErrorMessage) {
479  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
480  }
481 
482 
483  emit DisconnectAsyncReply(_asyncCallId);
484  }
485  else if (signalName == "Connect")
486  {
487  int _asyncCallId = asyncCallId;
488 
489  if (message.type() == TQT_DBusMessage::ErrorMessage) {
490  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
491  }
492 
493 
494  emit ConnectAsyncReply(_asyncCallId);
495  }
496  else if (signalName == "ConnectProfile")
497  {
498  int _asyncCallId = asyncCallId;
499 
500  if (message.type() == TQT_DBusMessage::ErrorMessage) {
501  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
502  }
503 
504 
505  emit ConnectProfileAsyncReply(_asyncCallId);
506  }
507  else if (signalName == "DisconnectProfile")
508  {
509  int _asyncCallId = asyncCallId;
510 
511  if (message.type() == TQT_DBusMessage::ErrorMessage) {
512  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
513  }
514 
515 
516  emit DisconnectProfileAsyncReply(_asyncCallId);
517  }
518  else if (signalName == "Pair")
519  {
520  int _asyncCallId = asyncCallId;
521 
522  if (message.type() == TQT_DBusMessage::ErrorMessage) {
523  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
524  }
525 
526 
527  emit PairAsyncReply(_asyncCallId);
528  }
529  else if (signalName == "CancelPairing")
530  {
531  int _asyncCallId = asyncCallId;
532 
533  if (message.type() == TQT_DBusMessage::ErrorMessage) {
534  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
535  }
536 
537 
538  emit CancelPairingAsyncReply(_asyncCallId);
539  }
540 }
541 
542 }; // namespace bluez
543 
544 }; // namespace org
545 
546 #include "device1Proxy.moc"
547 
548 // End of File
549 
virtual TQStringList getUUIDs(TQT_DBusError &error) const
void CancelPairingAsyncReply(int asyncCallId)
void ConnectProfileAsyncReply(int asyncCallId)
virtual bool PairAsync(int &asyncCallId, TQT_DBusError &error)
void AsyncErrorResponseDetected(int asyncCallId, const TQT_DBusError error)
virtual TQT_DBusVariant getDBusProperty(const TQString &name, TQT_DBusError &error) const
virtual TQString getModalias(TQT_DBusError &error) const
virtual bool getServicesResolved(TQT_DBusError &error) const
void setConnection(const TQT_DBusConnection &connection)
virtual bool getPaired(TQT_DBusError &error) const
Device1Proxy(const TQString &service, const TQString &path, TQObject *parent=0, const char *name=0)
virtual bool ConnectProfileAsync(int &asyncCallId, const TQString &UUID, TQT_DBusError &error)
virtual TQT_DBusObjectPath getAdapter(TQT_DBusError &error) const
virtual TQMap< TQ_UINT16, TQT_DBusVariant > getManufacturerData(TQT_DBusError &error) const
virtual void slotHandleAsyncReply(int id, const TQT_DBusMessage &message)
virtual void setBlocked(bool value, TQT_DBusError &error)
virtual bool DisconnectProfileAsync(int &asyncCallId, const TQString &UUID, TQT_DBusError &error)
virtual TQMap< TQString, TQT_DBusVariant > getServiceData(TQT_DBusError &error) const
virtual bool DisconnectAsync(int &asyncCallId, TQT_DBusError &error)
virtual bool getConnected(TQT_DBusError &error) const
TQT_DBusProxy * m_baseProxy
Definition: device1Proxy.h:117
TQMap< int, TQString > m_asyncCalls
Definition: device1Proxy.h:119
virtual TQString getName(TQT_DBusError &error) const
virtual bool ConnectAsync(int &asyncCallId, TQT_DBusError &error)
virtual TQString getAlias(TQT_DBusError &error) const
virtual TQ_INT16 getRSSI(TQT_DBusError &error) const
void DisconnectProfileAsyncReply(int asyncCallId)
virtual bool getTrusted(TQT_DBusError &error) const
void PairAsyncReply(int asyncCallId)
void ConnectAsyncReply(int asyncCallId)
virtual bool CancelPairingAsync(int &asyncCallId, TQT_DBusError &error)
virtual void setAlias(const TQString &value, TQT_DBusError &error)
void DisconnectAsyncReply(int asyncCallId)
virtual TQ_INT16 getTxPower(TQT_DBusError &error) const
virtual bool getLegacyPairing(TQT_DBusError &error) const
virtual void setDBusProperty(const TQString &name, const TQT_DBusVariant &variant, TQT_DBusError &error)
virtual bool getBlocked(TQT_DBusError &error) const
virtual TQ_UINT32 getClass(TQT_DBusError &error) const
virtual TQ_UINT16 getAppearance(TQT_DBusError &error) const
virtual void setTrusted(bool value, TQT_DBusError &error)
virtual TQString getAddress(TQT_DBusError &error) const
virtual TQString getIcon(TQT_DBusError &error) const