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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 return false; | 203 return false; |
204 } | 204 } |
205 | 205 |
206 void BluetoothDevice::CreateGattConnection( | 206 void BluetoothDevice::CreateGattConnection( |
207 const GattConnectionCallback& callback, | 207 const GattConnectionCallback& callback, |
208 const ConnectErrorCallback& error_callback) { | 208 const ConnectErrorCallback& error_callback) { |
209 create_gatt_connection_success_callbacks_.push_back(callback); | 209 create_gatt_connection_success_callbacks_.push_back(callback); |
210 create_gatt_connection_error_callbacks_.push_back(error_callback); | 210 create_gatt_connection_error_callbacks_.push_back(error_callback); |
211 | 211 |
212 if (IsGattConnected()) | 212 if (IsGattConnected()) |
213 DidConnectGatt(); | 213 return DidConnectGatt(); |
214 | 214 |
215 CreateGattConnectionImpl(); | 215 CreateGattConnectionImpl(); |
216 } | 216 } |
217 | 217 |
218 std::vector<BluetoothGattService*> | 218 std::vector<BluetoothGattService*> |
219 BluetoothDevice::GetGattServices() const { | 219 BluetoothDevice::GetGattServices() const { |
220 std::vector<BluetoothGattService*> services; | 220 std::vector<BluetoothGattService*> services; |
221 for (GattServiceMap::const_iterator iter = gatt_services_.begin(); | 221 for (GattServiceMap::const_iterator iter = gatt_services_.begin(); |
222 iter != gatt_services_.end(); ++iter) | 222 iter != gatt_services_.end(); ++iter) |
223 services.push_back(iter->second); | 223 services.push_back(iter->second); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 336 |
337 void BluetoothDevice::ClearServiceData() { services_data_->Clear(); } | 337 void BluetoothDevice::ClearServiceData() { services_data_->Clear(); } |
338 | 338 |
339 void BluetoothDevice::SetServiceData(BluetoothUUID serviceUUID, | 339 void BluetoothDevice::SetServiceData(BluetoothUUID serviceUUID, |
340 const char* buffer, size_t size) { | 340 const char* buffer, size_t size) { |
341 services_data_->Set(serviceUUID.value(), | 341 services_data_->Set(serviceUUID.value(), |
342 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); | 342 base::BinaryValue::CreateWithCopiedBuffer(buffer, size)); |
343 } | 343 } |
344 | 344 |
345 } // namespace device | 345 } // namespace device |
OLD | NEW |