Make a branch to make krunner Good Enough For Aaron™.
[kdebase/uwolfer.git] / workspace / libs / solid / control / backends / fakebluetooth / fakebluetoothinterface.h
blob87ea5a282136be9ee69b838ed47569ae627c17eb
1 /* This file is part of the KDE project
2 Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #ifndef FAKE_BLUETOOTH_INTERFACE_H
22 #define FAKE_BLUETOOTH_INTERFACE_H
24 #include <QString>
25 #include <QVariant>
27 #include <kdebug.h>
29 #include <kdemacros.h>
31 #include <solid/control/ifaces/bluetoothinterface.h>
33 #include "fakebluetoothremotedevice.h"
35 using namespace Solid::Control::Ifaces;
37 class KDE_EXPORT FakeBluetoothInterface : public Solid::Control::Ifaces::BluetoothInterface
39 friend class FakeBluetoothManager;
40 Q_OBJECT
41 Q_INTERFACES(Solid::Control::Ifaces::BluetoothInterface)
42 public:
43 FakeBluetoothInterface(const QMap<QString, QVariant> & propertyMap,
44 QObject *parent = 0);
45 virtual ~FakeBluetoothInterface();
47 QObject * createBluetoothRemoteDevice(const QString & ubi);
48 QStringList bluetoothRemoteDevices() const;
50 QString ubi() const
52 return mUbi;
55 QString address() const
57 kDebug() ; return mAddress;
59 QString version() const
61 return mVersion;
63 QString revision() const
65 return mRevision;
67 QString manufacturer() const
69 return mManufacturer;
71 QString company() const
73 return mCompany;
75 Solid::Control::BluetoothInterface::Mode mode() const
77 return mMode;
79 int discoverableTimeout() const
81 return mDiscoverableTimeout;
83 bool isDiscoverable() const
85 return mDiscoverable;
87 QStringList listConnections() const
89 return mConnections;
91 QString majorClass() const
93 return mMajorClass;
95 QStringList listAvailableMinorClasses() const
97 return mMinorClasses;
99 QString minorClass() const
101 return mMinorClass;
103 QStringList serviceClasses() const
105 return mServiceClasses;
107 QString name() const
109 return mName;
111 QStringList listBondings() const
113 return mBondings;
115 bool isPeriodicDiscoveryActive() const
117 return mPeriodicDiscovery;
119 bool isPeriodicDiscoveryNameResolvingActive() const
121 return mPeriodicDiscoveryNameResolving;
123 QStringList listRemoteDevices() const
125 return mRemoteDevices;
127 QStringList listRecentRemoteDevices(const QDateTime &) const
129 return mRecentRemoteDevices;
132 void injectDevice(const QString &, FakeBluetoothRemoteDevice *);
133 private:
134 int mTimeout;
135 QString mName;
136 QString mUbi;
137 QString mAddress;
138 QString mVersion;
139 QString mRevision;
140 QString mManufacturer;
141 QString mCompany;
142 Solid::Control::BluetoothInterface::Mode mMode;
143 int mDiscoverableTimeout;
144 bool mDiscoverable;
145 QStringList mConnections;
146 QString mMajorClass;
147 QStringList mMinorClasses;
148 QString mMinorClass;
149 QStringList mServiceClasses;
150 QStringList mBondings;
151 bool mPeriodicDiscovery;
152 bool mPeriodicDiscoveryNameResolving;
153 QStringList mRemoteDevices;
154 QStringList mRecentRemoteDevices;
156 public Q_SLOTS:
157 void setMode(const Solid::Control::BluetoothInterface::Mode mode)
159 mMode = mode; /* emit modeChanged(mMode); */
161 void setDiscoverableTimeout(int timeout)
163 mTimeout = timeout;
165 void setMinorClass(const QString &minorClass)
167 mMinorClass = minorClass;
169 void setName(const QString &name)
171 mName = name;
173 void discoverDevices();
174 void discoverDevicesWithoutNameResolving()
176 void cancelDiscovery()
178 void startPeriodicDiscovery()
180 void stopPeriodicDiscovery()
182 void setPeriodicDiscoveryNameResolving(bool resolving)
184 mPeriodicDiscoveryNameResolving = resolving;
187 Q_SIGNALS:
188 void modeChanged(Solid::Control::BluetoothInterface::Mode mode);
189 void discoverableTimeoutChanged(int timeout);
190 void minorClassChanged(const QString &minor);
191 void nameChanged(const QString &name);
192 void discoveryStarted();
193 void discoveryCompleted();
194 void remoteDeviceFound(const QString &ubi, int deviceClass, int rssi);
195 void remoteDeviceDisappeared(const QString &ubi);
197 protected:
198 /* These methods are operations that are carried out by the manager
199 In a real backend they would be events coming up from the network layer */
200 void injectBluetooth(const QString & ubi, FakeBluetoothRemoteDevice * device);
201 QMap<QString, FakeBluetoothRemoteDevice *> mBluetoothRemoteDevices;
202 QMap<QString, QVariant> mPropertyMap;
205 #endif