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

libsolidcontrol

fakebluetoothinterface.h

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 #ifndef FAKE_BLUETOOTH_INTERFACE_H
00022 #define FAKE_BLUETOOTH_INTERFACE_H
00023 
00024 #include <QString>
00025 #include <QVariant>
00026 
00027 #include <kdebug.h>
00028 
00029 #include <kdemacros.h>
00030 
00031 #include <solid/control/ifaces/bluetoothinterface.h>
00032 
00033 #include "fakebluetoothremotedevice.h"
00034 
00035 using namespace Solid::Control::Ifaces;
00036 
00037 class KDE_EXPORT FakeBluetoothInterface : public Solid::Control::Ifaces::BluetoothInterface
00038 {
00039     friend class FakeBluetoothManager;
00040     Q_OBJECT
00041     Q_INTERFACES(Solid::Control::Ifaces::BluetoothInterface)
00042 public:
00043     FakeBluetoothInterface(const QMap<QString, QVariant>  & propertyMap,
00044                            QObject *parent = 0);
00045     virtual ~FakeBluetoothInterface();
00046 
00047     QObject * createBluetoothRemoteDevice(const QString  & ubi);
00048     QStringList bluetoothRemoteDevices() const;
00049 
00050     QString ubi() const
00051     {
00052         return mUbi;
00053     }
00054 
00055     QString address() const
00056     {
00057         kDebug() ; return mAddress;
00058     }
00059     QString version() const
00060     {
00061         return mVersion;
00062     }
00063     QString revision() const
00064     {
00065         return mRevision;
00066     }
00067     QString manufacturer() const
00068     {
00069         return mManufacturer;
00070     }
00071     QString company() const
00072     {
00073         return mCompany;
00074     }
00075     Solid::Control::BluetoothInterface::Mode mode() const
00076     {
00077         return mMode;
00078     }
00079     int discoverableTimeout() const
00080     {
00081         return mDiscoverableTimeout;
00082     }
00083     bool isDiscoverable() const
00084     {
00085         return mDiscoverable;
00086     }
00087     QStringList listConnections() const
00088     {
00089         return mConnections;
00090     }
00091     QString majorClass() const
00092     {
00093         return mMajorClass;
00094     }
00095     QStringList listAvailableMinorClasses() const
00096     {
00097         return mMinorClasses;
00098     }
00099     QString minorClass() const
00100     {
00101         return mMinorClass;
00102     }
00103     QStringList serviceClasses() const
00104     {
00105         return mServiceClasses;
00106     }
00107     QString name() const
00108     {
00109         return mName;
00110     }
00111     QString getRemoteName(const QString &)
00112     {
00113     return "";
00114     }
00115     QStringList listBondings() const
00116     {
00117         return mBondings;
00118     }
00119     bool isPeriodicDiscoveryActive() const
00120     {
00121         return mPeriodicDiscovery;
00122     }
00123     bool isPeriodicDiscoveryNameResolvingActive() const
00124     {
00125         return mPeriodicDiscoveryNameResolving;
00126     }
00127     QStringList listRemoteDevices() const
00128     {
00129         return mRemoteDevices;
00130     }
00131     QStringList listRecentRemoteDevices(const QDateTime &) const
00132     {
00133         return mRecentRemoteDevices;
00134     }
00135     bool isTrusted(const QString& mac)
00136     {
00137     Q_UNUSED(mac)
00138     return true;
00139     }
00140 
00141     void injectDevice(const QString &, FakeBluetoothRemoteDevice *);
00142 private:
00143     int mTimeout;
00144     QString mName;
00145     QString mUbi;
00146     QString mAddress;
00147     QString mVersion;
00148     QString mRevision;
00149     QString mManufacturer;
00150     QString mCompany;
00151     Solid::Control::BluetoothInterface::Mode mMode;
00152     int mDiscoverableTimeout;
00153     bool mDiscoverable;
00154     QStringList mConnections;
00155     QString mMajorClass;
00156     QStringList mMinorClasses;
00157     QString mMinorClass;
00158     QStringList mServiceClasses;
00159     QStringList mBondings;
00160     bool mPeriodicDiscovery;
00161     bool mPeriodicDiscoveryNameResolving;
00162     QStringList mRemoteDevices;
00163     QStringList mRecentRemoteDevices;
00164     QString mSetTrusted;
00165     QString mRemoveTrust;
00166 
00167 
00168 public Q_SLOTS:
00169     void setMode(const Solid::Control::BluetoothInterface::Mode mode)
00170     {
00171         mMode = mode; /* emit modeChanged(mMode); */
00172     }
00173     void setDiscoverableTimeout(int timeout)
00174     {
00175         mTimeout = timeout;
00176     }
00177     void setMinorClass(const QString &minorClass)
00178     {
00179         mMinorClass = minorClass;
00180     }
00181     void setName(const QString &name)
00182     {
00183         mName = name;
00184     }
00185     void discoverDevices();
00186     void discoverDevicesWithoutNameResolving()
00187     {}
00188     void cancelDiscovery()
00189     {}
00190     void startPeriodicDiscovery()
00191     {}
00192     void stopPeriodicDiscovery()
00193     {}
00194     void setPeriodicDiscoveryNameResolving(bool resolving)
00195     {
00196         mPeriodicDiscoveryNameResolving = resolving;
00197     }
00198     void setTrusted(const QString& mac) 
00199     {
00200     mSetTrusted = mac;
00201     }
00202     void removeTrust(const QString& mac) 
00203     {
00204     mRemoveTrust = mac;
00205     }
00206 
00207 Q_SIGNALS:
00208     void modeChanged(Solid::Control::BluetoothInterface::Mode mode);
00209     void discoverableTimeoutChanged(int timeout);
00210     void minorClassChanged(const QString &minor);
00211     void nameChanged(const QString &name);
00212     void discoveryStarted();
00213     void discoveryCompleted();
00214     void remoteDeviceFound(const QString &ubi, int deviceClass, int rssi);
00215     void remoteDeviceDisappeared(const QString &ubi);
00216 
00217     void remoteNameUpdated(const QString &address, const QString &name);
00218     void remoteDeviceConnected(const QString &address);
00219     void remoteDeviceDisconnected(const QString &address);
00220     void trustAdded(const QString &address);
00221     void trustRemoved(const QString &address);
00222     void bondingCreated(const QString &address);
00223     void bondingRemoved(const QString &address);
00224 protected:
00225     /* These methods are operations that are carried out by the manager
00226        In a real backend they would be events coming up from the network layer */
00227     void injectBluetooth(const QString  & ubi, FakeBluetoothRemoteDevice * device);
00228     QMap<QString, FakeBluetoothRemoteDevice *> mBluetoothRemoteDevices;
00229     QMap<QString, QVariant> mPropertyMap;
00230 };
00231 
00232 #endif

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