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

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

Issue 2085293002: bluetooth: Call GattCharacteristicValueChanged after a read succeeds (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Use a lambda to check that GattCharacteristicValueChanged has been called Created 4 years, 5 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_remote_gatt_characteristic_win.h" 5 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_win.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 351 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
352 352
353 std::pair<ValueCallback, ErrorCallback> callbacks; 353 std::pair<ValueCallback, ErrorCallback> callbacks;
354 callbacks.swap(read_characteristic_value_callbacks_); 354 callbacks.swap(read_characteristic_value_callbacks_);
355 if (FAILED(hr)) { 355 if (FAILED(hr)) {
356 callbacks.second.Run(HRESULTToGattErrorCode(hr)); 356 callbacks.second.Run(HRESULTToGattErrorCode(hr));
357 } else { 357 } else {
358 characteristic_value_.clear(); 358 characteristic_value_.clear();
359 for (ULONG i = 0; i < value->DataSize; i++) 359 for (ULONG i = 0; i < value->DataSize; i++)
360 characteristic_value_.push_back(value->Data[i]); 360 characteristic_value_.push_back(value->Data[i]);
361
362 parent_service_->GetWinAdapter()->NotifyGattCharacteristicValueChanged(
363 this, characteristic_value_);
364
361 callbacks.first.Run(characteristic_value_); 365 callbacks.first.Run(characteristic_value_);
362 } 366 }
363 characteristic_value_read_or_write_in_progress_ = false; 367 characteristic_value_read_or_write_in_progress_ = false;
364 } 368 }
365 369
366 void BluetoothRemoteGattCharacteristicWin:: 370 void BluetoothRemoteGattCharacteristicWin::
367 OnWriteRemoteCharacteristicValueCallback(HRESULT hr) { 371 OnWriteRemoteCharacteristicValueCallback(HRESULT hr) {
368 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 372 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
369 373
370 std::pair<base::Closure, ErrorCallback> callbacks; 374 std::pair<base::Closure, ErrorCallback> callbacks;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 432
429 void BluetoothRemoteGattCharacteristicWin::ClearIncludedDescriptors() { 433 void BluetoothRemoteGattCharacteristicWin::ClearIncludedDescriptors() {
430 // Explicitly reset to null to ensure that calling GetDescriptor() on the 434 // Explicitly reset to null to ensure that calling GetDescriptor() on the
431 // removed descriptor in GattDescriptorRemoved() returns null. 435 // removed descriptor in GattDescriptorRemoved() returns null.
432 for (auto& entry : included_descriptors_) 436 for (auto& entry : included_descriptors_)
433 entry.second.reset(); 437 entry.second.reset();
434 included_descriptors_.clear(); 438 included_descriptors_.clear();
435 } 439 }
436 440
437 } // namespace device. 441 } // namespace device.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698