diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-02-10 15:37:17 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-13 09:47:27 +0100 |
commit | 173d16efb54ccc152f19afb9b1c2a87915fb414b (patch) | |
tree | f07ce85ba2cb973e3c08f3ed84252d92ee1c16de /src/bluetooth/qbluetoothlocaldevice_p.h | |
parent | dd75b1f776695006ca96fd43f995c3ba0549b968 (diff) |
Port QtBluetooth to Android
This is a feature merge to dev targeting Qt 5.3.
Known issues:
-QTBUG-36754: QBluetoothServer::close() crashes
-QTBUG-36763: QBluetothTransferManager port to Android not possible
-QTBUG-36764: Improve QBluetoothLocalDevice::connectedDevices()
-QTBUG-36810: Remove direct use of Android action strings
The above issues and some other minor TODO's will be addressed
until final release time.
Task-number: QTBUG-33792
[ChangeLog][QtBluetooth][Android] QtBluetooth has been ported to
Android.
Change-Id: I31ba83e3b7d6aa68e7258b7e43235de7d1a6e68a
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/bluetooth/qbluetoothlocaldevice_p.h')
-rw-r--r-- | src/bluetooth/qbluetoothlocaldevice_p.h | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/bluetooth/qbluetoothlocaldevice_p.h b/src/bluetooth/qbluetoothlocaldevice_p.h index 76a7e460..61527d31 100644 --- a/src/bluetooth/qbluetoothlocaldevice_p.h +++ b/src/bluetooth/qbluetoothlocaldevice_p.h @@ -65,12 +65,58 @@ QT_END_NAMESPACE #include <QSocketNotifier> #include "qnx/ppshelpers_p.h" #endif +#ifdef QT_ANDROID_BLUETOOTH +#include <jni.h> +#include <QtAndroidExtras/QAndroidJniEnvironment> +#include <QtAndroidExtras/QAndroidJniObject> +#include <QtCore/QPair> +#endif QT_BEGIN_NAMESPACE class QBluetoothAddress; -#if defined(QT_BLUEZ_BLUETOOTH) +#ifdef QT_ANDROID_BLUETOOTH +class LocalDeviceBroadcastReceiver; +class QBluetoothLocalDevicePrivate : public QObject +{ + Q_OBJECT +public: + QBluetoothLocalDevicePrivate( + QBluetoothLocalDevice *q, + const QBluetoothAddress &address = QBluetoothAddress()); + ~QBluetoothLocalDevicePrivate(); + + QAndroidJniObject *adapter(); + void initialize(const QBluetoothAddress& address); + static bool startDiscovery(); + static bool cancelDiscovery(); + static bool isDiscovering(); + bool isValid() const; + + +private slots: + void processHostModeChange(QBluetoothLocalDevice::HostMode newMode); + void processPairingStateChanged(const QBluetoothAddress &address, + QBluetoothLocalDevice::Pairing pairing); + void processConnectDeviceChanges(const QBluetoothAddress &address, bool isConnectEvent); + void processDisplayConfirmation(const QBluetoothAddress &address, const QString &pin); + +private: + QBluetoothLocalDevice *q_ptr; + QAndroidJniObject *obj; + + int pendingPairing(const QBluetoothAddress &address); + +public: + LocalDeviceBroadcastReceiver *receiver; + bool pendingHostModeTransition; + QList<QPair<QBluetoothAddress, bool> > pendingPairings; + + QList<QBluetoothAddress> connectedDevices; +}; + +#elif defined(QT_BLUEZ_BLUETOOTH) class QBluetoothLocalDevicePrivate : public QObject, protected QDBusContext { |