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_service_win.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_service_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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 | 72 |
73 bool BluetoothRemoteGattServiceWin::IsPrimary() const { | 73 bool BluetoothRemoteGattServiceWin::IsPrimary() const { |
74 return is_primary_; | 74 return is_primary_; |
75 } | 75 } |
76 | 76 |
77 BluetoothDevice* BluetoothRemoteGattServiceWin::GetDevice() const { | 77 BluetoothDevice* BluetoothRemoteGattServiceWin::GetDevice() const { |
78 return device_; | 78 return device_; |
79 } | 79 } |
80 | 80 |
81 std::vector<BluetoothGattCharacteristic*> | 81 std::vector<BluetoothRemoteGattCharacteristic*> |
82 BluetoothRemoteGattServiceWin::GetCharacteristics() const { | 82 BluetoothRemoteGattServiceWin::GetCharacteristics() const { |
83 std::vector<BluetoothGattCharacteristic*> has_characteristics; | 83 std::vector<BluetoothRemoteGattCharacteristic*> has_characteristics; |
84 for (const auto& c : included_characteristics_) | 84 for (const auto& c : included_characteristics_) |
85 has_characteristics.push_back(c.second.get()); | 85 has_characteristics.push_back(c.second.get()); |
86 return has_characteristics; | 86 return has_characteristics; |
87 } | 87 } |
88 | 88 |
89 std::vector<BluetoothGattService*> | 89 std::vector<BluetoothRemoteGattService*> |
90 BluetoothRemoteGattServiceWin::GetIncludedServices() const { | 90 BluetoothRemoteGattServiceWin::GetIncludedServices() const { |
91 NOTIMPLEMENTED(); | 91 NOTIMPLEMENTED(); |
92 // TODO(crbug.com/590008): Needs implementation. | 92 // TODO(crbug.com/590008): Needs implementation. |
93 return std::vector<BluetoothGattService*>(); | 93 return std::vector<BluetoothRemoteGattService*>(); |
94 } | 94 } |
95 | 95 |
96 BluetoothGattCharacteristic* BluetoothRemoteGattServiceWin::GetCharacteristic( | 96 BluetoothRemoteGattCharacteristic* |
| 97 BluetoothRemoteGattServiceWin::GetCharacteristic( |
97 const std::string& identifier) const { | 98 const std::string& identifier) const { |
98 GattCharacteristicsMap::const_iterator it = | 99 GattCharacteristicsMap::const_iterator it = |
99 included_characteristics_.find(identifier); | 100 included_characteristics_.find(identifier); |
100 if (it != included_characteristics_.end()) | 101 if (it != included_characteristics_.end()) |
101 return it->second.get(); | 102 return it->second.get(); |
102 return nullptr; | 103 return nullptr; |
103 } | 104 } |
104 | 105 |
105 bool BluetoothRemoteGattServiceWin::AddCharacteristic( | 106 bool BluetoothRemoteGattServiceWin::AddCharacteristic( |
106 device::BluetoothGattCharacteristic* characteristic) { | 107 device::BluetoothRemoteGattCharacteristic* characteristic) { |
107 NOTIMPLEMENTED(); | 108 NOTIMPLEMENTED(); |
108 return false; | 109 return false; |
109 } | 110 } |
110 | 111 |
111 bool BluetoothRemoteGattServiceWin::AddIncludedService( | 112 bool BluetoothRemoteGattServiceWin::AddIncludedService( |
112 device::BluetoothGattService* service) { | 113 device::BluetoothRemoteGattService* service) { |
113 NOTIMPLEMENTED(); | 114 NOTIMPLEMENTED(); |
114 return false; | 115 return false; |
115 } | 116 } |
116 | 117 |
117 void BluetoothRemoteGattServiceWin::Register( | 118 void BluetoothRemoteGattServiceWin::Register( |
118 const base::Closure& callback, | 119 const base::Closure& callback, |
119 const ErrorCallback& error_callback) { | 120 const ErrorCallback& error_callback) { |
120 NOTIMPLEMENTED(); | 121 NOTIMPLEMENTED(); |
121 error_callback.Run(GATT_ERROR_NOT_SUPPORTED); | 122 error_callback.Run(GATT_ERROR_NOT_SUPPORTED); |
122 } | 123 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void BluetoothRemoteGattServiceWin::ClearIncludedCharacteristics() { | 258 void BluetoothRemoteGattServiceWin::ClearIncludedCharacteristics() { |
258 discovery_completed_included_charateristics_.clear(); | 259 discovery_completed_included_charateristics_.clear(); |
259 // Explicitly reset to null to ensure that calling GetCharacteristic() on the | 260 // Explicitly reset to null to ensure that calling GetCharacteristic() on the |
260 // removed characteristic in GattDescriptorRemoved() returns null. | 261 // removed characteristic in GattDescriptorRemoved() returns null. |
261 for (auto& entry : included_characteristics_) | 262 for (auto& entry : included_characteristics_) |
262 entry.second.reset(); | 263 entry.second.reset(); |
263 included_characteristics_.clear(); | 264 included_characteristics_.clear(); |
264 } | 265 } |
265 | 266 |
266 } // namespace device. | 267 } // namespace device. |
OLD | NEW |