Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
This is a copy of the following PR dariuszseweryn#112
Browse files Browse the repository at this point in the history
It allows users to request a certain priority for each connection.
  • Loading branch information
gabrieloshiro committed Jan 12, 2017
1 parent 6eea786 commit abee6fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public Observable<RxBleDeviceServices> discoverServices() {
return Observable.just(rxBleDeviceServices);
}

@Override
public void requestConnectionPriority(int priority) {

}

@Override
public Observable<RxBleDeviceServices> discoverServices(long timeout, TimeUnit timeUnit) {
return Observable.just(rxBleDeviceServices);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public String toString() {
}
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
void requestConnectionPriority(int priority);

/**
* Performs GATT service discovery and emits discovered results. After service discovery you can walk through
* {@link android.bluetooth.BluetoothGattService}s and {@link BluetoothGattCharacteristic}s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ private Observable<Integer> privateRequestMtu(int mtu, long timeout, TimeUnit ti
return newObservable;
}

@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
public void requestConnectionPriority(int priority) {
bluetoothGatt.requestConnectionPriority(priority);
}

@Override
public Observable<RxBleDeviceServices> discoverServices() {
return privateDiscoverServices(20, TimeUnit.SECONDS);
Expand Down

0 comments on commit abee6fd

Please sign in to comment.