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

libsolidcontrol

fakebluetoothinterface.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
00003 
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License version 2 as published by the Free Software Foundation.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 
00019 */
00020 
00021 #include <QStringList>
00022 #include <QTimer>
00023 
00024 #include "fakebluetoothinterface.h"
00025 #include "fakebluetoothremotedevice.h"
00026 
00027 #include <kdebug.h>
00028 
00029 FakeBluetoothInterface::FakeBluetoothInterface(const QMap<QString, QVariant>  & propertyMap, QObject * parent)
00030         : Solid::Control::Ifaces::BluetoothInterface(parent), mPropertyMap(propertyMap)
00031 {
00032     mAddress = mPropertyMap["address"].toString();
00033     mVersion = mPropertyMap["version"].toString();
00034     mRevision = mPropertyMap["revision"].toString();
00035     mManufacturer = mPropertyMap["manufacturer"].toString();
00036     mCompany = mPropertyMap["company"].toString();
00037     mMode = (Solid::Control::BluetoothInterface::Mode) mPropertyMap["mode"].toInt();
00038     mDiscoverableTimeout = mPropertyMap["discoverableTimeout"].toInt();
00039     mDiscoverable = mPropertyMap["isDiscoverable"].toBool();
00040     mConnections.append(mPropertyMap["connections"].toString());
00041     mMajorClass = mPropertyMap["majorClass"].toString();
00042     mMinorClasses.append(mPropertyMap["minorClasses"].toString());
00043     mMinorClass = mPropertyMap["minorClass"].toString();
00044     mServiceClasses.append(mPropertyMap["serviceClasses"].toString());
00045     mName = mPropertyMap["name"].toString();
00046     mBondings.append(mPropertyMap["bondings"].toString());
00047     mPeriodicDiscovery = mPropertyMap["isPeriodicDiscovery"].toBool();
00048     mPeriodicDiscoveryNameResolving = mPropertyMap["periodicDiscoveryNameResolving"].toBool();
00049     mRemoteDevices.append(mPropertyMap["remoteDevices"].toString());
00050     mRecentRemoteDevices.append(mPropertyMap["recentRemoteDevices"].toString());
00051 
00052     mUbi = mPropertyMap["ubi"].toString();
00053 }
00054 
00055 FakeBluetoothInterface::~FakeBluetoothInterface()
00056 {
00057     foreach (FakeBluetoothRemoteDevice *device, mBluetoothRemoteDevices) {
00058         kDebug() << "DEVICE: " << device->ubi();
00059         delete device;
00060     }
00061 
00062     mBluetoothRemoteDevices.clear();
00063 }
00064 
00065 QObject * FakeBluetoothInterface::createBluetoothRemoteDevice(const QString  & ubi)
00066 {
00067     if (mBluetoothRemoteDevices.contains(ubi)) {
00068         kDebug() << "found " << ubi;
00069         return mBluetoothRemoteDevices[ubi];
00070     } else {
00071         kDebug() << "NOT found " << ubi;
00072         return 0;
00073     }
00074 }
00075 
00076 QStringList FakeBluetoothInterface::bluetoothRemoteDevices() const
00077 {
00078     kDebug() ;
00079     return mBluetoothRemoteDevices.keys();
00080 }
00081 
00082 void FakeBluetoothInterface::discoverDevices()
00083 {
00084     kDebug() ;
00085     QTimer::singleShot(1000, this,
00086                        SIGNAL(remoteDeviceFound(QString("/org/kde/solid/fakebluetooth/hci0/EE:EE:EE:EE:EE:EE"),
00087                                                 0, 99)));
00088     QTimer::singleShot(5000, this,
00089                        SIGNAL(remoteDeviceFound(QString("/org/kde/solid/fakebluetooth/hci0/EE:FF:EE:FF:EE:FF"),
00090                                                 0, 42)));
00091 
00092 }
00093 
00094 /*************************************/
00095 
00096 void FakeBluetoothInterface::injectDevice(const QString &ubi , FakeBluetoothRemoteDevice *device)
00097 {
00098     mBluetoothRemoteDevices.insert(ubi, device);
00099 }
00100 
00101 #include "fakebluetoothinterface.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
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
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