• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libsolidcontrol

bluetoothinterface.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2006 Will Stephenson <wstephenson@kde.org>
00003     Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
00004     Copyright (C) 2008 Tom Patzig <tpatzig@suse.de>
00005 
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License version 2 as published by the Free Software Foundation.
00010 
00011     This library is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014     Library General Public License for more details.
00015 
00016     You should have received a copy of the GNU Library General Public License
00017     along with this library; see the file COPYING.LIB.  If not, write to
00018     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019     Boston, MA 02110-1301, USA.
00020 
00021 */
00022 
00023 #include <QMap>
00024 #include <QPair>
00025 #include <QStringList>
00026 #include <QVariant>
00027 
00028 #include <KDebug>
00029 
00030 #include "ifaces/bluetoothinterface.h"
00031 
00032 #include "frontendobject_p.h"
00033 
00034 #include "soliddefs_p.h"
00035 #include "bluetoothmanager.h"
00036 #include "bluetoothinterface.h"
00037 #include "bluetoothremotedevice.h"
00038 
00039 namespace Solid
00040 {
00041 namespace Control
00042 {
00043 class BluetoothInterfacePrivate : public FrontendObjectPrivate
00044 {
00045 public:
00046     BluetoothInterfacePrivate(QObject *parent)
00047         : FrontendObjectPrivate(parent) { }
00048 
00049     void setBackendObject(QObject *object);
00050 
00051     QPair<BluetoothRemoteDevice *, Ifaces::BluetoothRemoteDevice *> findRegisteredBluetoothRemoteDevice(const QString &ubi) const;
00052     QPair<BluetoothInputDevice *, Ifaces::BluetoothInputDevice *> findRegisteredBluetoothInputDevice(const QString &ubi) const;
00053 
00054     mutable QMap<QString, QPair<BluetoothRemoteDevice *, Ifaces::BluetoothRemoteDevice *> > remoteDeviceMap;
00055     mutable QMap<QString, QPair<BluetoothInputDevice *, Ifaces::BluetoothInputDevice *> > inputDeviceMap;
00056     mutable BluetoothRemoteDevice invalidDevice;
00057     mutable BluetoothInputDevice invalidInputDevice;
00058 };
00059 }
00060 }
00061 
00062 Solid::Control::BluetoothInterface::BluetoothInterface()
00063         : QObject(), d(new BluetoothInterfacePrivate(this))
00064 {}
00065 
00066 Solid::Control::BluetoothInterface::BluetoothInterface(const QString &ubi)
00067         : QObject(), d(new BluetoothInterfacePrivate(this))
00068 {
00069     const BluetoothInterface &device = BluetoothManager::self().findBluetoothInterface(ubi);
00070     d->setBackendObject(device.d->backendObject());
00071     QObject::connect(d->backendObject(), SIGNAL(deviceCreated(const QString &)),this, SLOT(slotDeviceCreated(const QString &)));
00072 }
00073 
00074 Solid::Control::BluetoothInterface::BluetoothInterface(QObject *backendObject)
00075         : QObject(), d(new BluetoothInterfacePrivate(this))
00076 {
00077     d->setBackendObject(backendObject);
00078     QObject::connect(d->backendObject(), SIGNAL(deviceCreated(const QString &)),this, SLOT(slotDeviceCreated(const QString &)));
00079 }
00080 
00081 Solid::Control::BluetoothInterface::BluetoothInterface(const BluetoothInterface &device)
00082         : QObject(), d(new BluetoothInterfacePrivate(this))
00083 {
00084     d->setBackendObject(device.d->backendObject());
00085     QObject::connect(d->backendObject(), SIGNAL(deviceCreated(const QString &)),this, SLOT(slotDeviceCreated(const QString &)));
00086 }
00087 
00088 Solid::Control::BluetoothInterface::~BluetoothInterface()
00089 {
00090     // Delete all the interfaces, they are now outdated
00091     typedef QPair<BluetoothRemoteDevice *, Ifaces::BluetoothRemoteDevice *> BluetoothRemoteDeviceIfacePair;
00092     typedef QPair<BluetoothInputDevice *, Ifaces::BluetoothInputDevice *> BluetoothInputDeviceIfacePair;
00093 
00094     // Delete all the devices, they are now outdated
00095     foreach (const BluetoothRemoteDeviceIfacePair &pair, d->remoteDeviceMap.values()) {
00096         delete pair.first;
00097         delete pair.second;
00098     }
00099     foreach (const BluetoothInputDeviceIfacePair &pair, d->inputDeviceMap.values()) {
00100         delete pair.first;
00101         delete pair.second;
00102     }
00103 
00104 }
00105 
00106 Solid::Control::BluetoothInterface &Solid::Control::BluetoothInterface::operator=(const Solid::Control::BluetoothInterface  & dev)
00107 {
00108     d->setBackendObject(dev.d->backendObject());
00109 
00110     return *this;
00111 }
00112 
00113 QString Solid::Control::BluetoothInterface::ubi() const
00114 {
00115     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), ubi());
00116 }
00117 
00118 void Solid::Control::BluetoothInterface::cancelDeviceCreation(const QString &address) const
00119 {
00120     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), cancelDeviceCreation(address));
00121 }
00122 
00123 void Solid::Control::BluetoothInterface::createPairedDevice(const QString &address,const QString &adapterPath, const QString &capab) const
00124 {
00125     Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(d->backendObject());
00126     if (backend == 0) 
00127         return;
00128     backend->createPairedDevice(address,adapterPath,capab);
00129 }
00130 
00131 QMap<QString, QVariant> Solid::Control::BluetoothInterface::getProperties() const
00132 {
00133     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), (QMap<QString,QVariant>()), getProperties());
00134 }
00135 
00136 QVariant Solid::Control::BluetoothInterface::getProperty(const QString &key) const
00137 {
00138     QMap<QString, QVariant> props = getProperties();
00139     if (props.contains(key))
00140         return props[key];
00141     else
00142         return QVariant();
00143 }
00144 
00145 Solid::Control::BluetoothRemoteDeviceList Solid::Control::BluetoothInterface::listDevices() const
00146 {
00147     Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(d->backendObject());
00148     if (backend == 0) 
00149         return Solid::Control::BluetoothRemoteDeviceList();
00150 
00151     QStringList ubis = backend->listDevices();
00152 
00153     Solid::Control::BluetoothRemoteDeviceList list;
00154     foreach (const QString& ubi,ubis) {
00155         BluetoothRemoteDevice* remoteDevice = findBluetoothRemoteDeviceUBI(ubi);
00156         list.append(remoteDevice);
00157     }
00158     return list;
00159 }
00160 
00161 void Solid::Control::BluetoothInterface::registerAgent(const QString &path, const QString &capab) const
00162 {
00163     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), registerAgent(path,capab));
00164 }
00165 
00166 void Solid::Control::BluetoothInterface::releaseSession() const
00167 {
00168     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), releaseSession());
00169 }
00170 
00171 void Solid::Control::BluetoothInterface::requestSession() const
00172 {
00173     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), requestSession());
00174 }
00175 
00176 void Solid::Control::BluetoothInterface::removeDevice(const QString &path) const
00177 {
00178     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), removeDevice(path));
00179 }
00180 
00181 void Solid::Control::BluetoothInterface::setProperty(const QString &property, const QVariant &value) const
00182 {
00183     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), setProperty(property,value));
00184 }
00185 
00186 void Solid::Control::BluetoothInterface::startDiscovery() const
00187 {
00188     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), startDiscovery());
00189 }
00190 
00191 void Solid::Control::BluetoothInterface::stopDiscovery() const
00192 {
00193     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), stopDiscovery());
00194 }
00195 
00196 void Solid::Control::BluetoothInterface::unregisterAgent(const QString &path) const
00197 {
00198     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), unregisterAgent(path));
00199 }
00200 
00201 
00202 Solid::Control::BluetoothRemoteDevice Solid::Control::BluetoothInterface::findBluetoothRemoteDeviceAddr(const QString &address) const
00203 {
00204     Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(d->backendObject());
00205     if (backend == 0) 
00206         return d->invalidDevice;
00207 
00208     const QString ubi = getBluetoothRemoteDeviceUBI(address);
00209 
00210     QPair<BluetoothRemoteDevice *, Ifaces::BluetoothRemoteDevice *> pair = d->findRegisteredBluetoothRemoteDevice(ubi);
00211 
00212     if (pair.first != 0) {
00213         return *pair.first;
00214     } else {
00215         return d->invalidDevice;
00216     }
00217 }
00218 
00219 
00220 const QString Solid::Control::BluetoothInterface::getBluetoothRemoteDeviceUBI(const QString &address) const
00221 {
00222     Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(d->backendObject());
00223     if (backend == 0) 
00224         return "";
00225 
00226     const QString ubi = backend->findDevice(address);
00227     return ubi;
00228 }
00229 
00230 
00231 void Solid::Control::BluetoothInterface::createBluetoothRemoteDevice(const QString &address)
00232 {
00233     Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(d->backendObject());
00234     if (backend == 0) 
00235         return;
00236     backend->createDevice(address);
00237 }
00238 
00239 
00240 Solid::Control::BluetoothRemoteDevice* Solid::Control::BluetoothInterface::findBluetoothRemoteDeviceUBI(const QString &ubi) const
00241 {
00242     QPair<BluetoothRemoteDevice *, Ifaces::BluetoothRemoteDevice *> pair = d->findRegisteredBluetoothRemoteDevice(ubi);
00243     return pair.first;
00244 }
00245 
00246 Solid::Control::BluetoothInputDevice* Solid::Control::BluetoothInterface::findBluetoothInputDeviceUBI(const QString &ubi) const
00247 {
00248     QPair<BluetoothInputDevice *, Ifaces::BluetoothInputDevice *> pair = d->findRegisteredBluetoothInputDevice(ubi);
00249     return pair.first;
00250 }
00251 
00252 void Solid::Control::BluetoothInterface::slotDeviceCreated(const QString& ubi)
00253 {
00254 
00255     Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(d->backendObject());
00256     Ifaces::BluetoothRemoteDevice *iface = 0;
00257 
00258     if (backend != 0) {
00259         iface = qobject_cast<Ifaces::BluetoothRemoteDevice *>(backend->createBluetoothRemoteDevice(ubi));
00260     }
00261 
00262     if (iface != 0) {
00263         BluetoothRemoteDevice *device = new BluetoothRemoteDevice(iface);
00264 
00265         QPair<BluetoothRemoteDevice *, Ifaces::BluetoothRemoteDevice *> pair(device, iface);
00266         d->remoteDeviceMap[ubi] = pair;
00267     }
00268 }
00269 
00270 QString Solid::Control::BluetoothInterface::address() const
00271 {
00272     QVariant var = getProperty("Address");
00273 
00274     if (var.isValid())
00275         return var.value<QString>();
00276     else
00277         return QString();
00278 
00279 //    return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), address());
00280 }
00281 
00282 /*
00283 QString Solid::Control::BluetoothInterface::version() const
00284 {
00285     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), version());
00286 }
00287 
00288 QString Solid::Control::BluetoothInterface::revision() const
00289 {
00290     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), revision());
00291 }
00292 
00293 QString Solid::Control::BluetoothInterface::manufacturer() const
00294 {
00295     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), manufacturer());
00296 }
00297 
00298 QString Solid::Control::BluetoothInterface::company() const
00299 {
00300     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), company());
00301 }
00302 */
00303 
00304 
00305 int Solid::Control::BluetoothInterface::discoverableTimeout() const
00306 {
00307     QVariant var = getProperty("DiscoverableTimeout");
00308 
00309     if (var.isValid())
00310         return var.value<int>();
00311     else
00312         return 0;
00313 
00314 //  return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), 0, discoverableTimeout());
00315 }
00316 
00317 bool Solid::Control::BluetoothInterface::isDiscoverable() const
00318 {
00319     QVariant var = getProperty("Discoverable");
00320 
00321     if (var.isValid())
00322         return var.value<bool>();
00323     else
00324         return false;
00325 
00326 //   return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), false, isDiscoverable());
00327 }
00328 
00329 bool Solid::Control::BluetoothInterface::isDiscovering() const
00330 {
00331     QVariant var = getProperty("Discovering");
00332 
00333     if (var.isValid())
00334         return var.value<bool>();
00335     else
00336         return false;
00337 }
00338 
00339 /*
00340 Solid::Control::BluetoothRemoteDeviceList Solid::Control::BluetoothInterface::listConnections() const
00341 {
00342     BluetoothRemoteDeviceList list;
00343     Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(d->backendObject());
00344 
00345     if (backend == 0) return list;
00346 
00347     QStringList ubis = backend->listConnections();
00348 
00349     foreach (const QString &ubi, ubis) {
00350         BluetoothRemoteDevice remoteDevice = findBluetoothRemoteDevice(ubi);
00351         list.append(remoteDevice);
00352     }
00353 
00354     return list;
00355 }
00356 
00357 QString Solid::Control::BluetoothInterface::majorClass() const
00358 {
00359     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), majorClass());
00360 }
00361 
00362 QStringList Solid::Control::BluetoothInterface::listAvailableMinorClasses() const
00363 {
00364     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QStringList(), listAvailableMinorClasses());
00365 }
00366 
00367 QString Solid::Control::BluetoothInterface::minorClass() const
00368 {
00369     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), minorClass());
00370 }
00371 
00372 QStringList Solid::Control::BluetoothInterface::serviceClasses() const
00373 {
00374     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QStringList(), serviceClasses());
00375 }
00376 */
00377 
00378 QString Solid::Control::BluetoothInterface::name() const
00379 {
00380     QVariant var = getProperty("Name");
00381 
00382     if (var.isValid())
00383         return var.value<QString>();
00384     else
00385         return QString();
00386 
00387 //    return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), name());
00388 }
00389 
00390 /*
00391 QString Solid::Control::BluetoothInterface::getRemoteName(const QString &mac)
00392 {
00393     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QString(), getRemoteName(mac));
00394 }
00395 
00396 QStringList Solid::Control::BluetoothInterface::listBondings() const
00397 {
00398     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QStringList(), listBondings());
00399 }
00400 
00401 bool Solid::Control::BluetoothInterface::isPeriodicDiscoveryActive() const
00402 {
00403     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), false, isPeriodicDiscoveryActive());
00404 }
00405 
00406 bool Solid::Control::BluetoothInterface::isPeriodicDiscoveryNameResolvingActive() const
00407 {
00408     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), false,
00409                       isPeriodicDiscoveryNameResolvingActive());
00410 }
00411 
00412 bool  Solid::Control::BluetoothInterface::isTrusted(const QString& address)
00413 {
00414     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), false, isTrusted(address));
00415 }
00416 
00417 // TODO: QStringList or BluetoothRemoteDeviceList?
00418 QStringList Solid::Control::BluetoothInterface::listRemoteDevices() const
00419 {
00420     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QStringList(),
00421                       listRemoteDevices());
00422 }
00423 
00424 // TODO: QStringList or BluetoothRemoteDeviceList?
00425 QStringList Solid::Control::BluetoothInterface::listRecentRemoteDevices(const QDateTime &date) const
00426 {
00427     return_SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), QStringList(),
00428                       listRecentRemoteDevices(date));
00429 }
00430 
00431 */
00432 
00433 /***************************************************************/
00434 
00435 void Solid::Control::BluetoothInterface::setDiscoverable(bool status)
00436 {
00437     QVariant var(status);
00438     setProperty("Discoverable",var);
00439 }
00440 
00441 void Solid::Control::BluetoothInterface::setDiscoverableTimeout(int timeout)
00442 {
00443     QVariant var(timeout);
00444     setProperty("DiscoverableTimeout",var);
00445 }
00446 
00447 /*
00448 void Solid::Control::BluetoothInterface::setMinorClass(const QString &minor)
00449 {
00450     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), setMinorClass(minor));
00451 }
00452 */
00453 void Solid::Control::BluetoothInterface::setName(const QString &name)
00454 {
00455     QVariant var(name);
00456     setProperty("Name",var);
00457 }
00458 /*
00459 void Solid::Control::BluetoothInterface::discoverDevices()
00460 {
00461     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), discoverDevices());
00462 }
00463 
00464 void Solid::Control::BluetoothInterface::discoverDevicesWithoutNameResolving()
00465 {
00466     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), discoverDevicesWithoutNameResolving());
00467 }
00468 
00469 void Solid::Control::BluetoothInterface::cancelDiscovery()
00470 {
00471     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), cancelDiscovery());
00472 }
00473 
00474 void Solid::Control::BluetoothInterface::startPeriodicDiscovery()
00475 {
00476     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), startPeriodicDiscovery());
00477 }
00478 
00479 void Solid::Control::BluetoothInterface::stopPeriodicDiscovery()
00480 {
00481     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), stopPeriodicDiscovery());
00482 }
00483 
00484 void Solid::Control::BluetoothInterface::setPeriodicDiscoveryNameResolving(bool resolveNames)
00485 {
00486     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), setPeriodicDiscoveryNameResolving(resolveNames));
00487 }
00488 
00489 void Solid::Control::BluetoothInterface::setTrusted(const QString& address)
00490 {
00491     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), setTrusted(address));
00492 }
00493 
00494 void Solid::Control::BluetoothInterface::removeTrust(const QString& address)
00495 {
00496     SOLID_CALL(Ifaces::BluetoothInterface *, d->backendObject(), removeTrust(address));
00497 }
00498 
00499 */
00500 
00501 void Solid::Control::BluetoothInterfacePrivate::setBackendObject(QObject *object)
00502 {
00503     FrontendObjectPrivate::setBackendObject(object);
00504 
00505     if (object) {
00506 /*        
00507         QObject::connect(object, SIGNAL(modeChanged(Solid::Control::BluetoothInterface::Mode)),parent(), SIGNAL(modeChanged(Solid::Control::BluetoothInterface::Mode)));
00508         QObject::connect(object, SIGNAL(discoverableTimeoutChanged(int)),
00509                          parent(), SIGNAL(discoverableTimeoutChanged(int)));
00510         QObject::connect(object, SIGNAL(minorClassChanged(const QString &)),
00511                          parent(), SIGNAL(minorClassChanged(const QString &)));
00512         QObject::connect(object, SIGNAL(nameChanged(const QString &)),
00513                          parent(), SIGNAL(nameChanged(const QString &)));
00514         QObject::connect(object, SIGNAL(discoveryStarted()),
00515                          parent(), SIGNAL(discoveryStarted()));
00516         QObject::connect(object, SIGNAL(discoveryCompleted()),
00517                          parent(), SIGNAL(discoveryCompleted()));
00518         QObject::connect(object, SIGNAL(remoteDeviceFound(const QString &, int, int)),
00519                          parent(), SIGNAL(remoteDeviceFound(const QString &, int, int)));
00520         QObject::connect(object, SIGNAL(remoteDeviceDisappeared(const QString &)),
00521                          parent(), SIGNAL(remoteDeviceDisappeared(const QString &)));
00522         QObject::connect(object, SIGNAL(remoteNameUpdated(const QString &,const QString &)),
00523                          parent(), SIGNAL(remoteNameUpdated(const QString &,const QString &)));
00524         QObject::connect(object, SIGNAL(remoteDeviceConnected(const QString &)),
00525                          parent(), SIGNAL(remoteDeviceConnected(const QString &)));
00526         QObject::connect(object, SIGNAL(remoteDeviceDisconnected(const QString &)),
00527                          parent(), SIGNAL(remoteDeviceDisconnected(const QString &)));
00528         QObject::connect(object, SIGNAL(trustAdded(const QString &)),
00529                          parent(), SIGNAL(trustAdded(const QString &)));
00530         QObject::connect(object, SIGNAL(trustRemoved(const QString &)),
00531                          parent(), SIGNAL(trustRemoved(const QString &)));
00532         QObject::connect(object, SIGNAL(bondingCreated(const QString &)),
00533                          parent(), SIGNAL(bondingCreated(const QString &)));
00534         QObject::connect(object, SIGNAL(bondingRemoved(const QString &)),
00535                          parent(), SIGNAL(bondingRemoved(const QString &)));
00536 */
00537         QObject::connect(object, SIGNAL(deviceCreated(const QString &)),
00538                                  parent(), SIGNAL(deviceCreated(const QString &)));
00539         QObject::connect(object, SIGNAL(deviceDisappeared(const QString &)),
00540                                  parent(), SIGNAL(deviceDisappeared(const QString &)));
00541         QObject::connect(object, SIGNAL(deviceFound(const QString &, const QMap<QString,QVariant> &)),
00542                                  parent(), SIGNAL(deviceFound(const QString &, const QMap<QString,QVariant> &)));
00543         QObject::connect(object, SIGNAL(deviceRemoved(const QString &)),
00544                                  parent(), SIGNAL(deviceRemoved(const QString &)));
00545         QObject::connect(object, SIGNAL(propertyChanged(const QString &,const QVariant &)),
00546                                  parent(), SIGNAL(propertyChanged(const QString &, const QVariant &)));
00547 
00548     }
00549 }
00550 
00551 QPair<Solid::Control::BluetoothRemoteDevice *, Solid::Control::Ifaces::BluetoothRemoteDevice *> Solid::Control::BluetoothInterfacePrivate::findRegisteredBluetoothRemoteDevice(const QString &ubi) const
00552 {
00553     if (remoteDeviceMap.contains(ubi)) {
00554         return remoteDeviceMap[ubi];
00555     } else {
00556         Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(backendObject());
00557         Ifaces::BluetoothRemoteDevice *iface = 0;
00558 
00559         if (backend != 0) {
00560             iface = qobject_cast<Ifaces::BluetoothRemoteDevice *>(backend->createBluetoothRemoteDevice(ubi));
00561         }
00562 
00563         if (iface != 0) {
00564             BluetoothRemoteDevice *device = new BluetoothRemoteDevice(iface);
00565 
00566             QPair<BluetoothRemoteDevice *, Ifaces::BluetoothRemoteDevice *> pair(device, iface);
00567             remoteDeviceMap[ubi] = pair;
00568 
00569             return pair;
00570         } else {
00571             return QPair<BluetoothRemoteDevice *, Ifaces::BluetoothRemoteDevice *>(0, 0);
00572         }
00573 
00574     }
00575 }
00576 
00577 QPair<Solid::Control::BluetoothInputDevice *, Solid::Control::Ifaces::BluetoothInputDevice *> Solid::Control::BluetoothInterfacePrivate::findRegisteredBluetoothInputDevice(const QString &ubi) const
00578 {
00579     if (inputDeviceMap.contains(ubi)) {
00580         return inputDeviceMap[ubi];
00581     } else {
00582         Ifaces::BluetoothInterface *backend = qobject_cast<Ifaces::BluetoothInterface *>(backendObject());
00583         Ifaces::BluetoothInputDevice *iface = 0;
00584 
00585         if (backend != 0) {
00586             iface = qobject_cast<Ifaces::BluetoothInputDevice *>(backend->createBluetoothInputDevice(ubi));
00587         }
00588 
00589         if (iface != 0) {
00590             BluetoothInputDevice *device = new BluetoothInputDevice(iface);
00591 
00592             QPair<BluetoothInputDevice *, Ifaces::BluetoothInputDevice *> pair(device, iface);
00593             inputDeviceMap[ubi] = pair;
00594 
00595             return pair;
00596         } else {
00597             return QPair<BluetoothInputDevice *, Ifaces::BluetoothInputDevice *>(0, 0);
00598         }
00599 
00600     }
00601 }
00602 
00603 #include "bluetoothinterface.moc"

libsolidcontrol

Skip menu "libsolidcontrol"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal