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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
588 | 588 |
589 void BluetoothDeviceBlueZ::GetServiceRecords( | 589 void BluetoothDeviceBlueZ::GetServiceRecords( |
590 const GetServiceRecordsCallback& callback, | 590 const GetServiceRecordsCallback& callback, |
591 const GetServiceRecordsErrorCallback& error_callback) { | 591 const GetServiceRecordsErrorCallback& error_callback) { |
592 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetServiceRecords( | 592 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetServiceRecords( |
593 object_path_, callback, | 593 object_path_, callback, |
594 base::Bind(&BluetoothDeviceBlueZ::OnGetServiceRecordsError, | 594 base::Bind(&BluetoothDeviceBlueZ::OnGetServiceRecordsError, |
595 weak_ptr_factory_.GetWeakPtr(), error_callback)); | 595 weak_ptr_factory_.GetWeakPtr(), error_callback)); |
596 } | 596 } |
597 | 597 |
598 void BluetoothDeviceBlueZ::UpdateServiceData() { | |
599 bluez::BluetoothDeviceClient::Properties* properties = | |
600 bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetProperties( | |
601 object_path_); | |
602 DCHECK(properties); | |
603 DCHECK(properties->service_data.is_valid()); | |
ortuno
2016/10/05 06:27:10
Does bluez cache service data i.e. if a device sto
puthik_chromium
2016/10/06 01:49:56
Add comment in header file instead.
- BlueZ won't
| |
604 | |
605 service_data_.clear(); | |
606 for (const auto& pair : properties->service_data.value()) { | |
607 service_data_.insert(std::pair<BluetoothUUID, std::vector<uint8_t>>( | |
608 BluetoothUUID(pair.first), pair.second)); | |
609 } | |
610 } | |
611 | |
598 BluetoothPairingBlueZ* BluetoothDeviceBlueZ::BeginPairing( | 612 BluetoothPairingBlueZ* BluetoothDeviceBlueZ::BeginPairing( |
599 BluetoothDevice::PairingDelegate* pairing_delegate) { | 613 BluetoothDevice::PairingDelegate* pairing_delegate) { |
600 pairing_.reset(new BluetoothPairingBlueZ(this, pairing_delegate)); | 614 pairing_.reset(new BluetoothPairingBlueZ(this, pairing_delegate)); |
601 return pairing_.get(); | 615 return pairing_.get(); |
602 } | 616 } |
603 | 617 |
604 void BluetoothDeviceBlueZ::EndPairing() { | 618 void BluetoothDeviceBlueZ::EndPairing() { |
605 pairing_.reset(); | 619 pairing_.reset(); |
606 } | 620 } |
607 | 621 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
901 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, | 915 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, |
902 const std::string& error_name, | 916 const std::string& error_name, |
903 const std::string& error_message) { | 917 const std::string& error_message) { |
904 LOG(WARNING) << object_path_.value() | 918 LOG(WARNING) << object_path_.value() |
905 << ": Failed to remove device: " << error_name << ": " | 919 << ": Failed to remove device: " << error_name << ": " |
906 << error_message; | 920 << error_message; |
907 error_callback.Run(); | 921 error_callback.Run(); |
908 } | 922 } |
909 | 923 |
910 } // namespace bluez | 924 } // namespace bluez |
OLD | NEW |