And2014
And2014

Reputation: 1

Android Bluetooth LE scan all at once

Is there a way to scan all bt le ibeacons in Android 4.3/4.4 without having to use startLeScan in an async way?

I'm looking for a way to get the mac address and rssi values of all that ibeacons at once.

Is there any external lib or low level way to do that?

Many thanks for all your help.

Upvotes: 0

Views: 113

Answers (2)

Zakir
Zakir

Reputation: 2382

You should consider how the hardware works at the radio level.

When you call startLeScan(), it turns on the LE radio and it has vendor defined ON - OFF (sleep) cycles typically ranging from a few uSec to a ms.

The radio would be able to return a list of devices to the driver only after it has scanned for the relevant frequencies. This in no way can be accomplished in a synchronous manner. Hence you have to provide a callback - which gets fired depending upon the design: like burst of device list at the end of scan cycle OR incremental addition of devices to the list as discovery continues - Am not sure how Android does it - am speaking form a custom RTOS driver perspective

Edit:-
I have learnt about a design where the radio is ON all the time - off course that would mean a considerable hit to the power equation - but that allows the driver or hal layer to persist a running list of scanned devices. The tricky situation here would be to come up with the optimal remove from list policy

Upvotes: 1

Felipe Silveira
Felipe Silveira

Reputation: 533

I don't think there's a way to do that synchronously and if there is, I don't think it would be a good idea - you application would freeze, once the scan is a slow operation.

Upvotes: 0

Related Questions