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

Unified Diff: device/bluetooth/bluetooth_adapter_android.cc

Issue 1150833002: bluetooth: android: Initial Low Energy Discovery Sessions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-manifest-
Patch Set: Created 5 years, 7 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/bluetooth_adapter_android.cc
diff --git a/device/bluetooth/bluetooth_adapter_android.cc b/device/bluetooth/bluetooth_adapter_android.cc
index 007136d8c8d61734113e5e2bf0e561d49e113012..d1545b3d3209c2c7a19ec43bd1e3bf48c16f52e7 100644
--- a/device/bluetooth/bluetooth_adapter_android.cc
+++ b/device/bluetooth/bluetooth_adapter_android.cc
@@ -46,8 +46,8 @@ bool BluetoothAdapterAndroid::RegisterJNI(JNIEnv* env) {
return RegisterNativesImpl(env); // Generated in BluetoothAdapter_jni.h
}
-bool BluetoothAdapterAndroid::HasBluetoothPermission() const {
- return Java_BluetoothAdapter_hasBluetoothPermission(
+bool BluetoothAdapterAndroid::HasBluetoothCapability() const {
+ return Java_BluetoothAdapter_hasBluetoothCapability(
AttachCurrentThread(), j_bluetooth_adapter_.obj());
}
@@ -146,20 +146,32 @@ void BluetoothAdapterAndroid::AddDiscoverySession(
BluetoothDiscoveryFilter* discovery_filter,
const base::Closure& callback,
const ErrorCallback& error_callback) {
- error_callback.Run();
+ // TODO(scheib): Support filters crbug.com/490401
+ if (Java_BluetoothAdapter_addDiscoverySession(AttachCurrentThread(),
+ j_bluetooth_adapter_.obj())) {
+ callback.Run();
+ } else {
+ error_callback.Run();
+ }
}
void BluetoothAdapterAndroid::RemoveDiscoverySession(
BluetoothDiscoveryFilter* discovery_filter,
const base::Closure& callback,
const ErrorCallback& error_callback) {
- error_callback.Run();
+ if (Java_BluetoothAdapter_removeDiscoverySession(
+ AttachCurrentThread(), j_bluetooth_adapter_.obj())) {
+ callback.Run();
+ } else {
+ error_callback.Run();
+ }
}
void BluetoothAdapterAndroid::SetDiscoveryFilter(
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter,
const base::Closure& callback,
const ErrorCallback& error_callback) {
+ NOTIMPLEMENTED();
error_callback.Run();
}

Powered by Google App Engine
This is Rietveld 408576698