1

I have Laird BL6000 BLE device which I have connected with a sensor and configured to advertise data every 0.5 seconds.

Now I want to read this advertising data every 0.5 seconds.

I can read the data using startScanning() and access it data in uiOnLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) but this process takes about 2-3 seconds. I need to read this data faster than that.

If they have a minimum advertising time 0.5 seconds then there must be a method to read this data.

Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
AL̲̳I
  • 2,441
  • 4
  • 29
  • 50
  • That is not an application for scanning - you should connect to the peripheral. If you want scanning, you will need to advertise much more often than you expect to receive, as it is not a coordinated or reliable operation, but even then you are unlikely to achieve your goal, especially when you start using different phones. – Chris Stratton May 21 '15 at 11:13
  • When I connect to the peripheral, the BLE device stops advertising the data, hence only one connected device will be able to read the data. – AL̲̳I May 21 '15 at 11:18
  • That is what I mentioned in my question, scanning takes to long, I don't want scanning, I only want to read the advertising data. – AL̲̳I May 21 '15 at 11:22

1 Answers1

0

Are you using LeScanCallback to display the advertising packets?

onLeScan method you should receive the packets almost instantly. If you don't maybe your device is not advertising at the period you set.

Try printing a log with the scanRecord from the advertising packets you receive:

 private BluetoothAdapter.LeScanCallback mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
    @Override
    public void onLeScan(final BluetoothDevice device, final int rssi, final byte[] scanRecord) {
        Log.i("ON LE SCAN", "UUID: "+ byteArrayToHex(scanRecord));
    }
 };

You can also find HERE a full example on how to scan BLE devices and connect to them.

Good luck!

Community
  • 1
  • 1
kodartcha
  • 1,063
  • 12
  • 23