| 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_win.h" | 5 #include "device/bluetooth/bluetooth_device_win.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/containers/scoped_ptr_hash_map.h" | 10 #include "base/containers/scoped_ptr_hash_map.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 if (attribute_handle == it_att_handle && uuid == it_uuid) { | 335 if (attribute_handle == it_att_handle && uuid == it_uuid) { |
| 336 return true; | 336 return true; |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 return false; | 339 return false; |
| 340 } | 340 } |
| 341 | 341 |
| 342 bool BluetoothDeviceWin::DoesGattServiceExist( | 342 bool BluetoothDeviceWin::DoesGattServiceExist( |
| 343 const ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>& | 343 const ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>& |
| 344 service_state, | 344 service_state, |
| 345 BluetoothGattService* service) { | 345 BluetoothRemoteGattService* service) { |
| 346 uint16_t attribute_handle = | 346 uint16_t attribute_handle = |
| 347 static_cast<BluetoothRemoteGattServiceWin*>(service) | 347 static_cast<BluetoothRemoteGattServiceWin*>(service) |
| 348 ->GetAttributeHandle(); | 348 ->GetAttributeHandle(); |
| 349 BluetoothUUID uuid = service->GetUUID(); | 349 BluetoothUUID uuid = service->GetUUID(); |
| 350 ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator it = | 350 ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator it = |
| 351 service_state.begin(); | 351 service_state.begin(); |
| 352 for (; it != service_state.end(); ++it) { | 352 for (; it != service_state.end(); ++it) { |
| 353 if (attribute_handle == (*it)->attribute_handle && uuid == (*it)->gatt_uuid) | 353 if (attribute_handle == (*it)->attribute_handle && uuid == (*it)->gatt_uuid) |
| 354 return true; | 354 return true; |
| 355 } | 355 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 385 for (ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator | 385 for (ScopedVector<BluetoothTaskManagerWin::ServiceRecordState>::const_iterator |
| 386 it = service_state.begin(); | 386 it = service_state.begin(); |
| 387 it != service_state.end(); ++it) { | 387 it != service_state.end(); ++it) { |
| 388 if (!IsGattServiceDiscovered((*it)->gatt_uuid, (*it)->attribute_handle)) { | 388 if (!IsGattServiceDiscovered((*it)->gatt_uuid, (*it)->attribute_handle)) { |
| 389 BluetoothRemoteGattServiceWin* primary_service = | 389 BluetoothRemoteGattServiceWin* primary_service = |
| 390 new BluetoothRemoteGattServiceWin(this, (*it)->path, (*it)->gatt_uuid, | 390 new BluetoothRemoteGattServiceWin(this, (*it)->path, (*it)->gatt_uuid, |
| 391 (*it)->attribute_handle, true, | 391 (*it)->attribute_handle, true, |
| 392 nullptr, ui_task_runner_); | 392 nullptr, ui_task_runner_); |
| 393 gatt_services_.add( | 393 gatt_services_.add( |
| 394 primary_service->GetIdentifier(), | 394 primary_service->GetIdentifier(), |
| 395 std::unique_ptr<BluetoothGattService>(primary_service)); | 395 std::unique_ptr<BluetoothRemoteGattService>(primary_service)); |
| 396 adapter_->NotifyGattServiceAdded(primary_service); | 396 adapter_->NotifyGattServiceAdded(primary_service); |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 | 399 |
| 400 adapter_->NotifyGattServicesDiscovered(this); | 400 adapter_->NotifyGattServicesDiscovered(this); |
| 401 } | 401 } |
| 402 | 402 |
| 403 } // namespace device | 403 } // namespace device |
| OLD | NEW |