• Skip to content
  • Skip to link menu
KDE 4.2 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     return true;
00138     }
00139 
00140     void injectDevice(const QString &, FakeBluetoothRemoteDevice *);
00141 private:
00142     int mTimeout;
00143     QString mName;
00144     QString mUbi;
00145     QString mAddress;
00146     QString mVersion;
00147     QString mRevision;
00148     QString mManufacturer;
00149     QString mCompany;
00150     Solid::Control::BluetoothInterface::Mode mMode;
00151     int mDiscoverableTimeout;
00152     bool mDiscoverable;
00153     QStringList mConnections;
00154     QString mMajorClass;
00155     QStringList mMinorClasses;
00156     QString mMinorClass;
00157     QStringList mServiceClasses;
00158     QStringList mBondings;
00159     bool mPeriodicDiscovery;
00160     bool mPeriodicDiscoveryNameResolving;
00161     QStringList mRemoteDevices;
00162     QStringList mRecentRemoteDevices;
00163     QString mSetTrusted;
00164     QString mRemoveTrust;
00165 
00166 
00167 public Q_SLOTS:
00168     void setMode(const Solid::Control::BluetoothInterface::Mode mode)
00169     {
00170         mMode = mode; /* emit modeChanged(mMode); */
00171     }
00172     void setDiscoverableTimeout(int timeout)
00173     {
00174         mTimeout = timeout;
00175     }
00176     void setMinorClass(const QString &minorClass)
00177     {
00178         mMinorClass = minorClass;
00179     }
00180     void setName(const QString &name)
00181     {
00182         mName = name;
00183     }
00184     void discoverDevices();
00185     void discoverDevicesWithoutNameResolving()
00186     {}
00187     void cancelDiscovery()
00188     {}
00189     void startPeriodicDiscovery()
00190     {}
00191     void stopPeriodicDiscovery()
00192     {}
00193     void setPeriodicDiscoveryNameResolving(bool resolving)
00194     {
00195         mPeriodicDiscoveryNameResolving = resolving;
00196     }
00197     void setTrusted(const QString& mac) 
00198     {
00199     mSetTrusted = mac;
00200     }
00201     void removeTrust(const QString& mac) 
00202     {
00203     mRemoveTrust = mac;
00204     }
00205 
00206 Q_SIGNALS:
00207     void modeChanged(Solid::Control::BluetoothInterface::Mode mode);
00208     void discoverableTimeoutChanged(int timeout);
00209     void minorClassChanged(const QString &minor);
00210     void nameChanged(const QString &name);
00211     void discoveryStarted();
00212     void discoveryCompleted();
00213     void remoteDeviceFound(const QString &ubi, int deviceClass, int rssi);
00214     void remoteDeviceDisappeared(const QString &ubi);
00215 
00216     void remoteNameUpdated(const QString &address, const QString &name);
00217     void remoteDeviceConnected(const QString &address);
00218     void remoteDeviceDisconnected(const QString &address);
00219     void trustAdded(const QString &address);
00220     void trustRemoved(const QString &address);
00221     void bondingCreated(const QString &address);
00222     void bondingRemoved(const QString &address);
00223 protected:
00224     /* These methods are operations that are carried out by the manager
00225        In a real backend they would be events coming up from the network layer */
00226     void injectBluetooth(const QString  & ubi, FakeBluetoothRemoteDevice * device);
00227     QMap<QString, FakeBluetoothRemoteDevice *> mBluetoothRemoteDevices;
00228     QMap<QString, QVariant> mPropertyMap;
00229 };
00230 
00231 #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
  •   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