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

Side by Side Diff: device/bluetooth/bluetooth_device_android.cc

Issue 2891493002: Revert of bluetooth: bluez: Fixed issue with missing notifications after reconnect. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_device_android.h" 5 #include "device/bluetooth/bluetooth_device_android.h"
6 6
7 #include "base/android/context_utils.h" 7 #include "base/android/context_utils.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 } else if (!create_gatt_connection_error_callbacks_.empty()) { 215 } else if (!create_gatt_connection_error_callbacks_.empty()) {
216 // We assume that if there are any pending connection callbacks there 216 // We assume that if there are any pending connection callbacks there
217 // was a failed connection attempt. 217 // was a failed connection attempt.
218 RecordConnectionFailureResult(status); 218 RecordConnectionFailureResult(status);
219 // TODO(ortuno): Return an error code based on |status| 219 // TODO(ortuno): Return an error code based on |status|
220 // http://crbug.com/578191 220 // http://crbug.com/578191
221 DidFailToConnectGatt(ERROR_FAILED); 221 DidFailToConnectGatt(ERROR_FAILED);
222 } else { 222 } else {
223 // Otherwise an existing connection was terminated. 223 // Otherwise an existing connection was terminated.
224 RecordConnectionTerminatedResult(status); 224 RecordConnectionTerminatedResult(status);
225 DidDisconnectGatt(true /* notifyDeviceChanged */); 225 gatt_services_.clear();
226 device_uuids_.ClearServiceUUIDs();
227 SetGattServicesDiscoveryComplete(false);
228 DidDisconnectGatt();
226 } 229 }
227 } 230 }
228 231
229 void BluetoothDeviceAndroid::OnGattServicesDiscovered( 232 void BluetoothDeviceAndroid::OnGattServicesDiscovered(
230 JNIEnv* env, 233 JNIEnv* env,
231 const JavaParamRef<jobject>& jcaller) { 234 const JavaParamRef<jobject>& jcaller) {
232 device_uuids_.ReplaceServiceUUIDs(gatt_services_); 235 device_uuids_.ReplaceServiceUUIDs(gatt_services_);
233 SetGattServicesDiscoveryComplete(true); 236 SetGattServicesDiscoveryComplete(true);
234 adapter_->NotifyGattServicesDiscovered(this); 237 adapter_->NotifyGattServicesDiscovered(this);
235 adapter_->NotifyDeviceChanged(this); 238 adapter_->NotifyDeviceChanged(this);
(...skipping 27 matching lines...) Expand all
263 void BluetoothDeviceAndroid::CreateGattConnectionImpl() { 266 void BluetoothDeviceAndroid::CreateGattConnectionImpl() {
264 Java_ChromeBluetoothDevice_createGattConnectionImpl( 267 Java_ChromeBluetoothDevice_createGattConnectionImpl(
265 AttachCurrentThread(), j_device_, base::android::GetApplicationContext()); 268 AttachCurrentThread(), j_device_, base::android::GetApplicationContext());
266 } 269 }
267 270
268 void BluetoothDeviceAndroid::DisconnectGatt() { 271 void BluetoothDeviceAndroid::DisconnectGatt() {
269 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), j_device_); 272 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), j_device_);
270 } 273 }
271 274
272 } // namespace device 275 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device.cc ('k') | device/bluetooth/bluetooth_low_energy_device_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698