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 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 VLOG(2) << "Characteristic in cache: " | 478 VLOG(2) << "Characteristic in cache: " |
479 << characteristic->GetUUID().canonical_value(); | 479 << characteristic->GetUUID().canonical_value(); |
480 if (characteristic->GetUUID() == characteristic_uuid) { | 480 if (characteristic->GetUUID() == characteristic_uuid) { |
481 characteristics.push_back(characteristic); | 481 characteristics.push_back(characteristic); |
482 } | 482 } |
483 } | 483 } |
484 } | 484 } |
485 return characteristics; | 485 return characteristics; |
486 } | 486 } |
487 | 487 |
488 std::vector<device::BluetoothRemoteGattDescriptor*> | |
489 BluetoothDevice::GetDescriptorsByUUID( | |
490 device::BluetoothRemoteGattCharacteristic* characteristic, | |
491 const BluetoothUUID& descriptor_uuid) { | |
492 std::vector<device::BluetoothRemoteGattDescriptor*> descriptors; | |
493 DVLOG(1) << "Looking for descriptor: " << descriptor_uuid.canonical_value(); | |
494 for (auto* descriptor : characteristic->GetDescriptors()) { | |
495 DVLOG(1) << "Descriptor in cache: " | |
496 << descriptor->GetUUID().canonical_value(); | |
497 if (descriptor->GetUUID() == descriptor_uuid) { | |
498 descriptors.push_back(descriptor); | |
499 } | |
500 } | |
501 return descriptors; | |
502 } | |
503 | |
504 void BluetoothDevice::DidConnectGatt() { | 488 void BluetoothDevice::DidConnectGatt() { |
505 for (const auto& callback : create_gatt_connection_success_callbacks_) { | 489 for (const auto& callback : create_gatt_connection_success_callbacks_) { |
506 callback.Run( | 490 callback.Run( |
507 base::MakeUnique<BluetoothGattConnection>(adapter_, GetAddress())); | 491 base::MakeUnique<BluetoothGattConnection>(adapter_, GetAddress())); |
508 } | 492 } |
509 create_gatt_connection_success_callbacks_.clear(); | 493 create_gatt_connection_success_callbacks_.clear(); |
510 create_gatt_connection_error_callbacks_.clear(); | 494 create_gatt_connection_error_callbacks_.clear(); |
511 GetAdapter()->NotifyDeviceChanged(this); | 495 GetAdapter()->NotifyDeviceChanged(this); |
512 } | 496 } |
513 | 497 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 if (power < INT8_MIN) { | 562 if (power < INT8_MIN) { |
579 return INT8_MIN; | 563 return INT8_MIN; |
580 } | 564 } |
581 if (power > INT8_MAX) { | 565 if (power > INT8_MAX) { |
582 return INT8_MAX; | 566 return INT8_MAX; |
583 } | 567 } |
584 return static_cast<int8_t>(power); | 568 return static_cast<int8_t>(power); |
585 } | 569 } |
586 | 570 |
587 } // namespace device | 571 } // namespace device |
OLD | NEW |