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

Unified Diff: device/bluetooth/bluez/bluetooth_device_bluez.cc

Issue 2102093003: Implement BluetoothDeviceBlueZ::GetServiceRecords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/bluez/bluetooth_device_bluez.cc
diff --git a/device/bluetooth/bluez/bluetooth_device_bluez.cc b/device/bluetooth/bluez/bluetooth_device_bluez.cc
index b2e0d5210076ea7006c5a7b40b25e727f3835691..affe9ab967bf339664fd7ce3604ff657f7d0268b 100644
--- a/device/bluetooth/bluez/bluetooth_device_bluez.cc
+++ b/device/bluetooth/bluez/bluetooth_device_bluez.cc
@@ -554,10 +554,13 @@ void BluetoothDeviceBlueZ::CreateGattConnection(
error_callback);
}
-std::vector<BluetoothServiceRecordBlueZ*>
-BluetoothDeviceBlueZ::GetServiceRecords() {
- // TODO(rkc): Implement this.
- return std::vector<BluetoothServiceRecordBlueZ*>();
+void BluetoothDeviceBlueZ::GetServiceRecords(
+ const GetServiceRecordsCallback& callback,
+ const GetServiceRecordsErrorCallback& error_callback) {
+ bluez::BluezDBusManager::Get()->GetBluetoothDeviceClient()->GetServiceRecords(
+ object_path_, callback,
+ base::Bind(&BluetoothDeviceBlueZ::OnGetServiceRecordsError,
+ weak_ptr_factory_.GetWeakPtr(), error_callback));
}
BluetoothPairingBlueZ* BluetoothDeviceBlueZ::BeginPairing(
@@ -704,6 +707,21 @@ void BluetoothDeviceBlueZ::OnGetConnInfoError(
callback.Run(ConnectionInfo());
}
+void BluetoothDeviceBlueZ::OnGetServiceRecordsError(
+ const GetServiceRecordsErrorCallback& error_callback,
+ const std::string& error_name,
+ const std::string& error_message) {
+ VLOG(1) << object_path_.value()
+ << ": Failed to get service records: " << error_name << ": "
+ << error_message;
+ BluetoothServiceRecordBlueZ::ErrorCode code =
+ BluetoothServiceRecordBlueZ::ErrorCode::UNKNOWN;
+ if (error_name == bluetooth_device::kErrorNotConnected) {
+ code = BluetoothServiceRecordBlueZ::ErrorCode::ERROR_DEVICE_DISCONNECTED;
+ }
+ error_callback.Run(code);
+}
+
void BluetoothDeviceBlueZ::ConnectInternal(
bool after_pairing,
const base::Closure& callback,
« no previous file with comments | « device/bluetooth/bluez/bluetooth_device_bluez.h ('k') | device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698