| 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 <iterator> | 7 #include <iterator> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 return characteristics; | 485 return characteristics; |
| 486 } | 486 } |
| 487 | 487 |
| 488 std::vector<device::BluetoothRemoteGattDescriptor*> | 488 std::vector<device::BluetoothRemoteGattDescriptor*> |
| 489 BluetoothDevice::GetDescriptorsByUUID( | 489 BluetoothDevice::GetDescriptorsByUUID( |
| 490 device::BluetoothRemoteGattCharacteristic* characteristic, | 490 device::BluetoothRemoteGattCharacteristic* characteristic, |
| 491 const BluetoothUUID& descriptor_uuid) { | 491 const BluetoothUUID& descriptor_uuid) { |
| 492 std::vector<device::BluetoothRemoteGattDescriptor*> descriptors; | 492 std::vector<device::BluetoothRemoteGattDescriptor*> descriptors; |
| 493 DVLOG(1) << "Looking for descriptor: " << descriptor_uuid.canonical_value(); | 493 if (characteristic) { |
| 494 for (auto* descriptor : characteristic->GetDescriptors()) { | 494 DVLOG(1) << "Looking for descriptor: " << descriptor_uuid.canonical_value(); |
| 495 DVLOG(1) << "Descriptor in cache: " | 495 for (auto* descriptor : characteristic->GetDescriptors()) { |
| 496 << descriptor->GetUUID().canonical_value(); | 496 DVLOG(1) << "Descriptor in cache: " |
| 497 if (descriptor->GetUUID() == descriptor_uuid) { | 497 << descriptor->GetUUID().canonical_value(); |
| 498 descriptors.push_back(descriptor); | 498 if (descriptor->GetUUID() == descriptor_uuid) { |
| 499 descriptors.push_back(descriptor); |
| 500 } |
| 499 } | 501 } |
| 500 } | 502 } |
| 501 return descriptors; | 503 return descriptors; |
| 502 } | 504 } |
| 503 | 505 |
| 504 void BluetoothDevice::DidConnectGatt() { | 506 void BluetoothDevice::DidConnectGatt() { |
| 505 for (const auto& callback : create_gatt_connection_success_callbacks_) { | 507 for (const auto& callback : create_gatt_connection_success_callbacks_) { |
| 506 callback.Run( | 508 callback.Run( |
| 507 base::MakeUnique<BluetoothGattConnection>(adapter_, GetAddress())); | 509 base::MakeUnique<BluetoothGattConnection>(adapter_, GetAddress())); |
| 508 } | 510 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 if (power < INT8_MIN) { | 580 if (power < INT8_MIN) { |
| 579 return INT8_MIN; | 581 return INT8_MIN; |
| 580 } | 582 } |
| 581 if (power > INT8_MAX) { | 583 if (power > INT8_MAX) { |
| 582 return INT8_MAX; | 584 return INT8_MAX; |
| 583 } | 585 } |
| 584 return static_cast<int8_t>(power); | 586 return static_cast<int8_t>(power); |
| 585 } | 587 } |
| 586 | 588 |
| 587 } // namespace device | 589 } // namespace device |
| OLD | NEW |