tdebluez
libtdebluez/interfaces/agent1Interface.cpp
Go to the documentation of this file.
1// File autogenerated
2
3// declaration include
4#include "agent1Interface.h"
5
6// TQt includes
7#include <tqdom.h>
8#include <tqstring.h>
9
10// TQt D-Bus includes
11#include <tqdbuserror.h>
12#include <tqdbusmessage.h>
13#include <tqdbusobjectpath.h>
14
15
16namespace org
17{
18namespace bluez
19{
20
21void Agent1Interface::buildIntrospectionData(TQDomElement& interfaceElement)
22{
23 interfaceElement.setAttribute("name", "org.bluez.Agent1");
24
25 TQDomDocument document = interfaceElement.ownerDocument();
26 TQDomElement methodElement = document.createElement("method");
27 methodElement.setAttribute("name", "Release");
28
29 interfaceElement.appendChild(methodElement);
30
31 methodElement = document.createElement("method");
32 TQDomElement asyncAnnotationElement = document.createElement("annotation");
33 asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
34 asyncAnnotationElement.setAttribute("value", "true");
35 methodElement.appendChild(asyncAnnotationElement);
36 methodElement.setAttribute("name", "RequestPinCode");
37
38 TQDomElement argumentElement = document.createElement("arg");
39 argumentElement.setAttribute("name", "device");
40 argumentElement.setAttribute("type", "o");
41 argumentElement.setAttribute("direction", "in");
42 methodElement.appendChild(argumentElement);
43
44 argumentElement = document.createElement("arg");
45 argumentElement.setAttribute("name", "pincode");
46 argumentElement.setAttribute("type", "s");
47 argumentElement.setAttribute("direction", "out");
48 methodElement.appendChild(argumentElement);
49
50 interfaceElement.appendChild(methodElement);
51
52 methodElement = document.createElement("method");
53 asyncAnnotationElement = document.createElement("annotation");
54 asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
55 asyncAnnotationElement.setAttribute("value", "true");
56 methodElement.appendChild(asyncAnnotationElement);
57 methodElement.setAttribute("name", "DisplayPinCode");
58
59 argumentElement = document.createElement("arg");
60 argumentElement.setAttribute("name", "device");
61 argumentElement.setAttribute("type", "o");
62 argumentElement.setAttribute("direction", "in");
63 methodElement.appendChild(argumentElement);
64
65 argumentElement = document.createElement("arg");
66 argumentElement.setAttribute("name", "pincode");
67 argumentElement.setAttribute("type", "s");
68 argumentElement.setAttribute("direction", "in");
69 methodElement.appendChild(argumentElement);
70
71 interfaceElement.appendChild(methodElement);
72
73 methodElement = document.createElement("method");
74 asyncAnnotationElement = document.createElement("annotation");
75 asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
76 asyncAnnotationElement.setAttribute("value", "true");
77 methodElement.appendChild(asyncAnnotationElement);
78 methodElement.setAttribute("name", "RequestPasskey");
79
80 argumentElement = document.createElement("arg");
81 argumentElement.setAttribute("name", "device");
82 argumentElement.setAttribute("type", "o");
83 argumentElement.setAttribute("direction", "in");
84 methodElement.appendChild(argumentElement);
85
86 argumentElement = document.createElement("arg");
87 argumentElement.setAttribute("name", "passkey");
88 argumentElement.setAttribute("type", "u");
89 argumentElement.setAttribute("direction", "out");
90 methodElement.appendChild(argumentElement);
91
92 interfaceElement.appendChild(methodElement);
93
94 methodElement = document.createElement("method");
95 asyncAnnotationElement = document.createElement("annotation");
96 asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
97 asyncAnnotationElement.setAttribute("value", "true");
98 methodElement.appendChild(asyncAnnotationElement);
99 methodElement.setAttribute("name", "DisplayPasskey");
100
101 argumentElement = document.createElement("arg");
102 argumentElement.setAttribute("name", "device");
103 argumentElement.setAttribute("type", "o");
104 argumentElement.setAttribute("direction", "in");
105 methodElement.appendChild(argumentElement);
106
107 argumentElement = document.createElement("arg");
108 argumentElement.setAttribute("name", "passkey");
109 argumentElement.setAttribute("type", "u");
110 argumentElement.setAttribute("direction", "in");
111 methodElement.appendChild(argumentElement);
112
113 argumentElement = document.createElement("arg");
114 argumentElement.setAttribute("name", "entered");
115 argumentElement.setAttribute("type", "q");
116 argumentElement.setAttribute("direction", "in");
117 methodElement.appendChild(argumentElement);
118
119 interfaceElement.appendChild(methodElement);
120
121 methodElement = document.createElement("method");
122 asyncAnnotationElement = document.createElement("annotation");
123 asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
124 asyncAnnotationElement.setAttribute("value", "true");
125 methodElement.appendChild(asyncAnnotationElement);
126 methodElement.setAttribute("name", "RequestConfirmation");
127
128 argumentElement = document.createElement("arg");
129 argumentElement.setAttribute("name", "device");
130 argumentElement.setAttribute("type", "o");
131 argumentElement.setAttribute("direction", "in");
132 methodElement.appendChild(argumentElement);
133
134 argumentElement = document.createElement("arg");
135 argumentElement.setAttribute("name", "passkey");
136 argumentElement.setAttribute("type", "u");
137 argumentElement.setAttribute("direction", "in");
138 methodElement.appendChild(argumentElement);
139
140 interfaceElement.appendChild(methodElement);
141
142 methodElement = document.createElement("method");
143 asyncAnnotationElement = document.createElement("annotation");
144 asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
145 asyncAnnotationElement.setAttribute("value", "true");
146 methodElement.appendChild(asyncAnnotationElement);
147 methodElement.setAttribute("name", "RequestAuthorization");
148
149 argumentElement = document.createElement("arg");
150 argumentElement.setAttribute("name", "device");
151 argumentElement.setAttribute("type", "o");
152 argumentElement.setAttribute("direction", "in");
153 methodElement.appendChild(argumentElement);
154
155 interfaceElement.appendChild(methodElement);
156
157 methodElement = document.createElement("method");
158 asyncAnnotationElement = document.createElement("annotation");
159 asyncAnnotationElement.setAttribute("name", "org.freedesktop.DBus.GLib.Async");
160 asyncAnnotationElement.setAttribute("value", "true");
161 methodElement.appendChild(asyncAnnotationElement);
162 methodElement.setAttribute("name", "AuthorizeService");
163
164 argumentElement = document.createElement("arg");
165 argumentElement.setAttribute("name", "device");
166 argumentElement.setAttribute("type", "o");
167 argumentElement.setAttribute("direction", "in");
168 methodElement.appendChild(argumentElement);
169
170 argumentElement = document.createElement("arg");
171 argumentElement.setAttribute("name", "uuid");
172 argumentElement.setAttribute("type", "s");
173 argumentElement.setAttribute("direction", "in");
174 methodElement.appendChild(argumentElement);
175
176 interfaceElement.appendChild(methodElement);
177
178 methodElement = document.createElement("method");
179 methodElement.setAttribute("name", "Cancel");
180
181 interfaceElement.appendChild(methodElement);
182}
183
184void Agent1Interface::RequestPinCodeAsyncReply(int asyncCallId, const TQString& pincode)
185
186{
187 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
188 if (findIt == m_asyncCalls.end()) return;
189
190 TQT_DBusMessage call = findIt.data();
191 m_asyncCalls.erase(findIt);
192
193 TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
194 reply << TQT_DBusData::fromString(pincode);
195
196 handleMethodReply(reply);
197}
198
199void Agent1Interface::RequestPinCodeAsyncError(int asyncCallId, const TQT_DBusError& error)
200{
201 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
202 if (findIt == m_asyncCalls.end()) return;
203
204 TQT_DBusMessage call = findIt.data();
205 m_asyncCalls.erase(findIt);
206
207 TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
208 handleMethodReply(reply);
209}
210
212
213{
214 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
215 if (findIt == m_asyncCalls.end()) return;
216
217 TQT_DBusMessage call = findIt.data();
218 m_asyncCalls.erase(findIt);
219
220 TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
221
222 handleMethodReply(reply);
223}
224
225void Agent1Interface::DisplayPinCodeAsyncError(int asyncCallId, const TQT_DBusError& error)
226{
227 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
228 if (findIt == m_asyncCalls.end()) return;
229
230 TQT_DBusMessage call = findIt.data();
231 m_asyncCalls.erase(findIt);
232
233 TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
234 handleMethodReply(reply);
235}
236
237void Agent1Interface::RequestPasskeyAsyncReply(int asyncCallId, TQ_UINT32 passkey)
238
239{
240 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
241 if (findIt == m_asyncCalls.end()) return;
242
243 TQT_DBusMessage call = findIt.data();
244 m_asyncCalls.erase(findIt);
245
246 TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
247 reply << TQT_DBusData::fromUInt32(passkey);
248
249 handleMethodReply(reply);
250}
251
252void Agent1Interface::RequestPasskeyAsyncError(int asyncCallId, const TQT_DBusError& error)
253{
254 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
255 if (findIt == m_asyncCalls.end()) return;
256
257 TQT_DBusMessage call = findIt.data();
258 m_asyncCalls.erase(findIt);
259
260 TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
261 handleMethodReply(reply);
262}
263
265
266{
267 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
268 if (findIt == m_asyncCalls.end()) return;
269
270 TQT_DBusMessage call = findIt.data();
271 m_asyncCalls.erase(findIt);
272
273 TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
274
275 handleMethodReply(reply);
276}
277
278void Agent1Interface::DisplayPasskeyAsyncError(int asyncCallId, const TQT_DBusError& error)
279{
280 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
281 if (findIt == m_asyncCalls.end()) return;
282
283 TQT_DBusMessage call = findIt.data();
284 m_asyncCalls.erase(findIt);
285
286 TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
287 handleMethodReply(reply);
288}
289
291
292{
293 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
294 if (findIt == m_asyncCalls.end()) return;
295
296 TQT_DBusMessage call = findIt.data();
297 m_asyncCalls.erase(findIt);
298
299 TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
300
301 handleMethodReply(reply);
302}
303
304void Agent1Interface::RequestConfirmationAsyncError(int asyncCallId, const TQT_DBusError& error)
305{
306 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
307 if (findIt == m_asyncCalls.end()) return;
308
309 TQT_DBusMessage call = findIt.data();
310 m_asyncCalls.erase(findIt);
311
312 TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
313 handleMethodReply(reply);
314}
315
317
318{
319 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
320 if (findIt == m_asyncCalls.end()) return;
321
322 TQT_DBusMessage call = findIt.data();
323 m_asyncCalls.erase(findIt);
324
325 TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
326
327 handleMethodReply(reply);
328}
329
330void Agent1Interface::RequestAuthorizationAsyncError(int asyncCallId, const TQT_DBusError& error)
331{
332 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
333 if (findIt == m_asyncCalls.end()) return;
334
335 TQT_DBusMessage call = findIt.data();
336 m_asyncCalls.erase(findIt);
337
338 TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
339 handleMethodReply(reply);
340}
341
343
344{
345 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
346 if (findIt == m_asyncCalls.end()) return;
347
348 TQT_DBusMessage call = findIt.data();
349 m_asyncCalls.erase(findIt);
350
351 TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
352
353 handleMethodReply(reply);
354}
355
356void Agent1Interface::AuthorizeServiceAsyncError(int asyncCallId, const TQT_DBusError& error)
357{
358 TQMap<int, TQT_DBusMessage>::iterator findIt = m_asyncCalls.find(asyncCallId);
359 if (findIt == m_asyncCalls.end()) return;
360
361 TQT_DBusMessage call = findIt.data();
362 m_asyncCalls.erase(findIt);
363
364 TQT_DBusMessage reply = TQT_DBusMessage::methodError(call, error);
365 handleMethodReply(reply);
366}
367
368TQT_DBusMessage Agent1Interface::callRelease(const TQT_DBusMessage& message)
369{
370 TQT_DBusError error;
371 TQT_DBusMessage reply;
372
373
374 if (Release(error))
375 {
376 reply = TQT_DBusMessage::methodReply(message);
377 }
378 else
379 {
380 if (!error.isValid())
381 {
382 tqWarning("Call to implementation of org::bluez::Agent1Interface::Release returned 'false' but error object is not valid!");
383
384 error = TQT_DBusError::stdFailed("org.bluez.Agent1.Release execution failed");
385 }
386
387 reply = TQT_DBusMessage::methodError(message, error);
388 }
389
390 return reply;
391}
392
393TQT_DBusMessage Agent1Interface::callCancel(const TQT_DBusMessage& message)
394{
395 TQT_DBusError error;
396 TQT_DBusMessage reply;
397
398
399 if (Cancel(error))
400 {
401 reply = TQT_DBusMessage::methodReply(message);
402 }
403 else
404 {
405 if (!error.isValid())
406 {
407 tqWarning("Call to implementation of org::bluez::Agent1Interface::Cancel returned 'false' but error object is not valid!");
408
409 error = TQT_DBusError::stdFailed("org.bluez.Agent1.Cancel execution failed");
410 }
411
412 reply = TQT_DBusMessage::methodError(message, error);
413 }
414
415 return reply;
416}
417
418void Agent1Interface::callRequestPinCodeAsync(const TQT_DBusMessage& message)
419{
420 TQT_DBusObjectPath _device = message[0].toObjectPath();
421
422 int _asyncCallId = 0;
423 while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
424 {
425 ++_asyncCallId;
426 }
427 m_asyncCalls.insert(_asyncCallId, message);
428
429 RequestPinCodeAsync(_asyncCallId, _device);
430
431 return;
432}
433
434void Agent1Interface::callDisplayPinCodeAsync(const TQT_DBusMessage& message)
435{
436 TQT_DBusObjectPath _device = message[0].toObjectPath();
437 TQString _pincode = message[1].toString();
438
439 int _asyncCallId = 0;
440 while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
441 {
442 ++_asyncCallId;
443 }
444 m_asyncCalls.insert(_asyncCallId, message);
445
446 DisplayPinCodeAsync(_asyncCallId, _device, _pincode);
447
448 return;
449}
450
451void Agent1Interface::callRequestPasskeyAsync(const TQT_DBusMessage& message)
452{
453 TQT_DBusObjectPath _device = message[0].toObjectPath();
454
455 int _asyncCallId = 0;
456 while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
457 {
458 ++_asyncCallId;
459 }
460 m_asyncCalls.insert(_asyncCallId, message);
461
462 RequestPasskeyAsync(_asyncCallId, _device);
463
464 return;
465}
466
467void Agent1Interface::callDisplayPasskeyAsync(const TQT_DBusMessage& message)
468{
469 TQT_DBusObjectPath _device = message[0].toObjectPath();
470 TQ_UINT32 _passkey = message[1].toUInt32();
471 TQ_UINT16 _entered = message[2].toUInt16();
472
473 int _asyncCallId = 0;
474 while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
475 {
476 ++_asyncCallId;
477 }
478 m_asyncCalls.insert(_asyncCallId, message);
479
480 DisplayPasskeyAsync(_asyncCallId, _device, _passkey, _entered);
481
482 return;
483}
484
485void Agent1Interface::callRequestConfirmationAsync(const TQT_DBusMessage& message)
486{
487 TQT_DBusObjectPath _device = message[0].toObjectPath();
488 TQ_UINT32 _passkey = message[1].toUInt32();
489
490 int _asyncCallId = 0;
491 while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
492 {
493 ++_asyncCallId;
494 }
495 m_asyncCalls.insert(_asyncCallId, message);
496
497 RequestConfirmationAsync(_asyncCallId, _device, _passkey);
498
499 return;
500}
501
502void Agent1Interface::callRequestAuthorizationAsync(const TQT_DBusMessage& message)
503{
504 TQT_DBusObjectPath _device = message[0].toObjectPath();
505
506 int _asyncCallId = 0;
507 while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
508 {
509 ++_asyncCallId;
510 }
511 m_asyncCalls.insert(_asyncCallId, message);
512
513 RequestAuthorizationAsync(_asyncCallId, _device);
514
515 return;
516}
517
518void Agent1Interface::callAuthorizeServiceAsync(const TQT_DBusMessage& message)
519{
520 TQT_DBusObjectPath _device = message[0].toObjectPath();
521 TQString _uuid = message[1].toString();
522
523 int _asyncCallId = 0;
524 while (m_asyncCalls.find(_asyncCallId) != m_asyncCalls.end())
525 {
526 ++_asyncCallId;
527 }
528 m_asyncCalls.insert(_asyncCallId, message);
529
530 AuthorizeServiceAsync(_asyncCallId, _device, _uuid);
531
532 return;
533}
534
535bool Agent1Interface::handleMethodCall(const TQT_DBusMessage& message)
536{
537 if (message.interface() != "org.bluez.Agent1") return false;
538
539 if (message.member() == "Release")
540 {
541 TQT_DBusMessage reply = callRelease(message);
542 handleMethodReply(reply);
543
544 return true;
545 }
546
547 if (message.member() == "RequestPinCode")
548 {
550
551 return true;
552 }
553
554 if (message.member() == "DisplayPinCode")
555 {
557
558 return true;
559 }
560
561 if (message.member() == "RequestPasskey")
562 {
564
565 return true;
566 }
567
568 if (message.member() == "DisplayPasskey")
569 {
571
572 return true;
573 }
574
575 if (message.member() == "RequestConfirmation")
576 {
578
579 return true;
580 }
581
582 if (message.member() == "RequestAuthorization")
583 {
585
586 return true;
587 }
588
589 if (message.member() == "AuthorizeService")
590 {
592
593 return true;
594 }
595
596 if (message.member() == "Cancel")
597 {
598 TQT_DBusMessage reply = callCancel(message);
599 handleMethodReply(reply);
600
601 return true;
602 }
603
604 return false;
605}
606
607}; // namespace bluez
608
609}; // namespace org
610
611// End of File
612
virtual bool Release(TQT_DBusError &error)=0
virtual void RequestAuthorizationAsync(int asyncCallId, const TQT_DBusObjectPath &device)=0
void callRequestPasskeyAsync(const TQT_DBusMessage &message)
virtual void DisplayPasskeyAsyncError(int asyncCallId, const TQT_DBusError &error)
static void buildIntrospectionData(TQDomElement &interfaceElement)
virtual void DisplayPasskeyAsync(int asyncCallId, const TQT_DBusObjectPath &device, TQ_UINT32 passkey, TQ_UINT16 entered)=0
virtual void AuthorizeServiceAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual void RequestConfirmationAsync(int asyncCallId, const TQT_DBusObjectPath &device, TQ_UINT32 passkey)=0
TQT_DBusMessage callCancel(const TQT_DBusMessage &message)
virtual void RequestPinCodeAsyncError(int asyncCallId, const TQT_DBusError &error)
void callDisplayPinCodeAsync(const TQT_DBusMessage &message)
virtual void AuthorizeServiceAsync(int asyncCallId, const TQT_DBusObjectPath &device, const TQString &uuid)=0
virtual bool handleMethodCall(const TQT_DBusMessage &message)
virtual void RequestPinCodeAsync(int asyncCallId, const TQT_DBusObjectPath &device)=0
virtual void DisplayPinCodeAsync(int asyncCallId, const TQT_DBusObjectPath &device, const TQString &pincode)=0
void callDisplayPasskeyAsync(const TQT_DBusMessage &message)
virtual void RequestAuthorizationAsyncReply(int asyncCallId)
TQT_DBusMessage callRelease(const TQT_DBusMessage &message)
void callAuthorizeServiceAsync(const TQT_DBusMessage &message)
void callRequestConfirmationAsync(const TQT_DBusMessage &message)
virtual void RequestPasskeyAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual void RequestConfirmationAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual void RequestPinCodeAsyncReply(int asyncCallId, const TQString &pincode)
virtual void RequestPasskeyAsync(int asyncCallId, const TQT_DBusObjectPath &device)=0
void callRequestAuthorizationAsync(const TQT_DBusMessage &message)
virtual void DisplayPinCodeAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual bool Cancel(TQT_DBusError &error)=0
virtual void RequestConfirmationAsyncReply(int asyncCallId)
virtual void RequestPasskeyAsyncReply(int asyncCallId, TQ_UINT32 passkey)
void callRequestPinCodeAsync(const TQT_DBusMessage &message)
virtual void RequestAuthorizationAsyncError(int asyncCallId, const TQT_DBusError &error)
virtual void handleMethodReply(const TQT_DBusMessage &reply)=0