summaryrefslogtreecommitdiffstats
path: root/src/bluetooth/qbluetoothlocaldevice.cpp
diff options
context:
space:
mode:
authorTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-09-01 15:32:15 +0200
committerTimur Pocheptsov <Timur.Pocheptsov@digia.com>2014-09-16 09:12:06 +0200
commit982eeb3547f85dc76e5864559ee56db74a7dd86f (patch)
tree721e0d1a6e36ffb876e9c38adab780e56bd29779 /src/bluetooth/qbluetoothlocaldevice.cpp
parentbacabbcd91f018328eb0cec468c522599f614f6f (diff)
Port QBluetoothLocalDevice and QBluetoothDeviceDiscoveryAgent to OS X.
QBluetoothLocalDevice and QBluetoothDeviceDiscoveryAgent for OS X - Bluetooth Classic (the implementation based on IOBluetooth). + a very simple non-gui test (requires QApplication to work though). Update 0: style issues reported by Qt-Bot + fix a test. Update 1: QBluetoothLocalDevice - display confirmation Update 2: Device discovery agent - follow the expected logic and apply suggested fixes. Update 3: started/finished delegate methods seems to be synchronous and immediately follow start/stop calls on an inquiry. Update 4: remove unused function and redundant error message. Update 5: the first attempt to fix pairingStatus/requestPairing on a local device. Update 6: on OS X it's impossible (with a given public API) to request 'Unpaired'. I was only able to find some quite terrible hacks with private APIs or even worse - playing with SystemConfiguration frameworks and changing System Preferencies programmatically (requires authorization and looks like a total hack, since it has nothing to do with Bluetooth framework). Update 7: A very limited support for deviceConnected and connectedDevices. Update 8: Fix an invalid invokeMethod's argument. Update 9: Subject changed. Update 10: fixes in a documentation. Update 11: asserts in a coding convetion/style. Update 12: "fix" asserts + emit errors if a start/stop failed. Update 13: deviceDisconnected implemented. Update 14: use not only paired && connected devices (QBluetoothLocalDevice::connectedDevices), but also devices discovered by the connection monitor. Update 15: remove a test, not required (there are 'auto' tests). Update 16: fix private headers - they MUST have _p suffix :( Update 17: tests are known to fail (at the moment) - IOBluetooth requires adjustment (QApplication instead of QCoreApplication, lack of ability to power on/off a device (not possible on Mac) + other things). Change-Id: Iea1c8a98f1fd719f4560ec8920d00cc07eaa8146 Reviewed-by: Alex Blasche <alexander.blasche@digia.com> Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice.cpp')
-rw-r--r--src/bluetooth/qbluetoothlocaldevice.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice.cpp b/src/bluetooth/qbluetoothlocaldevice.cpp
index fa700c6a..0e2ef1ab 100644
--- a/src/bluetooth/qbluetoothlocaldevice.cpp
+++ b/src/bluetooth/qbluetoothlocaldevice.cpp
@@ -91,6 +91,7 @@ QT_BEGIN_NAMESPACE
only made discoverable for a limited period of time. This can speed up discovery between gaming devices,
as service discovery can be skipped on devices not in LimitedInquiry mode. In this mode, the device will
be connectable and powered on, if required. This mode is is not supported on Android.
+ On OS X, it is not possible to set the \l hostMode() to HostConnectable or HostPoweredOff.
*/
@@ -107,6 +108,9 @@ public:
} _registerLocalDeviceMetaTypes;
}
+
+#ifndef QT_OSX_BLUETOOTH
+
/*!
Destroys the QBluetoothLocalDevice.
*/
@@ -134,6 +138,8 @@ bool QBluetoothLocalDevice::isValid() const
return false;
}
+#endif
+
/*!
\fn void QBluetoothLocalDevice::setHostMode(QBluetoothLocalDevice::HostMode mode)
@@ -142,13 +148,16 @@ bool QBluetoothLocalDevice::isValid() const
\note Due to varying security policies on the supported platforms, this method may have
differing behaviors on the various platforms. For example the system may ask the user for
confirmation before turning Bluetooth on or off and not all host modes may be supported.
+ On OS X, it is not possbile to programmatically change the \l hostMode().
+ A user can only switch Bluetooth on/off in the System Preferences.
Please refer to the platform specific Bluetooth documentation for details.
*/
/*!
\fn QBluetoothLocalDevice::HostMode QBluetoothLocalDevice::hostMode() const
- Returns the current host mode of this local Bluetooth device.
+ Returns the current host mode of this local Bluetooth device. On OS X, it is either
+ HostPoweredOff or HostConnectable.
*/
/*!
@@ -166,7 +175,8 @@ bool QBluetoothLocalDevice::isValid() const
/*!
\fn QList<QBluetoothLocalDevice> QBluetoothLocalDevice::allDevices()
- Returns a list of all available local Bluetooth devices.
+ Returns a list of all available local Bluetooth devices. On OS X, there is
+ only the "default" local device.
*/
/*!
@@ -177,6 +187,7 @@ bool QBluetoothLocalDevice::isValid() const
\note Due to varying security policies on the supported platforms, this method may have
differing behaviors on the various platforms. For example
the system may ask the user for confirmation before turning Bluetooth on or off.
+ On OS X it is not possible to power on/off Bluetooth.
Please refer to the platform specific Bluetooth documentation for details.
*/
@@ -217,7 +228,7 @@ bool QBluetoothLocalDevice::isValid() const
Returns the list of connected devices. This list is different from the list of currently
paired devices.
- On Android it is not possible to retrieve a list of connected devices. It is only possible to
+ On Android and OS X, it is not possible to retrieve a list of connected devices. It is only possible to
listen to (dis)connect changes. For convenience, this class monitors all connect
and disconnect events since its instanciation and returns the current list when calling this function.
Therefore it is possible that this function returns an empty list shortly after creating an
@@ -240,6 +251,8 @@ bool QBluetoothLocalDevice::isValid() const
must be called to indicate if the user accepts or rejects the displayed pin.
This signal is only emitted for pairing requests issues by calling \l requestPairing().
+ On OS X, this method never gets called - there is a callback with a PIN (IOBluetooth),
+ but it expects immediate reply yes/no - and there is no time to show any dialog or compare PINs.
\sa pairingConfirmation()
*/
@@ -267,6 +280,11 @@ bool QBluetoothLocalDevice::isValid() const
Set the \a pairing status with \a address. The results are returned by the signal, pairingFinished().
On BlackBerry AuthorizedPaired is not possible and will have the same behavior as Paired.
+
+ On OS X, it is not possible to unpair a device. If Unpaired is requested, \l pairingFinished()
+ is immediately emitted although the device remains paired. It is possible to request the pairing
+ for a previously unpaired device. In addition \l AuthorizedPaired has the same behavior as \l Paired.
+
Caution: creating a pairing may take minutes, and may require the user to acknowledge.
*/