OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "device/bluetooth/bluetooth_device.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
211 create_gatt_connection_error_callbacks_.push_back(error_callback); | 211 create_gatt_connection_error_callbacks_.push_back(error_callback); |
212 | 212 |
213 if (IsGattConnected()) | 213 if (IsGattConnected()) |
214 return DidConnectGatt(); | 214 return DidConnectGatt(); |
215 | 215 |
216 CreateGattConnectionImpl(); | 216 CreateGattConnectionImpl(); |
217 } | 217 } |
218 | 218 |
219 void BluetoothDevice::SetGattServicesDiscoveryComplete(bool complete) { | 219 void BluetoothDevice::SetGattServicesDiscoveryComplete(bool complete) { |
220 gatt_services_discovery_complete_ = complete; | 220 gatt_services_discovery_complete_ = complete; |
221 if (!complete) | |
222 gatt_services_.clear(); | |
ortuno
2016/01/19 17:55:45
We shouldn't be deleting the services on all platf
tommyt
2016/01/20 07:54:08
Done.
| |
221 } | 223 } |
222 | 224 |
223 bool BluetoothDevice::IsGattServicesDiscoveryComplete() const { | 225 bool BluetoothDevice::IsGattServicesDiscoveryComplete() const { |
224 return gatt_services_discovery_complete_; | 226 return gatt_services_discovery_complete_; |
225 } | 227 } |
226 | 228 |
227 std::vector<BluetoothGattService*> | 229 std::vector<BluetoothGattService*> |
228 BluetoothDevice::GetGattServices() const { | 230 BluetoothDevice::GetGattServices() const { |
229 std::vector<BluetoothGattService*> services; | 231 std::vector<BluetoothGattService*> services; |
230 for (const auto& iter : gatt_services_) | 232 for (const auto& iter : gatt_services_) |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); | 349 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); |
348 } | 350 } |
349 | 351 |
350 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate, | 352 void BluetoothDevice::Pair(PairingDelegate* pairing_delegate, |
351 const base::Closure& callback, | 353 const base::Closure& callback, |
352 const ConnectErrorCallback& error_callback) { | 354 const ConnectErrorCallback& error_callback) { |
353 NOTREACHED(); | 355 NOTREACHED(); |
354 } | 356 } |
355 | 357 |
356 } // namespace device | 358 } // namespace device |
OLD | NEW |