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

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

Issue 1749403002: Implement BluetoothRemoteGattCharacteristicWin::StartNotifySession and related unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move comments Created 4 years, 8 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_service_win.h" 5 #include "device/bluetooth/bluetooth_remote_gatt_service_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "device/bluetooth/bluetooth_adapter_win.h" 8 #include "device/bluetooth/bluetooth_adapter_win.h"
9 #include "device/bluetooth/bluetooth_device_win.h" 9 #include "device/bluetooth/bluetooth_device_win.h"
10 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_win.h" 10 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_win.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 task_manager_ = adapter_->GetWinBluetoothTaskManager(); 43 task_manager_ = adapter_->GetWinBluetoothTaskManager();
44 DCHECK(task_manager_); 44 DCHECK(task_manager_);
45 service_identifier_ = device_->GetIdentifier() + "/" + service_uuid_.value() + 45 service_identifier_ = device_->GetIdentifier() + "/" + service_uuid_.value() +
46 "_" + std::to_string(service_attribute_handle_); 46 "_" + std::to_string(service_attribute_handle_);
47 Update(); 47 Update();
48 } 48 }
49 49
50 BluetoothRemoteGattServiceWin::~BluetoothRemoteGattServiceWin() { 50 BluetoothRemoteGattServiceWin::~BluetoothRemoteGattServiceWin() {
51 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread()); 51 DCHECK(ui_task_runner_->RunsTasksOnCurrentThread());
52 52
53 ClearIncludedCharacteristics();
54
53 adapter_->NotifyGattServiceRemoved(this); 55 adapter_->NotifyGattServiceRemoved(this);
54 } 56 }
55 57
56 std::string BluetoothRemoteGattServiceWin::GetIdentifier() const { 58 std::string BluetoothRemoteGattServiceWin::GetIdentifier() const {
57 return service_identifier_; 59 return service_identifier_;
58 } 60 }
59 61
60 BluetoothUUID BluetoothRemoteGattServiceWin::GetUUID() const { 62 BluetoothUUID BluetoothRemoteGattServiceWin::GetUUID() const {
61 return const_cast<BluetoothUUID&>(service_uuid_); 63 return const_cast<BluetoothUUID&>(service_uuid_);
62 } 64 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 characteristics[i].AttributeHandle) { 240 characteristics[i].AttributeHandle) {
239 return true; 241 return true;
240 } 242 }
241 } 243 }
242 return false; 244 return false;
243 } 245 }
244 246
245 void BluetoothRemoteGattServiceWin::RemoveIncludedCharacteristic( 247 void BluetoothRemoteGattServiceWin::RemoveIncludedCharacteristic(
246 std::string identifier) { 248 std::string identifier) {
247 discovery_completed_included_charateristics_.erase(identifier); 249 discovery_completed_included_charateristics_.erase(identifier);
250 included_characteristics_[identifier].reset();
248 included_characteristics_.erase(identifier); 251 included_characteristics_.erase(identifier);
249 } 252 }
250 253
251 void BluetoothRemoteGattServiceWin::ClearIncludedCharacteristics() { 254 void BluetoothRemoteGattServiceWin::ClearIncludedCharacteristics() {
252 discovery_completed_included_charateristics_.clear(); 255 discovery_completed_included_charateristics_.clear();
253 // Explicitly reset to null to ensure that calling GetCharacteristic() on the 256 // Explicitly reset to null to ensure that calling GetCharacteristic() on the
254 // removed characteristic in GattDescriptorRemoved() returns null. 257 // removed characteristic in GattDescriptorRemoved() returns null.
255 for (auto& entry : included_characteristics_) 258 for (auto& entry : included_characteristics_)
256 entry.second.reset(); 259 entry.second.reset();
257 included_characteristics_.clear(); 260 included_characteristics_.clear();
258 } 261 }
259 262
260 } // namespace device. 263 } // namespace device.
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_remote_gatt_descriptor_win.h ('k') | device/bluetooth/bluetooth_task_manager_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698