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

Unified Diff: chromeos/dbus/fake_bluetooth_device_client.cc

Issue 735893002: Add GetConnectionInfo function for BluetoothDevice, replacing the existing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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: chromeos/dbus/fake_bluetooth_device_client.cc
diff --git a/chromeos/dbus/fake_bluetooth_device_client.cc b/chromeos/dbus/fake_bluetooth_device_client.cc
index 87b6591d9315fdfbf17977704b8ef125e4414c1b..4ec8ce0342cf0033fb33313a0069b819d773d296 100644
--- a/chromeos/dbus/fake_bluetooth_device_client.cc
+++ b/chromeos/dbus/fake_bluetooth_device_client.cc
@@ -221,7 +221,9 @@ FakeBluetoothDeviceClient::FakeBluetoothDeviceClient()
discovery_simulation_step_(0),
incoming_pairing_simulation_step_(0),
pairing_cancelled_(false),
- connection_monitor_started_(false) {
+ connection_rssi_(0),
+ transmit_power_(0),
+ max_transmit_power_(0) {
Properties* properties = new Properties(base::Bind(
&FakeBluetoothDeviceClient::OnPropertyChanged,
base::Unretained(this),
@@ -461,21 +463,17 @@ void FakeBluetoothDeviceClient::CancelPairing(
callback.Run();
}
-void FakeBluetoothDeviceClient::StartConnectionMonitor(
+void FakeBluetoothDeviceClient::GetConnInfo(
const dbus::ObjectPath& object_path,
- const base::Closure& callback,
+ const ConnInfoCallback& callback,
const ErrorCallback& error_callback) {
- VLOG(1) << "StartConnectionMonitor: " << object_path.value();
- connection_monitor_started_ = true;
- callback.Run();
-}
+ Properties* properties = GetProperties(object_path);
+ if (!properties->connected.value()) {
+ error_callback.Run("org.bluez.Error.NotConnected", "Not Connected");
+ return;
+ }
-void FakeBluetoothDeviceClient::StopConnectionMonitor(
- const dbus::ObjectPath& object_path,
- const base::Closure& callback,
- const ErrorCallback& error_callback) {
- connection_monitor_started_ = false;
- callback.Run();
+ callback.Run(connection_rssi_, transmit_power_, max_transmit_power_);
}
void FakeBluetoothDeviceClient::BeginDiscoverySimulation(
@@ -1019,6 +1017,15 @@ void FakeBluetoothDeviceClient::UpdateDeviceRSSI(
properties->rssi.ReplaceValue(rssi);
}
+void FakeBluetoothDeviceClient::UpdateConnectionInfo(
+ uint16 connection_rssi,
+ uint16 transmit_power,
+ uint16 max_transmit_power) {
+ connection_rssi_ = connection_rssi;
+ transmit_power_ = transmit_power;
+ max_transmit_power_ = max_transmit_power;
+}
+
void FakeBluetoothDeviceClient::PinCodeCallback(
const dbus::ObjectPath& object_path,
const base::Closure& callback,

Powered by Google App Engine
This is Rietveld 408576698