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

Unified Diff: device/bluetooth/bluetooth_device_android.cc

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
« no previous file with comments | « device/bluetooth/bluetooth_device_android.h ('k') | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_device_android.cc
diff --git a/device/bluetooth/bluetooth_device_android.cc b/device/bluetooth/bluetooth_device_android.cc
index 2d9c954a1445c2945a00849903792808f3ea2b76..1066ac4b39f822d44debff43ea26f974beaa9bfc 100644
--- a/device/bluetooth/bluetooth_device_android.cc
+++ b/device/bluetooth/bluetooth_device_android.cc
@@ -7,7 +7,9 @@
#include "base/android/jni_android.h"
#include "base/android/jni_array.h"
#include "base/android/jni_string.h"
+#include "base/strings/stringprintf.h"
#include "device/bluetooth/bluetooth_adapter_android.h"
+#include "device/bluetooth/bluetooth_remote_gatt_service_android.h"
#include "jni/ChromeBluetoothDevice_jni.h"
using base::android::AttachCurrentThread;
@@ -221,6 +223,29 @@ void BluetoothDeviceAndroid::OnConnectionStateChange(JNIEnv* env,
}
}
+void BluetoothDeviceAndroid::CreateGattRemoteService(
+ JNIEnv* env,
+ jobject caller,
+ int32_t instanceId,
+ jobject bluetooth_gatt_service_wrapper // Java Type:
+ // BluetoothGattServiceWrapper
+ ) {
+ std::string instanceIdString = base::StringPrintf("%d", instanceId);
+
+ if (gatt_services_.contains(instanceIdString))
+ return;
+
+ BluetoothRemoteGattServiceAndroid* service =
+ BluetoothRemoteGattServiceAndroid::Create(
+ GetAdapter(), this, bluetooth_gatt_service_wrapper, instanceIdString);
+
+ gatt_services_.set(instanceIdString,
+ make_scoped_ptr<BluetoothGattService>(service));
+
+ FOR_EACH_OBSERVER(BluetoothAdapter::Observer, GetAdapter()->GetObservers(),
+ GattServiceAdded(adapter_, this, service));
+}
+
BluetoothDeviceAndroid::BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter)
: BluetoothDevice(adapter) {}
« no previous file with comments | « device/bluetooth/bluetooth_device_android.h ('k') | device/bluetooth/bluetooth_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698