Reputation: 31
I very long Looking for but not found a answer, hot to change bluetooth connection parameter (Connection Interval, Slave Latency, Supervision Timeout) on Android (master) device. Must importent for me is Supervision Timeout becouse on android by defaut is 20 seconds and i need lessen, i find CONNECTION_PRIORITY_BALANCED
, CONNECTION_PRIORITY_HIGH
and CONNECTION_PRIORITY_LOW_POWER
but they dont change Supervision Timeout time,
or impossible to change connection parameter from Android (master)? Please help me. Thanks in advence.
Upvotes: 3
Views: 3529
Reputation: 881
Unfortunately, you are only allowed to do whatever API allows you. In most cases, mobile OS APIs do not allow you to do low level settings for the purpose of user friendly experience. Imagine you developed an app which uses connection parameters that drains battery... Then the user of your application would most probably complain about the OS provider or the OEM. This is not wanted and should be prevented. However, if you want to do low level changes for experimental reasons (research etc.), I would recommend you to download the Android API source code, do the changes and insert the custom ANdroid API to your phone (you need to root your phone).
Here is the related part from the source code in BluetoothGatt.class
related to your request:
public boolean requestConnectionPriority(int connectionPriority) {
if (connectionPriority < CONNECTION_PRIORITY_BALANCED ||
connectionPriority > CONNECTION_PRIORITY_LOW_POWER) {
throw new IllegalArgumentException("connectionPriority not within valid range");
}
if (DBG) Log.d(TAG, "requestConnectionPriority() - params: " + connectionPriority);
if (mService == null || mClientIf == 0) return false;
try {
mService.connectionParameterUpdate(mClientIf, mDevice.getAddress(), connectionPriority);
} catch (RemoteException e) {
Log.e(TAG,"",e);
return false;
}
return true;
}
I would look for the implementation of BluetoothGattService#connectionParameterUpdate
.
Upvotes: 1