1 /* This file is part of the KDE project
2 Copyright (C) 2006 Will Stephenson <wstephenson@kde.org>
3 Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
4 Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
5 Copyright (C) 2008 Tom Patzig <tpatzig@suse.de>
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License version 2 as published by the Free Software Foundation.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
24 #ifndef SOLID_CONTROL_BLUETOOTHMANAGER_H
25 #define SOLID_CONTROL_BLUETOOTHMANAGER_H
27 #include <QtCore/QObject>
29 #include "singletondefs.h"
30 #include "solid_control_export.h"
32 #include "bluetoothinterface.h"
33 #include "bluetoothinputdevice.h"
43 class BluetoothManager
;
46 class BluetoothInterface
;
47 class BluetoothSecurity
;
49 typedef QList
<BluetoothInterface
> BluetoothInterfaceList
;
50 typedef QList
<BluetoothInputDevice
> BluetoothInputDeviceList
;
51 class BluetoothManagerPrivate
;
54 * This class specifies the interface a backend will have to implement in
55 * order to be used in the system.
57 * A bluetooth manager allow to query the underlying platform to discover the
58 * available bluetooth interfaces.
60 class SOLIDCONTROL_EXPORT BluetoothManager
: public QObject
63 SOLID_SINGLETON(BluetoothManager
)
67 * Retrieves the list of all the bluetooth interfaces Universal Bluetooth Identifiers (UBIs)
70 * @return the list of bluetooth interfaces available in this system
72 BluetoothInterfaceList
bluetoothInterfaces() const;
73 //QStringList bluetoothInterfaces() const;
76 * Retrieves the default bluetooth interface Universal Bluetooth Identifiers (UBIs)
79 * @return the UBI of the default bluetooth interface
81 QString
defaultInterface() const;
84 * Returns the UBI of the Bluetooth Interface given its name (e.g. 'hci0'),
85 * if found on the system.
87 * @return the found UBI of the named bluetooth interface
89 QString
findInterface(const QString
& name
) const;
93 * Find a new BluetoothInterface object given its UBI.
95 * @param ubi the identifier of the bluetooth interface to find
96 * @returns a valid BlueoothInterface object if there's a device having the given UBI, an invalid one otherwise
98 BluetoothInterface
findBluetoothInterface(const QString
& ubi
) const;
102 * Find a new BluetoothInputDevice object given its UBI.
104 * @param ubi the identifier of the bluetooth input device to find
105 * @returns a valid BlueoothInputDevice object if there's a device having the given UBI, an invalid one otherwise
107 // BluetoothInputDevice findBluetoothInputDevice(const QString & ubi) const;
110 * Retrieves the list of Universal Bluetooth Identifiers (UBIs) of bluetooth input devices
111 * which are configured in the system. Configured means also not connected devices.
113 * @return the list of bluetooth input devices configured in this system
115 //BluetoothInputDeviceList bluetoothInputDevices() const;
118 * Instantiates a new BluetoothInputDevice object from this backend given its UBI.
120 * @param ubi the identifier of the bluetooth input device instantiated
121 * @returns a new BluetoothInputDevice object if there's a device having the given UBI, 0 otherwise
123 //BluetoothInputDevice *createBluetoothInputDevice(const QString &ubi);
126 * Setup a new bluetooth input device.
128 * @param ubi the ubi of the bluetooth input device
129 * @returns the job handling of the operation.
131 //KJob *setupInputDevice(const QString &ubi);
134 * Gets an instance of BluetoothSecurity to handle pairing/authorization requests
136 //BluetoothSecurity *security(const QString &interface = QString());
140 * Remove the configuraiton of a bluetooth input device.
142 * @param ubi the bluetooth input device identifier
144 // void removeInputDevice(const QString & ubi);
148 * This signal is emitted when a new bluetooth interface is available.
150 * @param ubi the bluetooth interface identifier
152 void interfaceAdded(const QString
& ubi
);
155 * This signal is emitted when a bluetooth interface is not available anymore.
157 * @param ubi the bluetooth interface identifier
159 void interfaceRemoved(const QString
& ubi
);
162 * This signal is emitted when the default bluetooth interface changed.
164 * @param ubi the bluetooth interface identifier
166 void defaultInterfaceChanged(const QString
& ubi
);
169 * This signal is emitted when a new bluetooth input device got configured/created.
171 * @param ubi the bluetooth input device identifier
173 // void inputDeviceCreated(const QString & ubi);
176 * This signal is emitted when a bluetooth input device configuration is not available anymore.
178 * @param ubi the bluetooth input device identifier
180 // void inputDeviceRemoved(const QString & ubi);
187 BluetoothInterfaceList
buildDeviceList(const QStringList
& ubiList
) const;
189 Q_PRIVATE_SLOT(d
, void _k_interfaceAdded(const QString
&))
190 Q_PRIVATE_SLOT(d
, void _k_interfaceRemoved(const QString
&))
191 Q_PRIVATE_SLOT(d
, void _k_defaultInterfaceChanged(const QString
&))
192 Q_PRIVATE_SLOT(d
, void _k_interfaceDestroyed(QObject
*))
194 Q_PRIVATE_SLOT(d, void _k_inputDeviceCreated(const QString &))
195 Q_PRIVATE_SLOT(d, void _k_inputDeviceRemoved(const QString &))
196 Q_PRIVATE_SLOT(d, void _k_inputDeviceDestroyed(QObject *))
199 BluetoothManagerPrivate
* const d
;
200 friend class BluetoothManagerPrivate
;