2

I am having trouble using the scanBleDevices method when passing it a (valid) UUID - the subscribe will never fire. Currently I have a working prototype using the usual android methods of scanning, connecting, read/write, but I want to update my syntax of RxAndroidBle to make things more safe and more easy to read.

Here is my RxAndroidBle implementation - not working / subscribe never fires:

enter image description here

You may be thinking that my UUID is wrong, but here is some alternative implementation that I did using a very stateful previous version - same uuid, this works:

enter image description here

mLeScanCallback will be fired.

I am using RxAndroidBle version 1.2.2 & my phone is a Nexus 6P android version 6.0.1

Some additional info: If I use scanBleDevices(), no parameters, I can find my desired rxBleScanResult by checking something in the manufacture data, which I will be doing anyway. But I would like to filter on the UUID too to be safe. When I had found my desired package bytes[] I tried to extract my UUID using the (deprecated) new UUIDUtil().extractUUIDs(rxBleScanResult.getScanRecord()), but this returned an empty list. And just to nail things down a little more, when I use the old fashioned mLeScanCallback, the above extractUUIDS is also resulting in an empty list.

Thanks for your time!

Ethan
  • 1,567
  • 11
  • 16

1 Answers1

1

This is actually a bug in the RxAndroidBle library. As one could see in the UUIDUtil (https://github.com/Polidea/RxAndroidBle/commit/ee59e0ab9ae3c483f5c4f35c7729e9fc2068ee21#diff-c7944d4c01c56adf4e6c67c7f7f737e8) — which is responsible for extracting service UUIDs from bluetooth advertisement — it was lacking of 32-bit UUIDs. The fix is added in a just released version 1.2.3.

Dariusz Seweryn
  • 3,212
  • 2
  • 14
  • 21
  • This works! Thanks s_noopy! I was wondering your opinion on the health of RxAndroidBle. They are very fast to repair things - however maybe it is not production ready? I love this library. I think I will go ahead with it anyway. – Ethan Jun 01 '17 at 19:33
  • So actually under the hood, filtering based on the ScanPackage byte array is the same as filtering on the scanBleDevices(UUID...) method? Oh well! – Ethan Jun 01 '17 at 19:35
  • This library is used on production already in several different projects and if your peripheral does not change services and does not use encrypted characteristics - it's ready to use - the above issues are next to tackle . I don't get the ScanPackage part. – Dariusz Seweryn Jun 02 '17 at 15:31