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, |