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
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
;
41 Q_INTERFACES(Solid::Control::Ifaces::BluetoothInterface
)
43 FakeBluetoothInterface(const QMap
<QString
, QVariant
> & propertyMap
,
45 virtual ~FakeBluetoothInterface();
47 QObject
* createBluetoothRemoteDevice(const QString
& ubi
);
48 QStringList
bluetoothRemoteDevices() const;
55 QString
address() const
57 kDebug() ; return mAddress
;
59 QString
version() const
63 QString
revision() const
67 QString
manufacturer() const
71 QString
company() const
75 Solid::Control::BluetoothInterface::Mode
mode() const
79 int discoverableTimeout() const
81 return mDiscoverableTimeout
;
83 bool isDiscoverable() const
87 QStringList
listConnections() const
91 QString
majorClass() const
95 QStringList
listAvailableMinorClasses() const
99 QString
minorClass() const
103 QStringList
serviceClasses() const
105 return mServiceClasses
;
111 QStringList
listBondings() const
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
*);
140 QString mManufacturer
;
142 Solid::Control::BluetoothInterface::Mode mMode
;
143 int mDiscoverableTimeout
;
145 QStringList mConnections
;
147 QStringList mMinorClasses
;
149 QStringList mServiceClasses
;
150 QStringList mBondings
;
151 bool mPeriodicDiscovery
;
152 bool mPeriodicDiscoveryNameResolving
;
153 QStringList mRemoteDevices
;
154 QStringList mRecentRemoteDevices
;
157 void setMode(const Solid::Control::BluetoothInterface::Mode mode
)
159 mMode
= mode
; /* emit modeChanged(mMode); */
161 void setDiscoverableTimeout(int timeout
)
165 void setMinorClass(const QString
&minorClass
)
167 mMinorClass
= minorClass
;
169 void setName(const QString
&name
)
173 void discoverDevices();
174 void discoverDevicesWithoutNameResolving()
176 void cancelDiscovery()
178 void startPeriodicDiscovery()
180 void stopPeriodicDiscovery()
182 void setPeriodicDiscoveryNameResolving(bool resolving
)
184 mPeriodicDiscoveryNameResolving
= resolving
;
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
);
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
;