[PATCH] Bluetooth support for Android

Thiago Macieira thiago at macieira.org
Tue Jul 14 15:47:17 PDT 2015


On Monday 13 July 2015 23:53:56 Claudiu Olteanu wrote:
> I attached some patches which can be used to fix the issues 
> related to Bluetooth connectivity on Android platforms.
> 
> On Android, a connection to a service cannot be established 
> using a port. The first patch should fix this issue using the uuid 
> of the SPP service on the connection step.

Hi Claudiu

Is this method supposed to work elsewhere too? Is there a reason not to use it 
everywhere?

> On my device with a Android 5.1.1 I observed that if I start the 
> download process without waiting for the scanning process to 
> end, then the devices gets stuck after downloading a few 
> packages. I did over 20 tests for both my dive computers 
> (HW OSTC2 and HW OSTCs) and I got the same results.

> I looked over the Android logs using the logcat tool and I saw 
> that the download mode always gets stuck when the scanning 
> process is stopped. I am not sure if this is a bug on the Android 
> platform, or on the Qt framework. 
> You can find some logs below.

It would be interesting to test whether this happens on other Android devices 
too, especially those using BlueZ instead of Bluedroid.

Thanks for the patches. Comments on them:

> +       if (serial_port->socket->state() ==
> QBluetoothSocket::ConnectingState || 
> +               // It seems that the connection step took more than
> expected. Wait another 20 seconds.
> +               qDebug() << "The connection step took more than expected.
> Wait another 20 seconds";
> +               timer.start(4 * msec);
> +               loop.exec();
> +       }

What's the use for this? How likely is answering in 20 seconds when in 5 it 
didn't answer? If 25 seconds is better, why not always wait for 25 seconds?

> +#if defined(Q_OS_ANDROID)
> +               if (remoteDeviceDiscoveryAgent->isActive()) {
> +                       ui->dialogStatus->setText(QString("The device %1 can
> be used for connection. Wait until the device scanning is done and press
> the Save button.") 
> +                                                
> .arg(remoteDeviceInfo.address().toString()));
> +                       return;
> +               }
> +#endif

Please add a simple comment to the source code why this is done, in addition 
to the commit. Something like "// on Android, the device gets stuck in if we 
try to use it before discovery is done"
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the subsurface mailing list