| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/arc/bluetooth/arc_bluetooth_bridge.h" | 5 #include "components/arc/bluetooth/arc_bluetooth_bridge.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <iomanip> | 10 #include <iomanip> |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 BluetoothDevice* device) const { | 522 BluetoothDevice* device) const { |
| 523 mojo::Array<mojom::BluetoothPropertyPtr> properties; | 523 mojo::Array<mojom::BluetoothPropertyPtr> properties; |
| 524 | 524 |
| 525 if (!device) { | 525 if (!device) { |
| 526 return properties; | 526 return properties; |
| 527 } | 527 } |
| 528 | 528 |
| 529 if (type == mojom::BluetoothPropertyType::ALL || | 529 if (type == mojom::BluetoothPropertyType::ALL || |
| 530 type == mojom::BluetoothPropertyType::BDNAME) { | 530 type == mojom::BluetoothPropertyType::BDNAME) { |
| 531 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); | 531 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); |
| 532 btp->set_bdname(mojo::String::From(base::UTF16ToUTF8(device->GetName()))); | 532 // TODO(615720): Use the upcoming GetName (was GetDeviceName). |
| 533 btp->set_bdname( |
| 534 mojo::String::From(base::UTF16ToUTF8(device->GetNameForDisplay()))); |
| 533 properties.push_back(std::move(btp)); | 535 properties.push_back(std::move(btp)); |
| 534 } | 536 } |
| 535 if (type == mojom::BluetoothPropertyType::ALL || | 537 if (type == mojom::BluetoothPropertyType::ALL || |
| 536 type == mojom::BluetoothPropertyType::BDADDR) { | 538 type == mojom::BluetoothPropertyType::BDADDR) { |
| 537 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); | 539 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); |
| 538 btp->set_bdaddr(mojom::BluetoothAddress::From(device->GetAddress())); | 540 btp->set_bdaddr(mojom::BluetoothAddress::From(device->GetAddress())); |
| 539 properties.push_back(std::move(btp)); | 541 properties.push_back(std::move(btp)); |
| 540 } | 542 } |
| 541 if (type == mojom::BluetoothPropertyType::ALL || | 543 if (type == mojom::BluetoothPropertyType::ALL || |
| 542 type == mojom::BluetoothPropertyType::UUIDS) { | 544 type == mojom::BluetoothPropertyType::UUIDS) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 561 if (type == mojom::BluetoothPropertyType::ALL || | 563 if (type == mojom::BluetoothPropertyType::ALL || |
| 562 type == mojom::BluetoothPropertyType::TYPE_OF_DEVICE) { | 564 type == mojom::BluetoothPropertyType::TYPE_OF_DEVICE) { |
| 563 // TODO(smbarber): This needs to be populated with the actual device type | 565 // TODO(smbarber): This needs to be populated with the actual device type |
| 564 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); | 566 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); |
| 565 btp->set_device_type(mojom::BluetoothDeviceType::DUAL); | 567 btp->set_device_type(mojom::BluetoothDeviceType::DUAL); |
| 566 properties.push_back(std::move(btp)); | 568 properties.push_back(std::move(btp)); |
| 567 } | 569 } |
| 568 if (type == mojom::BluetoothPropertyType::ALL || | 570 if (type == mojom::BluetoothPropertyType::ALL || |
| 569 type == mojom::BluetoothPropertyType::REMOTE_FRIENDLY_NAME) { | 571 type == mojom::BluetoothPropertyType::REMOTE_FRIENDLY_NAME) { |
| 570 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); | 572 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); |
| 571 btp->set_bdname(mojo::String::From(base::UTF16ToUTF8(device->GetName()))); | 573 // TODO(615720): Use the upcoming GetName (was GetDeviceName). |
| 574 btp->set_bdname( |
| 575 mojo::String::From(base::UTF16ToUTF8(device->GetNameForDisplay()))); |
| 572 properties.push_back(std::move(btp)); | 576 properties.push_back(std::move(btp)); |
| 573 } | 577 } |
| 574 if (type == mojom::BluetoothPropertyType::ALL || | 578 if (type == mojom::BluetoothPropertyType::ALL || |
| 575 type == mojom::BluetoothPropertyType::REMOTE_RSSI) { | 579 type == mojom::BluetoothPropertyType::REMOTE_RSSI) { |
| 576 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); | 580 mojom::BluetoothPropertyPtr btp = mojom::BluetoothProperty::New(); |
| 577 btp->set_remote_rssi(device->GetInquiryRSSI()); | 581 btp->set_remote_rssi(device->GetInquiryRSSI()); |
| 578 properties.push_back(std::move(btp)); | 582 properties.push_back(std::move(btp)); |
| 579 } | 583 } |
| 580 // TODO(smbarber): Add remote version info | 584 // TODO(smbarber): Add remote version info |
| 581 | 585 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 // to | 712 // to |
| 709 // make sure the bond state machine on Android is ready to take the | 713 // make sure the bond state machine on Android is ready to take the |
| 710 // pair-done event. Otherwise the pair-done event will be dropped as an | 714 // pair-done event. Otherwise the pair-done event will be dropped as an |
| 711 // invalid change of paired status. | 715 // invalid change of paired status. |
| 712 OnPairing(addr->Clone()); | 716 OnPairing(addr->Clone()); |
| 713 OnPairedDone(std::move(addr)); | 717 OnPairedDone(std::move(addr)); |
| 714 } | 718 } |
| 715 } | 719 } |
| 716 | 720 |
| 717 } // namespace arc | 721 } // namespace arc |
| OLD | NEW |