tdebluez
device1Interface.cpp
Go to the documentation of this file.
1 // File autogenerated
2 
3 // declaration include
4 #include "device1Interface.h"
5 
6 // TQt includes
7 #include <tqdom.h>
8 #include <tqmap.h>
9 #include <tqstring.h>
10 #include <tqstringlist.h>
11 
12 // TQt D-Bus includes
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 <tqdbusvariant.h>
20 
21 
22 namespace org
23 {
24 namespace bluez
25 {
26 
27 void Device1Interface::buildIntrospectionData(TQDomElement& interfaceElement)
28 {
29  interfaceElement.setAttribute("name", "org.bluez.Device1");
30 
31  TQDomDocument document = interfaceElement.ownerDocument();
32  TQDomElement methodElement = document.createElement("method");
33  TQDomElement asyncAnnotationElement = document.createElement("annotation");
34  asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
35  asyncAnnotationElement.setAttribute("value", "true");
36  methodElement.appendChild(asyncAnnotationElement);
37  methodElement.setAttribute("name", "Disconnect");
38 
39  interfaceElement.appendChild(methodElement);
40 
41  methodElement = document.createElement("method");
42  asyncAnnotationElement = document.createElement("annotation");
43  asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
44  asyncAnnotationElement.setAttribute("value", "true");
45  methodElement.appendChild(asyncAnnotationElement);
46  methodElement.setAttribute("name", "Connect");
47 
48  interfaceElement.appendChild(methodElement);
49 
50  methodElement = document.createElement("method");
51  asyncAnnotationElement = document.createElement("annotation");
52  asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
53  asyncAnnotationElement.setAttribute("value", "true");
54  methodElement.appendChild(asyncAnnotationElement);
55  methodElement.setAttribute("name", "ConnectProfile");
56 
57  TQDomElement argumentElement = document.createElement("arg");
58  argumentElement.setAttribute("name", "UUID");
59  argumentElement.setAttribute("type", "s");
60  argumentElement.setAttribute("direction", "in");
61  methodElement.appendChild(argumentElement);
62 
63  interfaceElement.appendChild(methodElement);
64 
65  methodElement = document.createElement("method");
66  asyncAnnotationElement = document.createElement("annotation");
67  asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
68  asyncAnnotationElement.setAttribute("value", "true");
69  methodElement.appendChild(asyncAnnotationElement);
70  methodElement.setAttribute("name", "DisconnectProfile");
71 
72  argumentElement = document.createElement("arg");
73  argumentElement.setAttribute("name", "UUID");
74  argumentElement.setAttribute("type", "s");
75  argumentElement.setAttribute("direction", "in");
76  methodElement.appendChild(argumentElement);
77 
78  interfaceElement.appendChild(methodElement);
79 
80  methodElement = document.createElement("method");
81  asyncAnnotationElement = document.createElement("annotation");
82  asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
83  asyncAnnotationElement.setAttribute("value", "true");
84  methodElement.appendChild(asyncAnnotationElement);
85  methodElement.setAttribute("name", "Pair");
86 
87  interfaceElement.appendChild(methodElement);
88 
89  methodElement = document.createElement("method");
90  asyncAnnotationElement = document.createElement("annotation");
91  asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
92  asyncAnnotationElement.setAttribute("value", "true");
93  methodElement.appendChild(asyncAnnotationElement);
94  methodElement.setAttribute("name", "CancelPairing");
95 
96  interfaceElement.appendChild(methodElement);
97 }
98 
100 
101 {
102  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
103  if (findIt == m_asyncCalls.end()) return;
104 
105  TQT_DBusMessage call = findIt.data();
106  m_asyncCalls.erase(findIt);
107 
108  TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
109 
110  handleMethodReply(reply);
111 }
112 
113 void Device1Interface::DisconnectAsyncError(int asyncCallId, const TQT_DBusError& error)
114 {
115  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
116  if (findIt == m_asyncCalls.end()) return;
117 
118  TQT_DBusMessage call = findIt.data();
119  m_asyncCalls.erase(findIt);
120 
121  TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
122  handleMethodReply(reply);
123 }
124 
126 
127 {
128  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
129  if (findIt == m_asyncCalls.end()) return;
130 
131  TQT_DBusMessage call = findIt.data();
132  m_asyncCalls.erase(findIt);
133 
134  TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
135 
136  handleMethodReply(reply);
137 }
138 
139 void Device1Interface::ConnectAsyncError(int asyncCallId, const TQT_DBusError& error)
140 {
141  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
142  if (findIt == m_asyncCalls.end()) return;
143 
144  TQT_DBusMessage call = findIt.data();
145  m_asyncCalls.erase(findIt);
146 
147  TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
148  handleMethodReply(reply);
149 }
150 
152 
153 {
154  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
155  if (findIt == m_asyncCalls.end()) return;
156 
157  TQT_DBusMessage call = findIt.data();
158  m_asyncCalls.erase(findIt);
159 
160  TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
161 
162  handleMethodReply(reply);
163 }
164 
165 void Device1Interface::ConnectProfileAsyncError(int asyncCallId, const TQT_DBusError& error)
166 {
167  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
168  if (findIt == m_asyncCalls.end()) return;
169 
170  TQT_DBusMessage call = findIt.data();
171  m_asyncCalls.erase(findIt);
172 
173  TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
174  handleMethodReply(reply);
175 }
176 
178 
179 {
180  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
181  if (findIt == m_asyncCalls.end()) return;
182 
183  TQT_DBusMessage call = findIt.data();
184  m_asyncCalls.erase(findIt);
185 
186  TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
187 
188  handleMethodReply(reply);
189 }
190 
191 void Device1Interface::DisconnectProfileAsyncError(int asyncCallId, const TQT_DBusError& error)
192 {
193  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
194  if (findIt == m_asyncCalls.end()) return;
195 
196  TQT_DBusMessage call = findIt.data();
197  m_asyncCalls.erase(findIt);
198 
199  TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
200  handleMethodReply(reply);
201 }
202 
203 void Device1Interface::PairAsyncReply(int asyncCallId)
204 
205 {
206  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
207  if (findIt == m_asyncCalls.end()) return;
208 
209  TQT_DBusMessage call = findIt.data();
210  m_asyncCalls.erase(findIt);
211 
212  TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
213 
214  handleMethodReply(reply);
215 }
216 
217 void Device1Interface::PairAsyncError(int asyncCallId, const TQT_DBusError& error)
218 {
219  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
220  if (findIt == m_asyncCalls.end()) return;
221 
222  TQT_DBusMessage call = findIt.data();
223  m_asyncCalls.erase(findIt);
224 
225  TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
226  handleMethodReply(reply);
227 }
228 
230 
231 {
232  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
233  if (findIt == m_asyncCalls.end()) return;
234 
235  TQT_DBusMessage call = findIt.data();
236  m_asyncCalls.erase(findIt);
237 
238  TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
239 
240  handleMethodReply(reply);
241 }
242 
243 void Device1Interface::CancelPairingAsyncError(int asyncCallId, const TQT_DBusError& error)
244 {
245  TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
246  if (findIt == m_asyncCalls.end()) return;
247 
248  TQT_DBusMessage call = findIt.data();
249  m_asyncCalls.erase(findIt);
250 
251  TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
252  handleMethodReply(reply);
253 }
254 
255 void Device1Interface::callDisconnectAsync(const TQT_DBusMessage& message)
256 {
257 
258  int _asyncCallId = 0;
259  while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
260  {
261  ++_asyncCallId;
262  }
263  m_asyncCalls.insert(_asyncCallId, message);
264 
265  DisconnectAsync(_asyncCallId);
266 
267  return;
268 }
269 
270 void Device1Interface::callConnectAsync(const TQT_DBusMessage& message)
271 {
272 
273  int _asyncCallId = 0;
274  while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
275  {
276  ++_asyncCallId;
277  }
278  m_asyncCalls.insert(_asyncCallId, message);
279 
280  ConnectAsync(_asyncCallId);
281 
282  return;
283 }
284 
285 void Device1Interface::callConnectProfileAsync(const TQT_DBusMessage& message)
286 {
287  TQString _UUID = message[0].toString();
288 
289  int _asyncCallId = 0;
290  while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
291  {
292  ++_asyncCallId;
293  }
294  m_asyncCalls.insert(_asyncCallId, message);
295 
296  ConnectProfileAsync(_asyncCallId, _UUID);
297 
298  return;
299 }
300 
301 void Device1Interface::callDisconnectProfileAsync(const TQT_DBusMessage& message)
302 {
303  TQString _UUID = message[0].toString();
304 
305  int _asyncCallId = 0;
306  while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
307  {
308  ++_asyncCallId;
309  }
310  m_asyncCalls.insert(_asyncCallId, message);
311 
312  DisconnectProfileAsync(_asyncCallId, _UUID);
313 
314  return;
315 }
316 
317 void Device1Interface::callPairAsync(const TQT_DBusMessage& message)
318 {
319 
320  int _asyncCallId = 0;
321  while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
322  {
323  ++_asyncCallId;
324  }
325  m_asyncCalls.insert(_asyncCallId, message);
326 
327  PairAsync(_asyncCallId);
328 
329  return;
330 }
331 
332 void Device1Interface::callCancelPairingAsync(const TQT_DBusMessage& message)
333 {
334 
335  int _asyncCallId = 0;
336  while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
337  {
338  ++_asyncCallId;
339  }
340  m_asyncCalls.insert(_asyncCallId, message);
341 
342  CancelPairingAsync(_asyncCallId);
343 
344  return;
345 }
346 
347 bool Device1Interface::handleMethodCall(const TQT_DBusMessage& message)
348 {
349  if (message.interface() != "org.bluez.Device1") return false;
350 
351  if (message.member() == "Disconnect")
352  {
353  callDisconnectAsync(message);
354 
355  return true;
356  }
357 
358  if (message.member() == "Connect")
359  {
360  callConnectAsync(message);
361 
362  return true;
363  }
364 
365  if (message.member() == "ConnectProfile")
366  {
367  callConnectProfileAsync(message);
368 
369  return true;
370  }
371 
372  if (message.member() == "DisconnectProfile")
373  {
375 
376  return true;
377  }
378 
379  if (message.member() == "Pair")
380  {
381  callPairAsync(message);
382 
383  return true;
384  }
385 
386  if (message.member() == "CancelPairing")
387  {
388  callCancelPairingAsync(message);
389 
390  return true;
391  }
392 
393  return false;
394 }
395 
396 }; // namespace bluez
397 
398 }; // namespace org
399 
400 // End of File
401 
virtual void ConnectProfileAsync(int asyncCallId, const TQString &UUID)=0
void callConnectProfileAsync(const TQT_DBusMessage &message)
virtual void ConnectProfileAsyncError(int asyncCallId, const TQT_DBusError &error)
void callCancelPairingAsync(const TQT_DBusMessage &message)
virtual void ConnectAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual void ConnectAsync(int asyncCallId)=0
virtual void DisconnectProfileAsyncReply(int asyncCallId)
void callDisconnectAsync(const TQT_DBusMessage &message)
virtual void CancelPairingAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual void DisconnectProfileAsync(int asyncCallId, const TQString &UUID)=0
virtual void CancelPairingAsyncReply(int asyncCallId)
virtual void DisconnectAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual void DisconnectProfileAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual bool handleMethodCall(const TQT_DBusMessage &message)
TQMap< int, TQT_DBusMessage > m_asyncCalls
virtual void DisconnectAsync(int asyncCallId)=0
virtual void handleMethodReply(const TQT_DBusMessage &reply)=0
static void buildIntrospectionData(TQDomElement &interfaceElement)
void callPairAsync(const TQT_DBusMessage &message)
void callConnectAsync(const TQT_DBusMessage &message)
virtual void DisconnectAsyncReply(int asyncCallId)
virtual void PairAsyncReply(int asyncCallId)
virtual void ConnectProfileAsyncReply(int asyncCallId)
void callDisconnectProfileAsync(const TQT_DBusMessage &message)
virtual void ConnectAsyncReply(int asyncCallId)
virtual void PairAsync(int asyncCallId)=0
virtual void PairAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual void CancelPairingAsync(int asyncCallId)=0