Closed spike1212xie closed 2 years ago
You need to use requestConnectionPriority(..)
from theBleManager
. Only 3 options are possible, the same as when using native API, which the lib is using under the hood.
Thanks!I have saw it,but i have also use BluetoothGatt in my project,which also include a requestConnectionPriority.So I cant use requestConnectionPriority from the BleManager,or the another way of describing is that I dont know how to use requestConnectionPriority from the BleManager and BluetoothGatt in the same time. Another issue is,requestConnectionPriority in the BleManager is protected,so i cant use it.I try to use it by extends,but also cant work.
The last issue is that,the priority must be HIGH、BALANCE or LOW_POWER,so i cant set the interval to 3200 by using requestConnectionPriority from the BleManager?Cause the project use a device which cant be charge and only can use a button cell battery,and i want to make the device using less power.
If you're using the native API, this is the method: https://developer.android.com/reference/android/bluetooth/BluetoothGatt#requestConnectionPriority(int) The corresponding method from BleManager: https://github.com/NordicSemiconductor/Android-BLE-Library/blob/52d60a4de110b73faef05938ea31a699a9a38163/ble/src/main/java/no/nordicsemi/android/ble/BleManager.java#L1882-L1886 is calling the native method, so only the same 3 options are available. Here you have the values for each of the options: https://github.com/NordicSemiconductor/Android-BLE-Library/blob/52d60a4de110b73faef05938ea31a699a9a38163/ble/src/main/java/no/nordicsemi/android/ble/ConnectionPriorityRequest.java#L49-L82,
It is not possible to request a custom values for the connection parameters from Android. Unfortunately. But you can request them from the peripheral side.
thanks
I am learning and try to make a project,which using ble.But now i can only use requestConnectionPriority from BluetoothGatt.java to change interval,i wanna to change interval to 3200,which mean i cant be success.Today I find this lib,so can you tell me how can i use notifyConnectionPriorityChanged?I think its a solution to solve my issue.Because notifyConnectionPriorityChanged is not public,so cannot be accessed from outside package.