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

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: fix compile errors on other platforms Created 5 years, 11 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
« no previous file with comments | « chromeos/dbus/fake_bluetooth_device_client.h ('k') | device/bluetooth/bluetooth_adapter_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « chromeos/dbus/fake_bluetooth_device_client.h ('k') | device/bluetooth/bluetooth_adapter_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698