|
|
|
@ -25,7 +25,7 @@
|
|
|
|
|
|
|
|
|
|
// QT - Header
|
|
|
|
|
#include <tqtimer.h>
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// debug
|
|
|
|
|
#include <kdebug.h>
|
|
|
|
|
|
|
|
|
@ -35,15 +35,12 @@
|
|
|
|
|
#include <tqdbusobjectpath.h>
|
|
|
|
|
#include <tqdbusdatamap.h>
|
|
|
|
|
#include <tqdbusdata.h>
|
|
|
|
|
#include <tqdbusdatalist.h>
|
|
|
|
|
#include <tqdbusvariant.h>
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
#include <tqstringlist.h>
|
|
|
|
|
|
|
|
|
|
#include "obexobjectmanagerImpl.h"
|
|
|
|
|
#include "../libtdebluez/btuuids.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace TDEObex
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -56,8 +53,7 @@ ObexObjectManagerImpl::ObexObjectManagerImpl(const TQString& service, const TQSt
|
|
|
|
|
|
|
|
|
|
ObexObjectManagerImpl::~ObexObjectManagerImpl()
|
|
|
|
|
{
|
|
|
|
|
if( dBusConn.isConnected() )
|
|
|
|
|
close();
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
@ -98,7 +94,15 @@ TQT_DBusConnection* ObexObjectManagerImpl::getConnection() {
|
|
|
|
|
* \retval true if successful closed the connection
|
|
|
|
|
* \retval false if any problems
|
|
|
|
|
*/
|
|
|
|
|
bool ObexObjectManagerImpl::close() {
|
|
|
|
|
bool ObexObjectManagerImpl::close() { org::bluez::obex::AgentManager1Proxy* mAgentManager;
|
|
|
|
|
|
|
|
|
|
if(mClient)
|
|
|
|
|
delete mClient;
|
|
|
|
|
if(mSession)
|
|
|
|
|
delete mSession;
|
|
|
|
|
if(mFileTransfer)
|
|
|
|
|
delete mFileTransfer;
|
|
|
|
|
|
|
|
|
|
disconnect(this,
|
|
|
|
|
SIGNAL(InterfacesAdded(const TQT_DBusObjectPath&, const TQT_DBusDataMap< TQString >&)),
|
|
|
|
|
this,
|
|
|
|
@ -107,7 +111,8 @@ bool ObexObjectManagerImpl::close() {
|
|
|
|
|
SIGNAL(InterfacesRemoved(const TQT_DBusObjectPath& , const TQStringList& )),
|
|
|
|
|
this,
|
|
|
|
|
SLOT(slotInterfacesRemoved(const TQT_DBusObjectPath& , const TQStringList& )));
|
|
|
|
|
dBusConn.closeConnection(DBUS_CONN_NAME);
|
|
|
|
|
if( dBusConn.isConnected() )
|
|
|
|
|
dBusConn.closeConnection(DBUS_CONN_NAME);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -132,18 +137,15 @@ bool ObexObjectManagerImpl::initDBUS(){
|
|
|
|
|
tqDebug("GetManagedObjects(objects,error) FAILED\n");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// bool ok = false;
|
|
|
|
|
// TQT_DBusDataMap<TQT_DBusObjectPath> objects = data.toObjectPathKeyMap(&ok);
|
|
|
|
|
// if (!ok) return false;
|
|
|
|
|
|
|
|
|
|
TQT_DBusDataMap<TQT_DBusObjectPath>::const_iterator it = objects.begin();
|
|
|
|
|
for (it; it != objects.end(); ++it) {
|
|
|
|
|
// TQCString objectpath (it.key());
|
|
|
|
|
bool ok = false;
|
|
|
|
|
TQT_DBusDataMap<TQString> tqMap1 = it.data().toStringKeyMap(&ok);
|
|
|
|
|
if (!ok)
|
|
|
|
|
if (!ok) {
|
|
|
|
|
tqWarning("Failed to convert dbus data to string map: %s", it.key().latin1());
|
|
|
|
|
if (!ok) return false;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
slotInterfacesAdded(it.key(), tqMap1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -156,14 +158,6 @@ bool ObexObjectManagerImpl::initDBUS(){
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// inherited from ObjectManager
|
|
|
|
|
|
|
|
|
|
//void ObexObjectManagerImpl::AsyncErrorResponseDetected(int asyncCallId, const TQT_DBusError error) {
|
|
|
|
|
// kdDebug() << k_funcinfo << endl;
|
|
|
|
|
//
|
|
|
|
|
//}
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
* This function initialise the connection to the D-Bus daemon.
|
|
|
|
|
* \return pointer to AgentManager1
|
|
|
|
@ -186,23 +180,35 @@ void ObexObjectManagerImpl::slotInterfacesAdded(const TQT_DBusObjectPath& object
|
|
|
|
|
TQString interface = it1.key();
|
|
|
|
|
if ( interface == "org.bluez.obex.AgentManager1" ) {
|
|
|
|
|
mAgentManager = new org::bluez::obex::AgentManager1Proxy("org.bluez.obex", object);
|
|
|
|
|
if (mAgentManager)
|
|
|
|
|
if (mAgentManager) {
|
|
|
|
|
mAgentManager->setConnection(dBusConn);
|
|
|
|
|
} else {
|
|
|
|
|
tqDebug("org.bluez.obex.AgentManager1 initialization failed\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( interface == "org.bluez.obex.Client1" ) {
|
|
|
|
|
mClient = new org::bluez::obex::Client1Proxy("org.bluez.obex", object);
|
|
|
|
|
if (mClient)
|
|
|
|
|
if (mClient) {
|
|
|
|
|
mClient->setConnection(dBusConn);
|
|
|
|
|
} else {
|
|
|
|
|
tqDebug("org.bluez.obex.Client1 initialization failed\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( interface == "org.bluez.obex.Session1" ) {
|
|
|
|
|
mSession = new org::bluez::obex::Session1Proxy("org.bluez.obex", object);
|
|
|
|
|
if (mSession)
|
|
|
|
|
if (mSession) {
|
|
|
|
|
mSession->setConnection(dBusConn);
|
|
|
|
|
} else {
|
|
|
|
|
tqDebug("org.bluez.obex.Session1 initialization failed\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( interface == "org.bluez.obex.FileTransfer1" ) {
|
|
|
|
|
mFileTransfer = new org::bluez::obex::FileTransfer1Proxy("org.bluez.obex", object);
|
|
|
|
|
if (mFileTransfer)
|
|
|
|
|
if (mFileTransfer) {
|
|
|
|
|
mFileTransfer->setConnection(dBusConn);
|
|
|
|
|
} else {
|
|
|
|
|
tqDebug("org.bluez.obex.FileTransfer1 initialization failed\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if ( interface == "org.freedesktop.DBus.Introspectable" ) {
|
|
|
|
|
// do nothing
|
|
|
|
@ -222,6 +228,12 @@ void ObexObjectManagerImpl::slotInterfacesRemoved(const TQT_DBusObjectPath& obje
|
|
|
|
|
else if ( (*it) == "org.bluez.obex.Client1") {
|
|
|
|
|
// TODO: remove Client1
|
|
|
|
|
}
|
|
|
|
|
else if ( (*it) == "org.bluez.obex.Session1" ) {
|
|
|
|
|
// TODO: remove Session1
|
|
|
|
|
}
|
|
|
|
|
else if ( (*it) == "org.bluez.obex.FileTransfer1" ) {
|
|
|
|
|
// TODO: remove FileTransfer1
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
tqWarning("Interface not implemented: %s", (*it).local8Bit().data());
|
|
|
|
|
}
|
|
|
|
|