Changeset a43cafa in subsurface


Ignore:
Timestamp:
Jun 12, 2017, 10:58:57 AM (4 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
5142d74
Parents:
ca59dbd
git-author:
Jan Mulder <jlmulder@…> (06/12/17 00:36:26)
git-committer:
Dirk Hohndel <dirk@…> (06/12/17 10:58:57)
Message:

Mobile: do not BT Discover on Android (Q_OS_ANDROID vs Q_OS_LINUX)

This seems a very trivial commit, but it is not. It appears that on an Android
build, with defined(Q_OS_ANDROID) the Q_OS_LINUX variable is also defined.

This results in a very tricky discovery process: 1) the JNI stuff pulls the paired
devices from the local BT controller, and 2) The QT discovry agent gets active
BT devices. 1) is a static list, that is, not dependent on actual
visual/discoverable BT devices; it is just cached data from the phone. 2) On
Android, this results in a list of actively visible (paired and not paired)
devices. On desktop, however (with QT/bluez BT stack) the QT discovery agent
just gets the list of paired devices, so more or less equivalent to the situation
described under 1) for Android.

Ok, a long story, but just do not do a discovery on Android at all. Basically,
we need the BT address, device name, and possibly a specific SPP service UUID. This are
fixed and known for HW and Shearwater at this point, so there is no need for a
(lengthy) discovery process, and making sure the the dive computer is discoverable
at the moment the app wants to construct its data to show in the UI. So, the
static list of paired devices is all we need.

Signed-off-by: Jan Mulder <jlmulder@…>
Signed-off-by: Dirk Hohndel <dirk@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/btdiscovery.cpp

    rca59dbd ra43cafa  
    2020                btPairedDevices.clear();
    2121                qDebug() <<  "localDevice " + localBtDevice.name() + " is valid, starting discovery";
    22 #if defined(Q_OS_LINUX)
     22#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
    2323                discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
    2424                connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BTDiscovery::btDeviceDiscovered);
     
    3131                        qDebug() << "Paired =" << btPairedDevices[i].name << btPairedDevices[i].address.toString();
    3232                }
    33 #if defined(Q_OS_LINUX)
     33#if defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID)
    3434                discoveryAgent->stop();
    3535#endif
Note: See TracChangeset for help on using the changeset viewer.