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

Unified Diff: device/bluetooth/bluetooth_device_android.cc

Issue 2205693003: bluetooth: Replace old advertised uuids (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Improve comments Created 4 years, 4 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 ac48b1bf982dedaf9e38212125183ed78efb7799..ae329601e9cc30d208c35ca04f05f8439c11d5cf 100644
--- a/device/bluetooth/bluetooth_device_android.cc
+++ b/device/bluetooth/bluetooth_device_android.cc
@@ -50,9 +50,13 @@ BluetoothDeviceAndroid::~BluetoothDeviceAndroid() {
AttachCurrentThread(), j_device_.obj());
}
-bool BluetoothDeviceAndroid::UpdateAdvertisedUUIDs(jobject advertised_uuids) {
- return Java_ChromeBluetoothDevice_updateAdvertisedUUIDs(
- AttachCurrentThread(), j_device_.obj(), advertised_uuids);
+void BluetoothDeviceAndroid::UpdateAdvertisedUUIDs(
+ jobjectArray advertised_uuids) {
+ JNIEnv* env = AttachCurrentThread();
+ std::vector<std::string> uuid_strings;
+ AppendJavaStringArrayToStringVector(env, advertised_uuids, &uuid_strings);
+
+ advertised_uuids_ = UUIDList(uuid_strings.begin(), uuid_strings.end());
}
// static
@@ -134,20 +138,6 @@ bool BluetoothDeviceAndroid::IsConnecting() const {
return false;
}
-BluetoothDevice::UUIDList BluetoothDeviceAndroid::GetUUIDs() const {
- JNIEnv* env = AttachCurrentThread();
- std::vector<std::string> uuid_strings;
- AppendJavaStringArrayToStringVector(
- env, Java_ChromeBluetoothDevice_getUuids(env, j_device_.obj()).obj(),
- &uuid_strings);
- BluetoothDevice::UUIDList uuids;
- uuids.reserve(uuid_strings.size());
- for (auto uuid_string : uuid_strings) {
- uuids.push_back(BluetoothUUID(uuid_string));
- }
- return uuids;
-}
-
int16_t BluetoothDeviceAndroid::GetInquiryRSSI() const {
NOTIMPLEMENTED();
return kUnknownPower;
@@ -251,6 +241,7 @@ void BluetoothDeviceAndroid::OnConnectionStateChange(
// Otherwise an existing connection was terminated.
RecordConnectionTerminatedResult(status);
gatt_services_.clear();
+ service_uuids_.clear();
SetGattServicesDiscoveryComplete(false);
DidDisconnectGatt();
}
@@ -259,6 +250,7 @@ void BluetoothDeviceAndroid::OnConnectionStateChange(
void BluetoothDeviceAndroid::OnGattServicesDiscovered(
JNIEnv* env,
const JavaParamRef<jobject>& jcaller) {
+ UpdateServiceUUIDs();
SetGattServicesDiscoveryComplete(true);
adapter_->NotifyGattServicesDiscovered(this);
}
« 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