Manolis Anastasiou
Manolis Anastasiou

Reputation: 11

Android ble, requestConnectionPriority not working

I am trying to send 10 bytes of data, every 30milisecond,s between 2 android devices using bluetooth low enegry notifications. The goal is to achieve low latency communication and there is no interest in low energy.

You can check the results in the Delay graph(Y field = delta time between packets). The first 10seconds the communication is being perfomed good enough. (The interval between the packets is max 30-40ms). However after the 10th second, the intervals are either extremly high or extremely low.

This is probably happenning due to non strict connection interval parameters. You can check a sample of hci_events that shows clearly the slow down is caused by the hci_events.

I have tried to configure the parameters of the connection, calling from the master the function

requestConnectionPriority

However, it didn't change anything on the result graph. I also check the packets using wireshark and findout that the master didn't even send a request for configuring the connection interval. I also tried another configuration request with

requestMtu

with exactly the same results, no update packets was send from the master.

So, there are 2 questions that show up from this observations.

Note that requestConnectionPriority is called right after the connection being establish in the onConnectionStateChange of the BluetoothGattCallback.

The device that has role of a slave(server) is running (Android 5.1.1) and the master(client) is running (Android 6.0.1).

Thanks a lot!

IMPORTANT UPDATE: It's crucial to mention the way the connection is being initiated between the devices.

Upvotes: 1

Views: 4659

Answers (1)

Emil
Emil

Reputation: 18442

Has ble a timeout in the 10th second in order to ensure low energy consumption? If so, how can I disable it?

No

Is some thing wrong calling requestConnectionPriority, from the android 6.0.1 with the role of the central(master)? Can you give me a simple example on how is being called properly?

I'm not aware of any bugs regarding requestConnectionPriority. But you could try to execute that method after the onServicesDiscovered callback. Android temporarily changes connection interval to 7.5 ms during the GATT service discovery so it might be confused if you don't wait until the service discovery is completed.

Regarding requestMtu, make sure you execute that method while there are no other GATT operations pending (otherwise it won't work).

One additional tip is to use an air sniffer and not only look at the hci logs.

Upvotes: 1

Related Questions