| OLD | NEW |
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 | 390 |
| 391 std::pair<ValueCallback, ErrorCallback> callbacks; | 391 std::pair<ValueCallback, ErrorCallback> callbacks; |
| 392 callbacks.swap(read_characteristic_value_callbacks_); | 392 callbacks.swap(read_characteristic_value_callbacks_); |
| 393 if (FAILED(hr)) { | 393 if (FAILED(hr)) { |
| 394 callbacks.second.Run(HRESULTToGattErrorCode(hr)); | 394 callbacks.second.Run(HRESULTToGattErrorCode(hr)); |
| 395 } else { | 395 } else { |
| 396 characteristic_value_.clear(); | 396 characteristic_value_.clear(); |
| 397 for (ULONG i = 0; i < value->DataSize; i++) | 397 for (ULONG i = 0; i < value->DataSize; i++) |
| 398 characteristic_value_.push_back(value->Data[i]); | 398 characteristic_value_.push_back(value->Data[i]); |
| 399 | 399 |
| 400 parent_service_->GetWinAdapter()->NotifyGattCharacteristicValueChanged( | |
| 401 this, characteristic_value_); | |
| 402 | |
| 403 callbacks.first.Run(characteristic_value_); | 400 callbacks.first.Run(characteristic_value_); |
| 404 } | 401 } |
| 405 characteristic_value_read_or_write_in_progress_ = false; | 402 characteristic_value_read_or_write_in_progress_ = false; |
| 406 } | 403 } |
| 407 | 404 |
| 408 void BluetoothRemoteGattCharacteristicWin:: | 405 void BluetoothRemoteGattCharacteristicWin:: |
| 409 OnWriteRemoteCharacteristicValueCallback(HRESULT hr) { | 406 OnWriteRemoteCharacteristicValueCallback(HRESULT hr) { |
| 410 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); | 407 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); |
| 411 | 408 |
| 412 std::pair<base::Closure, ErrorCallback> callbacks; | 409 std::pair<base::Closure, ErrorCallback> callbacks; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 467 |
| 471 void BluetoothRemoteGattCharacteristicWin::ClearIncludedDescriptors() { | 468 void BluetoothRemoteGattCharacteristicWin::ClearIncludedDescriptors() { |
| 472 // Explicitly reset to null to ensure that calling GetDescriptor() on the | 469 // Explicitly reset to null to ensure that calling GetDescriptor() on the |
| 473 // removed descriptor in GattDescriptorRemoved() returns null. | 470 // removed descriptor in GattDescriptorRemoved() returns null. |
| 474 for (auto& entry : included_descriptors_) | 471 for (auto& entry : included_descriptors_) |
| 475 entry.second.reset(); | 472 entry.second.reset(); |
| 476 included_descriptors_.clear(); | 473 included_descriptors_.clear(); |
| 477 } | 474 } |
| 478 | 475 |
| 479 } // namespace device. | 476 } // namespace device. |
| OLD | NEW |