Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java

Issue 1394973003: bluetooth: android: Create BluetoothRemoteGattServiceAndroid objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-renames-
Patch Set: Address ortuno Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java
diff --git a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java
index 17c725905a2946239bfa5a8b62957c27a4fb5798..df54ee8951366aa2fe32edf0785d92482ccb33df 100644
--- a/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java
+++ b/device/bluetooth/android/java/src/org/chromium/device/bluetooth/Wrappers.java
@@ -10,6 +10,7 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCallback;
+import android.bluetooth.BluetoothGattService;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanFilter;
@@ -264,6 +265,20 @@ class Wrappers {
public void disconnect() {
mGatt.disconnect();
}
+
+ public void discoverServices() {
+ mGatt.discoverServices();
+ }
+
+ public List<BluetoothGattServiceWrapper> getServices() {
+ List<BluetoothGattService> services = mGatt.getServices();
+ ArrayList<BluetoothGattServiceWrapper> servicesWrapped =
+ new ArrayList<BluetoothGattServiceWrapper>(services.size());
+ for (BluetoothGattService service : services) {
+ servicesWrapped.add(new BluetoothGattServiceWrapper(service));
+ }
+ return servicesWrapped;
+ }
}
/**
@@ -285,6 +300,11 @@ class Wrappers {
public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState) {
mWrapperCallback.onConnectionStateChange(status, newState);
}
+
+ @Override
+ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
+ mWrapperCallback.onServicesDiscovered(status);
+ }
}
/**
@@ -297,5 +317,21 @@ class Wrappers {
*/
abstract static class BluetoothGattCallbackWrapper {
public abstract void onConnectionStateChange(int status, int newState);
+ public abstract void onServicesDiscovered(int status);
+ }
+
+ /**
+ * Wraps android.bluetooth.BluetoothGattService.
+ */
+ static class BluetoothGattServiceWrapper {
+ private final BluetoothGattService mService;
+
+ public BluetoothGattServiceWrapper(BluetoothGattService service) {
+ mService = service;
+ }
+
+ public int getInstanceId() {
+ return mService.getInstanceId();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698