1 /* This file is part of the KDE project
2 Copyright (C) 2007 Will Stephenson <wstephenson@kde.org>
3 Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 #ifndef SOLID_IFACES_BLUETOOTHINTERFACE_H
23 #define SOLID_IFACES_BLUETOOTHINTERFACE_H
25 #include <QtCore/QList>
26 #include "../solid_control_export.h"
28 #include "../bluetoothinterface.h"
29 #include "bluetoothremotedevice.h"
31 #include <QtCore/QObject>
40 * Represents a bluetooth interface as seen by the bluetooth subsystem.
42 class SOLIDCONTROLIFACES_EXPORT BluetoothInterface
: public QObject
47 * Create a BluetoothInterface.
49 * @param parent the parent object
51 BluetoothInterface(QObject
*parent
= 0);
54 * Destructs a BluetoothInterface object.
56 virtual ~BluetoothInterface();
59 * Retrieves the Universal Bluetooth Identifier (UBI) of the BluetoothInterface.
60 * This identifier is unique for each bluetooth remote device and bluetooth interface in the system.
62 * @returns the Universal Bluetooth Identifier of the current bluetooth interface
64 virtual QString
ubi() const = 0;
67 * Retrieves the MAC address of the bluetooth interface/adapter.
69 * @returns MAC address of bluetooth interface
71 //virtual QString address() const = 0;
74 * Retrieves the version of the chip of the bluetooth interface/adapter.
75 * Example: "Bluetooth 2.0 + EDR"
77 * @returns bluetooth chip version
79 //virtual QString version() const = 0;
82 * Retrieves the revision of the chip of the bluetooth interface/adapter.
85 * @returns bluetooth chip revision
87 //virtual QString revision() const = 0;
90 * Retrieves the name of the bluetooth chip manufacturer.
91 * Example: "Cambdirge Silicon Radio"
93 * @returns manufacturer string of bluetooth interface/adapter
95 //virtual QString manufacturer() const = 0;
98 * Retrieves the name of the bluetooth chip company.
99 * Based on device address.
101 * @returns company string of bluetooth interface/adapter
103 //virtual QString company() const = 0;
107 * Retrieves the current mode of the bluetooth interface/adapter.
108 * Valid modes: "off", "connectable", "discoverable"
110 * @todo determine unify type for valid modes.. enum?! what about other bluetooth APIs?
113 * @returns current mode of bluetooth interface/adaoter
115 //virtual Solid::Control::BluetoothInterface::Mode mode() const = 0;
118 * Retrieves the discoverable timeout of the bluetooth interface/adapter.
119 * Discoverable timeout of 0 means never disappear.
121 * @returns current discoverable timeout in seconds
123 //virtual int discoverableTimeout() const = 0;
126 * Retrieves the current discoverable staut of the bluetooth interface/adapter.
128 * @returns current discoverable status of bluetooth interface/adapter
130 //virtual bool isDiscoverable() const = 0;
134 * List all UBIs of connected remote bluetooth devices of this handled bluetooth
137 * @returns list UBIs of connected bluetooth remote devices
139 //virtual QStringList listConnections() const = 0;
143 * Retrieves major class of the bluetooth interface/adapter.
145 * @returns current major class of the bluetooth interface/adapter
147 //virtual QString majorClass() const = 0;
150 * List supported minor classes of the bluetooth interface/adapter.
152 * @returns list of supported minor classes by bluetooth interface/adapter
154 //virtual QStringList listAvailableMinorClasses() const = 0;
157 * Retrievies minor class of the bluetooth interface/adapter.
158 * Valid classes, see listAvailableMinorClasses()
160 * @returns minor class of the bluetooth interface/adapter.
162 //virtual QString minorClass() const = 0;
165 * List services class of the bluetooth interface/adapter.
167 * @returns list of service classes or empty list if no services registered
169 //virtual QStringList serviceClasses() const = 0;
171 * Retrieves name of bluetooth interface/adapter.
173 * @returns name of bluetooth interface/adapter
175 //virtual QString name() const = 0;
178 * Returns the name of the remote device, given its mac address (mac).
180 * @return the name of the remote device
182 //virtual QString getRemoteName(const QString & mac) = 0;
185 * List UBIs of bonded/paired remote bluetooth devices with this bluetooth
188 * @returns UBIs of bonded/paired bluetooth remote devices
190 //virtual QStringList listBondings() const = 0;
193 * Periodic discovery status of this bluetooth interface/adapter.
195 * @returns true if periodic discovery is already active otherwise false
197 //virtual bool isPeriodicDiscoveryActive() const = 0;
200 * Name resolving status of periodic discovery routing.
202 * @returns true if name got resolved while periodic discovery of this bluetooth
205 //virtual bool isPeriodicDiscoveryNameResolvingActive() const = 0;
208 * List the Universal Bluetooth Identifier (UBI) of all known remote devices, which are
209 * seen, used or paired/bonded.
211 * See listConnections()
213 * @returns a QStringList of UBIs of all known remote bluetooth devices
215 //virtual QStringList listRemoteDevices() const = 0;
218 * List the Universal Bluetooth Identifier (UBI) of all known remote devices since a specific
219 * datestamp. Known remote devices means remote bluetooth which are seen, used or
222 * See listConnections(), listRemoteDevices()
224 * @param date the datestamp of the beginning of recent used devices
225 * @returns a QStringList of UBIs of all known remote bluetooth devices
227 // virtual QStringList listRecentRemoteDevices(const QDateTime &date) const = 0;
230 * Returns true if the remote bluetooth device is trusted otherwise false.
232 * @param mac the address of the remote device
234 // virtual bool isTrusted(const QString &) = 0;
243 virtual void createPairedDevice(const QString
&, const QString
&, const QString
&) const = 0;
245 virtual QMap
< QString
, QVariant
> getProperties() const = 0;
247 virtual QStringList
listDevices() const = 0;
249 virtual QString
findDevice(const QString
&) const = 0;
251 //virtual QString createDevice(const QString &) const = 0;
252 virtual void createDevice(const QString
&) const = 0;
258 * Set mode of bluetooth interface/adapter.
259 * Valid modes, see mode()
261 * @param mode the mode of the bluetooth interface/adapter
263 //virtual void setMode(const Solid::Control::BluetoothInterface::Mode mode) = 0;
266 * Set discoverable timeout of bluetooth interface/adapter.
268 * @param timeout timeout in seconds
270 //virtual void setDiscoverableTimeout(int timeout) = 0;
273 * Set minor class of bluetooth interface/adapter.
275 * @param minor set minor class. Valid mode see listAvaliableMinorClasses()
277 //virtual void setMinorClass(const QString &minor) = 0;
280 * Set name of bluetooth interface/adapter.
282 * @param name the name of bluetooth interface/adapter
284 //virtual void setName(const QString &name) = 0;
288 * Start discovery of remote bluetooth devices with device name resolving.
290 //virtual void discoverDevices() = 0;
292 * Start discovery of remote bluetooth devices without device name resolving.
294 //virtual void discoverDevicesWithoutNameResolving() = 0;
296 * Cancel discovery of remote bluetooth devices.
298 //virtual void cancelDiscovery() = 0;
301 * Start periodic discovery of remote bluetooth devices.
302 * See stopPeriodicDiscovery()
304 //virtual void startPeriodicDiscovery() = 0;
307 * Stop periodic discovery of remote bluetooth devices.
309 //virtual void stopPeriodicDiscovery() = 0;
312 * Enable/Disable name resolving of remote bluetooth devices in periodic discovery.
314 * @param resolveName true to enable name resolving otherwise false
316 //virtual void setPeriodicDiscoveryNameResolving(bool resolveNames) = 0;
319 * Instantiates a new BluetoothRemoteDevice object from this backend given its address.
321 * @param ubi the identifier of the bluetooth remote device instantiated
322 * @returns a new BluetoothRemoteDevice object if there's a device having the given UBI, 0 otherwise
324 virtual QObject
*createBluetoothRemoteDevice(const QString
&ubi
) = 0;
326 virtual QObject
*createBluetoothInputDevice(const QString
&ubi
) = 0;
329 * Marks the device as trusted.
331 * @param mac the address of the remote device
333 //virtual void setTrusted(const QString &) = 0;
336 * Marks the device as not trusted.
338 * @param mac the address of the remote device
340 //virtual void removeTrust(const QString &) = 0;
342 virtual void registerAgent(const QString
&,const QString
&) = 0;
344 virtual void releaseSession() = 0;
346 virtual void removeDevice(const QString
&) = 0;
348 virtual void requestSession() = 0;
350 virtual void setProperty(const QString
&, const QVariant
&) = 0;
352 virtual void startDiscovery() = 0;
354 virtual void stopDiscovery() = 0;
356 virtual void unregisterAgent(const QString
&) = 0;
358 virtual void cancelDeviceCreation(const QString
&) = 0;
364 * This signal is emitted if the mode of the bluetooth interface/adapter has changed.
365 * See mode() for valid modes.
367 * @param mode the changed mode
369 //void modeChanged(Solid::Control::BluetoothInterface::Mode);
372 * The signal is emitted if the discoverable timeout of the bluetooth interface/adapter
375 * @param timeout the changed timeout in seconds
377 //void discoverableTimeoutChanged(int timeout);
380 * The signal is emitted if the minor class of the bluetooth interface/adapter has changed.
382 * @param minor the new minor class
384 //void minorClassChanged(const QString &minor);
387 * The signal is emitted if the name of the bluetooth interface/adapter has changed.
389 * @param name the new name of the device
391 //void nameChanged(const QString &name);
394 * This signal is emitted if a discovery has started.
396 //void discoveryStarted();
399 * This signal is emitted if a discovery has completed.
401 //void discoveryCompleted();
404 * This signal is emitted if the bluetooth interface/adapter detects a new remote bluetooth device.
406 * @todo change arguments types of deviceClass (uint32) and rssi (int16)
408 * @param ubi the new bluetooth identifier
409 * @param deviceClass the device Class of the remote device
410 * @param rssi the RSSI link of the remote device
412 //void remoteDeviceFound(const QString &ubi, int deviceClass, int rssi);
415 * This signal is emitted if the bluetooth interface/adapter detectes a bluetooth device
418 * @param ubi the ubi of the disappering bluetooth remote device
420 //void remoteDeviceDisappeared(const QString &ubi);
423 * This signal is emitted if the bluetooth interface/adapter detectes a new name for a
426 * @param address the address of the bluetooth remote device
427 * @param name the name of the bluetooth remote device
429 //void remoteNameUpdated(const QString &address, const QString &name);
432 * This signal is emitted if a bluetooth connection has been created.
434 * @param address the address of the connected bluetooth remote device
436 //void remoteDeviceConnected(const QString &address);
439 * This signal is emitted if a bluetooth connection has been terminated.
441 * @param address the address of the disconnected bluetooth remote device
443 //void remoteDeviceDisconnected(const QString &address);
446 * This signal is emitted if a bluetooth device was set trusted.
448 * @param address the address of the trusted bluetooth remote device
450 //void trustAdded(const QString &address);
453 * This signal is emitted if the trust to the bluetooth device was removed.
455 * @param address the address of the bluetooth remote device
457 //void trustRemoved(const QString &address);
460 * This signal is emitted if a successful bonding has been created.
462 * @param address the address of the bluetooth remote device
464 //void bondingCreated(const QString &address);
467 * This signal is emitted if the bonding to a bluetooth device has been removed.
469 * @param address the address of the bluetooth remote device
471 //void bondingRemoved(const QString &address);
474 * This signal is emitted when a remote device is created.
476 * @param ubi the object path of the device on the system bus
478 void deviceCreated(const QString
&ubi
);
481 * This signal is emitted when an inquiry session for a periodic discovery finishes and previously found
482 * devices are no longer in range or visible.
484 * @param address the address of the remote device
486 void deviceDisappeared(const QString
&address
);
489 * This signal will be emitted every time an inquiry result has been found by the service daemon.
490 * In general they only appear during a device discovery.
492 * @param address the address of the remote device
493 * @param properties the properties of the remote device
495 void deviceFound(const QString
&address
, const QMap
< QString
,QVariant
> &properties
);
498 * This signal is emitted when a remote device is removed from the system bus.
500 * @param ubi the object path on the system bus from the remote device
502 void deviceRemoved(const QString
&ubi
);
505 * This signal is emitted when a property of the adapter is set to a new value.
507 * @param property the named property of the adapter
508 * @value the new value for the property
510 void propertyChanged(const QString
&property
, const QVariant
&value
);
518 Q_DECLARE_INTERFACE(Solid::Control::Ifaces::BluetoothInterface
, "org.kde.Solid.Control.Ifaces.BluetoothInterface/0.1")