diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java | 2 | ||||
-rw-r--r-- | src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp | 4 | ||||
-rw-r--r-- | src/bluetooth/doc/src/bluetooth-index.qdoc | 2 | ||||
-rw-r--r-- | src/bluetooth/doc/src/bluetooth-le-overview.qdoc | 7 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothdeviceinfo.h | 3 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothhostinfo.cpp | 23 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothhostinfo.h | 5 | ||||
-rw-r--r-- | src/bluetooth/qbluetoothuuid.cpp | 3 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycharacteristic.cpp | 3 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller.cpp | 18 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller.h | 6 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_osx.mm | 8 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_osx_p.h | 1 | ||||
-rw-r--r-- | src/bluetooth/qlowenergycontroller_p.h | 2 | ||||
-rw-r--r-- | src/bluetooth/qlowenergydescriptor.cpp | 3 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyservice.cpp | 3 | ||||
-rw-r--r-- | src/bluetooth/qlowenergyservice.h | 2 | ||||
-rw-r--r-- | src/imports/bluetooth/qdeclarativebluetoothservice.cpp | 3 |
18 files changed, 74 insertions, 24 deletions
diff --git a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java index f6c41e31..e5711426 100644 --- a/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java +++ b/src/android/bluetooth/src/org/qtproject/qt5/android/bluetooth/QtBluetoothLE.java @@ -133,6 +133,8 @@ public class QtBluetoothLE { resetData(); // reset mBluetoothGatt, reusing same object is not very reliable // sometimes it reconnects and sometimes it does not. + if (mBluetoothGatt != null) + mBluetoothGatt.close(); mBluetoothGatt = null; break; case BluetoothProfile.STATE_CONNECTED: diff --git a/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp b/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp index 0c017e45..1eec9206 100644 --- a/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp +++ b/src/bluetooth/doc/snippets/doc_src_qtbluetooth.cpp @@ -190,7 +190,7 @@ void MyClass::characteristicChanged(const QLowEnergyCharacteristic &, const QByt void MyClass::btleSharedData() { - QBluetoothAddress remoteDevice; + QBluetoothDeviceInfo remoteDevice; //! [data_share_qlowenergyservice] QLowEnergyService *first, *second; @@ -213,7 +213,7 @@ void MyClass::btleSharedData() void MyClass::enableCharNotifications() { - QBluetoothAddress remoteDevice; + QBluetoothDeviceInfo remoteDevice; QLowEnergyService *service; QLowEnergyController *control = new QLowEnergyController(remoteDevice, this); control->connectToDevice(); diff --git a/src/bluetooth/doc/src/bluetooth-index.qdoc b/src/bluetooth/doc/src/bluetooth-index.qdoc index f5e76ff0..df7306b4 100644 --- a/src/bluetooth/doc/src/bluetooth-index.qdoc +++ b/src/bluetooth/doc/src/bluetooth-index.qdoc @@ -66,7 +66,7 @@ import statement in your \c .qml file: \section2 Guides \list \li \l {Qt Bluetooth Overview}{Classic Bluetooth Overview} - \li \l {Bluetooth Low Energy Overview} (Tech Preview) + \li \l {Bluetooth Low Energy Overview} \endlist \section2 Reference diff --git a/src/bluetooth/doc/src/bluetooth-le-overview.qdoc b/src/bluetooth/doc/src/bluetooth-le-overview.qdoc index 8cba2f64..909beae2 100644 --- a/src/bluetooth/doc/src/bluetooth-le-overview.qdoc +++ b/src/bluetooth/doc/src/bluetooth-le-overview.qdoc @@ -34,11 +34,9 @@ Low Energy devices. \tableofcontents - \section1 Technology Preview - The Qt Bluetooth Low Energy API was introduced by Qt 5.4. Since Qt 5.5 the API is frozen and a compatibility guarantee is given for future releases. - At the moment, Qt only supports the Bluetooth Low Energy central role. + At the moment, Qt supports the Bluetooth Low Energy central role. For more details on this limitation see below. \section1 What Is Bluetooth Low Energy @@ -166,9 +164,6 @@ Low Energy devices. and writing data stored on the device. The example code below is taken from the \l {heartlistener}{Heart Listener} example. - \note As of Qt 5.4 the Qt Bluetooth Low Energy API is in tech preview mode and supports Linux - with BlueZ 4.101 & 5.x. The minimal Linux kernel version is 3.5. - \section2 Establishing a Connection To be able to read and write the characteristics of the Bluetooth Low Energy peripheral device, diff --git a/src/bluetooth/qbluetoothdeviceinfo.h b/src/bluetooth/qbluetoothdeviceinfo.h index b64a9727..e543286d 100644 --- a/src/bluetooth/qbluetoothdeviceinfo.h +++ b/src/bluetooth/qbluetoothdeviceinfo.h @@ -241,6 +241,9 @@ private: Q_DECLARE_PRIVATE(QBluetoothDeviceInfo) }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QBluetoothDeviceInfo::CoreConfigurations) +Q_DECLARE_OPERATORS_FOR_FLAGS(QBluetoothDeviceInfo::ServiceClasses) + QT_END_NAMESPACE Q_DECLARE_METATYPE(QBluetoothDeviceInfo) diff --git a/src/bluetooth/qbluetoothhostinfo.cpp b/src/bluetooth/qbluetoothhostinfo.cpp index 1304f18a..f3671695 100644 --- a/src/bluetooth/qbluetoothhostinfo.cpp +++ b/src/bluetooth/qbluetoothhostinfo.cpp @@ -89,6 +89,29 @@ QBluetoothHostInfo &QBluetoothHostInfo::operator=(const QBluetoothHostInfo &othe } /*! + \since 5.5 + + Returns true if \a other is equal to this QBluetoothHostInfo, otherwise false. +*/ +bool QBluetoothHostInfo::operator==(const QBluetoothHostInfo &other) const +{ + if (d_ptr == other.d_ptr) + return true; + + return d_ptr->m_address == other.d_ptr->m_address && d_ptr->m_name == other.d_ptr->m_name; +} + +/*! + \since 5.5 + + Returns true if \a other is not equal to this QBluetoothHostInfo, otherwise false. +*/ +bool QBluetoothHostInfo::operator!=(const QBluetoothHostInfo &other) const +{ + return !operator==(other); +} + +/*! Returns the Bluetooth address as a QBluetoothAddress. */ QBluetoothAddress QBluetoothHostInfo::address() const diff --git a/src/bluetooth/qbluetoothhostinfo.h b/src/bluetooth/qbluetoothhostinfo.h index 8b0085b0..30e9e249 100644 --- a/src/bluetooth/qbluetoothhostinfo.h +++ b/src/bluetooth/qbluetoothhostinfo.h @@ -49,6 +49,9 @@ public: QBluetoothHostInfo &operator=(const QBluetoothHostInfo &other); + bool operator==(const QBluetoothHostInfo &other) const; + bool operator!=(const QBluetoothHostInfo &other) const; + QBluetoothAddress address() const; void setAddress(const QBluetoothAddress &address); @@ -62,4 +65,6 @@ private: QT_END_NAMESPACE +Q_DECLARE_METATYPE(QBluetoothHostInfo) + #endif diff --git a/src/bluetooth/qbluetoothuuid.cpp b/src/bluetooth/qbluetoothuuid.cpp index bbb9f652..cfce871c 100644 --- a/src/bluetooth/qbluetoothuuid.cpp +++ b/src/bluetooth/qbluetoothuuid.cpp @@ -587,9 +587,12 @@ QBluetoothUuid::QBluetoothUuid(quint32 uuid) */ QBluetoothUuid::QBluetoothUuid(quint128 uuid) { +QT_WARNING_PUSH +QT_WARNING_DISABLE_GCC("-Wstrict-aliasing") data1 = qFromBigEndian<quint32>(*reinterpret_cast<quint32 *>(&uuid.data[0])); data2 = qFromBigEndian<quint16>(*reinterpret_cast<quint16 *>(&uuid.data[4])); data3 = qFromBigEndian<quint16>(*reinterpret_cast<quint16 *>(&uuid.data[6])); +QT_WARNING_POP memcpy(data4, &uuid.data[8], 8); } diff --git a/src/bluetooth/qlowenergycharacteristic.cpp b/src/bluetooth/qlowenergycharacteristic.cpp index f0b78243..aba4a66b 100644 --- a/src/bluetooth/qlowenergycharacteristic.cpp +++ b/src/bluetooth/qlowenergycharacteristic.cpp @@ -64,9 +64,6 @@ QT_BEGIN_NAMESPACE format or range information specifying how the characteristic's value is to be\ interpreted. - \note This class is provided by Qt 5.4 as part of a Bluetooth Low Energy Tech Preview. - Some API elements may change until the final release of the feature. - \sa QLowEnergyService, QLowEnergyDescriptor */ diff --git a/src/bluetooth/qlowenergycontroller.cpp b/src/bluetooth/qlowenergycontroller.cpp index 79359345..44b6a6da 100644 --- a/src/bluetooth/qlowenergycontroller.cpp +++ b/src/bluetooth/qlowenergycontroller.cpp @@ -93,9 +93,6 @@ QT_BEGIN_NAMESPACE connection becomes invalid as soon as the controller disconnects from the remote Bluetooth Low Energy device. - \note This class is provided by Qt 5.4 as part of a Bluetooth Low Energy Tech Preview. - Some API elements may change until the final release of the feature. - \sa QLowEnergyService, QLowEnergyCharacteristic, QLowEnergyDescriptor */ @@ -385,6 +382,8 @@ quint16 QLowEnergyControllerPrivate::updateValueOfDescriptor( The controller uses the local default Bluetooth adapter for the connection management. + + \obsolete */ QLowEnergyController::QLowEnergyController( const QBluetoothAddress &remoteDevice, @@ -420,6 +419,7 @@ QLowEnergyController::QLowEnergyController( d->remoteDevice = remoteDeviceInfo.address(); d->localAdapter = QBluetoothLocalDevice().address(); d->addressType = QLowEnergyController::PublicAddress; + d->remoteName = remoteDeviceInfo.name(); } /*! @@ -434,6 +434,8 @@ QLowEnergyController::QLowEnergyController( \a localDevice specifies a local device that is not a local Bluetooth adapter, \l error() is set to \l InvalidBluetoothAdapterError once \l connectToDevice() is called. + + \obsolete */ QLowEnergyController::QLowEnergyController( const QBluetoothAddress &remoteDevice, @@ -480,6 +482,16 @@ QBluetoothAddress QLowEnergyController::remoteAddress() const } /*! + Returns the name of the remote Bluetooth Low Energy device. + + \since 5.5 + */ +QString QLowEnergyController::remoteName() const +{ + return d_ptr->remoteName; +} + +/*! Returns the current state of the controller. \sa stateChanged() diff --git a/src/bluetooth/qlowenergycontroller.h b/src/bluetooth/qlowenergycontroller.h index 1d29502b..c5a4acd3 100644 --- a/src/bluetooth/qlowenergycontroller.h +++ b/src/bluetooth/qlowenergycontroller.h @@ -71,17 +71,19 @@ public: }; explicit QLowEnergyController(const QBluetoothAddress &remoteDevice, - QObject *parent = 0); + QObject *parent = 0); // TODO Qt 6 remove ctor explicit QLowEnergyController(const QBluetoothDeviceInfo &remoteDevice, QObject *parent = 0); explicit QLowEnergyController(const QBluetoothAddress &remoteDevice, const QBluetoothAddress &localDevice, - QObject *parent = 0); + QObject *parent = 0); // TODO Qt 6 remove ctor ~QLowEnergyController(); QBluetoothAddress localAddress() const; QBluetoothAddress remoteAddress() const; + QString remoteName() const; + ControllerState state() const; RemoteAddressType remoteAddressType() const; diff --git a/src/bluetooth/qlowenergycontroller_osx.mm b/src/bluetooth/qlowenergycontroller_osx.mm index e3cf57b1..c4628069 100644 --- a/src/bluetooth/qlowenergycontroller_osx.mm +++ b/src/bluetooth/qlowenergycontroller_osx.mm @@ -151,6 +151,7 @@ QLowEnergyControllerPrivateOSX::QLowEnergyControllerPrivateOSX(QLowEnergyControl const QBluetoothDeviceInfo &deviceInfo) : q_ptr(q), deviceUuid(deviceInfo.deviceUuid()), + deviceName(deviceInfo.name()), isConnecting(false), lastError(QLowEnergyController::NoError), controllerState(QLowEnergyController::UnconnectedState), @@ -855,6 +856,13 @@ QBluetoothAddress QLowEnergyController::remoteAddress() const return osx_d_ptr->remoteAddress; } +QString QLowEnergyController::remoteName() const +{ + OSX_D_PTR; + + return osx_d_ptr->deviceName; +} + QLowEnergyController::ControllerState QLowEnergyController::state() const { OSX_D_PTR; diff --git a/src/bluetooth/qlowenergycontroller_osx_p.h b/src/bluetooth/qlowenergycontroller_osx_p.h index 96af6db0..1a4d5707 100644 --- a/src/bluetooth/qlowenergycontroller_osx_p.h +++ b/src/bluetooth/qlowenergycontroller_osx_p.h @@ -131,6 +131,7 @@ private: QLowEnergyController *q_ptr; QBluetoothUuid deviceUuid; + QString deviceName; // To be sure we set controller's state correctly // (Connecting or Connected) we have to know if we're // still inside connectToDevice - this is important, diff --git a/src/bluetooth/qlowenergycontroller_p.h b/src/bluetooth/qlowenergycontroller_p.h index ab90ab84..bb26a538 100644 --- a/src/bluetooth/qlowenergycontroller_p.h +++ b/src/bluetooth/qlowenergycontroller_p.h @@ -132,6 +132,8 @@ public: QBluetoothAddress remoteDevice; QBluetoothAddress localAdapter; + QString remoteName; + QLowEnergyController::ControllerState state; QLowEnergyController::Error error; QString errorString; diff --git a/src/bluetooth/qlowenergydescriptor.cpp b/src/bluetooth/qlowenergydescriptor.cpp index 16b5b02b..cf1f46fa 100644 --- a/src/bluetooth/qlowenergydescriptor.cpp +++ b/src/bluetooth/qlowenergydescriptor.cpp @@ -57,9 +57,6 @@ QT_BEGIN_NAMESPACE The \l {QLowEnergyService::descriptorWritten()} signal is emitted upon success. The cahced \l value() of this object is updated accordingly. - \note This class is provided by Qt 5.4 as part of a Bluetooth Low Energy Tech Preview. - Some API elements may change until the final release of the feature. - \sa QLowEnergyService, QLowEnergyCharacteristic */ diff --git a/src/bluetooth/qlowenergyservice.cpp b/src/bluetooth/qlowenergyservice.cpp index f7a73326..0781def5 100644 --- a/src/bluetooth/qlowenergyservice.cpp +++ b/src/bluetooth/qlowenergyservice.cpp @@ -159,9 +159,6 @@ QT_BEGIN_NAMESPACE related \l QLowEnergyController disconnecting from the device are shared the same way. - \note This class is provided by Qt 5.4 as part of a Bluetooth Low Energy Tech Preview. - Some API elements may change until the final release of the feature. - \sa QLowEnergyController, QLowEnergyCharacteristic, QLowEnergyDescriptor */ diff --git a/src/bluetooth/qlowenergyservice.h b/src/bluetooth/qlowenergyservice.h index 9b6e73f4..8d7f8a21 100644 --- a/src/bluetooth/qlowenergyservice.h +++ b/src/bluetooth/qlowenergyservice.h @@ -126,6 +126,8 @@ private: QObject *parent = 0); }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QLowEnergyService::ServiceTypes) + QT_END_NAMESPACE Q_DECLARE_METATYPE(QLowEnergyService::ServiceState) diff --git a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp index 84506ce9..297dfc82 100644 --- a/src/imports/bluetooth/qdeclarativebluetoothservice.cpp +++ b/src/imports/bluetooth/qdeclarativebluetoothservice.cpp @@ -68,7 +68,6 @@ \li deviceName \li serviceDescription \li serviceName - \li servicePort \li serviceProtocol \li serviceUuid \endlist @@ -160,6 +159,7 @@ void QDeclarativeBluetoothService::setDeviceAddress(const QString &newAddress) QBluetoothAddress address(newAddress); QBluetoothDeviceInfo device(address, QString(), QBluetoothDeviceInfo::ComputerDevice); d->m_service->setDevice(device); + emit detailsChanged(); } /*! @@ -177,6 +177,7 @@ QString QDeclarativeBluetoothService::serviceName() const void QDeclarativeBluetoothService::setServiceName(const QString &name) { d->m_service->setServiceName(name); + emit detailsChanged(); } |