Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(360)

Side by Side Diff: device/bluetooth/bluez/bluetooth_device_bluez.cc

Issue 2369423003: bluetooth: Expose service data from BlueZ (Closed)
Patch Set: Fix comment Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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());
604
605 service_data_.clear();
606 for (const auto& pair : properties->service_data.value())
607 service_data_[BluetoothUUID(pair.first)] = pair.second;
608 }
609
598 BluetoothPairingBlueZ* BluetoothDeviceBlueZ::BeginPairing( 610 BluetoothPairingBlueZ* BluetoothDeviceBlueZ::BeginPairing(
599 BluetoothDevice::PairingDelegate* pairing_delegate) { 611 BluetoothDevice::PairingDelegate* pairing_delegate) {
600 pairing_.reset(new BluetoothPairingBlueZ(this, pairing_delegate)); 612 pairing_.reset(new BluetoothPairingBlueZ(this, pairing_delegate));
601 return pairing_.get(); 613 return pairing_.get();
602 } 614 }
603 615
604 void BluetoothDeviceBlueZ::EndPairing() { 616 void BluetoothDeviceBlueZ::EndPairing() {
605 pairing_.reset(); 617 pairing_.reset();
606 } 618 }
607 619
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback, 913 void BluetoothDeviceBlueZ::OnForgetError(const ErrorCallback& error_callback,
902 const std::string& error_name, 914 const std::string& error_name,
903 const std::string& error_message) { 915 const std::string& error_message) {
904 LOG(WARNING) << object_path_.value() 916 LOG(WARNING) << object_path_.value()
905 << ": Failed to remove device: " << error_name << ": " 917 << ": Failed to remove device: " << error_name << ": "
906 << error_message; 918 << error_message;
907 error_callback.Run(); 919 error_callback.Run();
908 } 920 }
909 921
910 } // namespace bluez 922 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_device_bluez.h ('k') | device/bluetooth/dbus/bluetooth_device_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698