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..325d95e69e94eeb90ae84de5e2fba40cf4c70691 100644 |
--- a/chromeos/dbus/fake_bluetooth_device_client.cc |
+++ b/chromeos/dbus/fake_bluetooth_device_client.cc |
@@ -44,6 +44,9 @@ const int kSimulationIntervalMs = 750; |
const int kMinRSSI = -90; |
const int kMaxRSSI = -30; |
+// The default value of connection info properties from GetConnInfo(). |
+const int kUnkownPower = 127; |
+ |
void SimulatedProfileSocket(int fd) { |
// Simulate a server-side socket of a profile; read data from the socket, |
@@ -221,7 +224,9 @@ FakeBluetoothDeviceClient::FakeBluetoothDeviceClient() |
discovery_simulation_step_(0), |
incoming_pairing_simulation_step_(0), |
pairing_cancelled_(false), |
- connection_monitor_started_(false) { |
+ connection_rssi_(kUnkownPower), |
+ transmit_power_(kUnkownPower), |
+ max_transmit_power_(kUnkownPower) { |
Properties* properties = new Properties(base::Bind( |
&FakeBluetoothDeviceClient::OnPropertyChanged, |
base::Unretained(this), |
@@ -461,21 +466,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 +1020,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, |