OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/bluez/bluetooth_device_bluez.h" | 5 #include "device/bluetooth/bluez/bluetooth_device_bluez.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
600 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( | 600 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( |
601 object_path_); | 601 object_path_); |
602 DCHECK(properties); | 602 DCHECK(properties); |
603 DCHECK(properties->service_data.is_valid()); | 603 DCHECK(properties->service_data.is_valid()); |
604 | 604 |
605 service_data_.clear(); | 605 service_data_.clear(); |
606 for (const auto& pair : properties->service_data.value()) | 606 for (const auto& pair : properties->service_data.value()) |
607 service_data_[BluetoothUUID(pair.first)] = pair.second; | 607 service_data_[BluetoothUUID(pair.first)] = pair.second; |
608 } | 608 } |
609 | 609 |
610 void BluetoothDeviceBlueZ::UpdateManufacturerData() { | |
611 bluez::BluetoothDeviceClient::Properties* properties = | |
612 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( | |
613 object_path_); | |
614 DCHECK(properties); | |
615 manufacturer_data_.clear(); | |
616 | |
617 if (properties->manufacturer_data.is_valid()) { | |
618 for (const auto& pair : properties->manufacturer_data.value()) | |
619 manufacturer_data_[pair.first] = pair.second; | |
620 } | |
621 } | |
622 | |
623 void BluetoothDeviceBlueZ::UpdateAdvertisingDataFlags() { | |
624 bluez::BluetoothDeviceClient::Properties* properties = | |
625 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( | |
626 object_path_); | |
627 DCHECK(properties); | |
628 advertising_data_flags_ = base::nullopt; | |
629 | |
630 if (properties->advertising_data_flags.is_valid()) | |
631 advertising_data_flags_ = properties->advertising_data_flags.value()[0]; | |
ortuno
2016/11/02 23:36:48
Could you comment why we only need the first eleme
puthik_chromium
2016/11/03 20:40:39
Done.
| |
632 } | |
633 | |
610 BluetoothPairingBlueZ* BluetoothDeviceBlueZ::BeginPairing( | 634 BluetoothPairingBlueZ* BluetoothDeviceBlueZ::BeginPairing( |
611 BluetoothDevice::PairingDelegate* pairing_delegate) { | 635 BluetoothDevice::PairingDelegate* pairing_delegate) { |
612 pairing_.reset(new BluetoothPairingBlueZ(this, pairing_delegate)); | 636 pairing_.reset(new BluetoothPairingBlueZ(this, pairing_delegate)); |
613 return pairing_.get(); | 637 return pairing_.get(); |
614 } | 638 } |
615 | 639 |
616 void BluetoothDeviceBlueZ::EndPairing() { | 640 void BluetoothDeviceBlueZ::EndPairing() { |
617 pairing_.reset(); | 641 pairing_.reset(); |
618 } | 642 } |
619 | 643 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
913 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, | 937 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, |
914 const std::string& error_name, | 938 const std::string& error_name, |
915 const std::string& error_message) { | 939 const std::string& error_message) { |
916 LOG(WARNING) << object_path_.value() | 940 LOG(WARNING) << object_path_.value() |
917 << ": Failed to remove device: " << error_name << ": " | 941 << ": Failed to remove device: " << error_name << ": " |
918 << error_message; | 942 << error_message; |
919 error_callback.Run(); | 943 error_callback.Run(); |
920 } | 944 } |
921 | 945 |
922 } // namespace bluez | 946 } // namespace bluez |
OLD | NEW |