Index: device/bluetooth/bluetooth_device_chromeos.cc |
diff --git a/device/bluetooth/bluetooth_device_chromeos.cc b/device/bluetooth/bluetooth_device_chromeos.cc |
index 05359279bcd46aa6a3c71a3ed6bf0e50340abd76..bec44778638da5af7597c672f05b301f07d4667f 100644 |
--- a/device/bluetooth/bluetooth_device_chromeos.cc |
+++ b/device/bluetooth/bluetooth_device_chromeos.cc |
@@ -223,18 +223,31 @@ uint16 BluetoothDeviceChromeOS::GetDeviceID() const { |
} |
int BluetoothDeviceChromeOS::GetRSSI() const { |
- NOTIMPLEMENTED(); |
- return kUnknownPower; |
+ BluetoothDeviceClient::Properties* properties = |
+ DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( |
+ object_path_); |
+ DCHECK(properties); |
+ |
+ return IsConnected() ? properties->connection_rssi.value() |
+ : properties->inquiry_rssi.value(); |
keybuk
2014/05/09 00:35:25
Do we really want to conflate these properties int
Tim Song
2014/05/09 02:55:29
It does make sense to have a connection RSSI and a
keybuk
2014/05/09 18:22:07
That separate CL will be much easier if you only s
Tim Song
2014/05/09 19:01:35
Done.
|
} |
int BluetoothDeviceChromeOS::GetCurrentHostTransmitPower() const { |
- NOTIMPLEMENTED(); |
- return kUnknownPower; |
+ BluetoothDeviceClient::Properties* properties = |
+ DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( |
+ object_path_); |
+ DCHECK(properties); |
+ |
+ return IsConnected() ? properties->tx_power.value() : kUnknownPower; |
} |
int BluetoothDeviceChromeOS::GetMaximumHostTransmitPower() const { |
- NOTIMPLEMENTED(); |
- return kUnknownPower; |
+ BluetoothDeviceClient::Properties* properties = |
+ DBusThreadManager::Get()->GetBluetoothDeviceClient()->GetProperties( |
+ object_path_); |
+ DCHECK(properties); |
+ |
+ return IsConnected() ? properties->tx_power_max.value() : kUnknownPower; |
} |
bool BluetoothDeviceChromeOS::IsPaired() const { |
@@ -548,6 +561,7 @@ void BluetoothDeviceChromeOS::OnConnect(bool after_pairing, |
<< " still in progress"; |
SetTrusted(); |
+ StartConnectionMonitor(); |
keybuk
2014/05/09 00:35:25
NAK, doing a connection monitor for every single p
Tim Song
2014/05/09 02:55:29
In that case, should we add an API in chrome.bluet
keybuk
2014/05/09 18:22:07
Yes.
Tim Song
2014/05/09 19:01:35
Okay, I'll add this API function in the other CL.
|
if (after_pairing) |
UMA_HISTOGRAM_ENUMERATION("Bluetooth.PairingResult", |
@@ -655,6 +669,22 @@ void BluetoothDeviceChromeOS::OnSetTrusted(bool success) { |
<< ": Failed to set device as trusted"; |
} |
+void BluetoothDeviceChromeOS::StartConnectionMonitor() { |
+ DBusThreadManager::Get()->GetBluetoothDeviceClient()->StartConnectionMonitor( |
+ object_path_, |
+ base::Bind(&base::DoNothing), |
+ base::Bind(&BluetoothDeviceChromeOS::OnStartConnectionMonitorError, |
+ weak_ptr_factory_.GetWeakPtr())); |
+} |
+ |
+void BluetoothDeviceChromeOS::OnStartConnectionMonitorError( |
+ const std::string& error_name, |
+ const std::string& error_message) { |
+ LOG(WARNING) << object_path_.value() |
+ << ": Failed to start connection monitor: " << error_name << ": " |
+ << error_message; |
+} |
+ |
void BluetoothDeviceChromeOS::OnDisconnect(const base::Closure& callback) { |
VLOG(1) << object_path_.value() << ": Disconnected"; |
callback.Run(); |