tdebluez
libtdeobex/interfaces/agent1Proxy.cpp
Go to the documentation of this file.
1 // File autogenerated
2 
3 // declaration include
4 #include "agent1Proxy.h"
5 
6 // TQt includes
7 #include <tqstring.h>
8 
9 // TQt D-Bus includes
10 #include <tqdbuserror.h>
11 #include <tqdbusmessage.h>
12 #include <tqdbusobjectpath.h>
13 #include <tqdbusproxy.h>
14 
15 
16 namespace org
17 {
18 namespace bluez
19 {
20 namespace obex
21 {
22 
23 Agent1Proxy::Agent1Proxy(const TQString& service, const TQString& path, TQObject* parent, const char* name)
24  : TQObject(parent, name),
25  m_baseProxy(new TQT_DBusProxy())
26 {
27  m_baseProxy->setInterface("org.bluez.obex.Agent1");
28  m_baseProxy->setPath(path);
29  m_baseProxy->setService(service);
30 
31  TQObject::connect(m_baseProxy, TQ_SIGNAL(asyncReply(int, const TQT_DBusMessage&)),
32  this, TQ_SLOT(slotHandleAsyncReply(int, const TQT_DBusMessage&)));
33 }
34 
36 {
37  delete m_baseProxy;
38 }
39 
40 void Agent1Proxy::setConnection(const TQT_DBusConnection& connection)
41 {
42  m_baseProxy->setConnection(connection);
43 }
44 
45 bool Agent1Proxy::ReleaseAsync(int& asyncCallId, TQT_DBusError& error)
46 {
47  TQValueList<TQT_DBusData> parameters;
48 
49 
50  asyncCallId = m_baseProxy->sendWithAsyncReply("Release", parameters);
51 
52  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "Release";
53 
54  error = TQT_DBusError();
55  return (asyncCallId != 0);
56 }
57 
58 bool Agent1Proxy::AuthorizePushAsync(int& asyncCallId, const TQT_DBusObjectPath& transfer, TQT_DBusError& error)
59 {
60  TQValueList<TQT_DBusData> parameters;
61 
62  parameters << TQT_DBusData::fromObjectPath(transfer);
63 
64  asyncCallId = m_baseProxy->sendWithAsyncReply("AuthorizePush", parameters);
65 
66  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "AuthorizePush";
67 
68  error = TQT_DBusError();
69  return (asyncCallId != 0);
70 }
71 
72 bool Agent1Proxy::CancelAsync(int& asyncCallId, TQT_DBusError& error)
73 {
74  TQValueList<TQT_DBusData> parameters;
75 
76 
77  asyncCallId = m_baseProxy->sendWithAsyncReply("Cancel", parameters);
78 
79  if (asyncCallId != 0) m_asyncCalls[asyncCallId] = "Cancel";
80 
81  error = TQT_DBusError();
82  return (asyncCallId != 0);
83 }
84 
85 void Agent1Proxy::slotHandleAsyncReply(int asyncCallId, const TQT_DBusMessage& message)
86 {
87  TQMap<int, TQString>::iterator findIt = m_asyncCalls.find(asyncCallId);
88  if (findIt == m_asyncCalls.end()) return;
89 
90  const TQString signalName = findIt.data();
91  m_asyncCalls.erase(findIt);
92 
93  if (signalName == "Release")
94  {
95  int _asyncCallId = asyncCallId;
96 
97  if (message.type() == TQT_DBusMessage::ErrorMessage) {
98  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
99  }
100 
101 
102  emit ReleaseAsyncReply(_asyncCallId);
103  }
104  else if (signalName == "AuthorizePush")
105  {
106  int _asyncCallId = asyncCallId;
107 
108  if (message.type() == TQT_DBusMessage::ErrorMessage) {
109  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
110  }
111 
112  TQString _filepath = message[0].toString();
113 
114  emit AuthorizePushAsyncReply(_asyncCallId, _filepath);
115  }
116  else if (signalName == "Cancel")
117  {
118  int _asyncCallId = asyncCallId;
119 
120  if (message.type() == TQT_DBusMessage::ErrorMessage) {
121  emit AsyncErrorResponseDetected(_asyncCallId, message.error());
122  }
123 
124 
125  emit CancelAsyncReply(_asyncCallId);
126  }
127 }
128 
129 }; // namespace obex
130 
131 }; // namespace bluez
132 
133 }; // namespace org
134 
135 #include "agent1Proxy.moc"
136 
137 // End of File
138 
virtual bool AuthorizePushAsync(int &asyncCallId, const TQT_DBusObjectPath &transfer, TQT_DBusError &error)
void AsyncErrorResponseDetected(int asyncCallId, const TQT_DBusError error)
virtual bool CancelAsync(int &asyncCallId, TQT_DBusError &error)
virtual void slotHandleAsyncReply(int id, const TQT_DBusMessage &message)
virtual bool ReleaseAsync(int &asyncCallId, TQT_DBusError &error)
void AuthorizePushAsyncReply(int asyncCallId, const TQString &filepath)
void setConnection(const TQT_DBusConnection &connection)
void ReleaseAsyncReply(int asyncCallId)
void CancelAsyncReply(int asyncCallId)
Agent1Proxy(const TQString &service, const TQString &path, TQObject *parent=0, const char *name=0)