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

Unified Diff: chromeos/dbus/fake_bluetooth_device_client.cc

Issue 14048007: Bluetooth: D-Bus client interface for org.bluez.Input1 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fake device simulates the input Created 7 years, 8 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/experimental_bluetooth_input_client.cc ('k') | chromeos/dbus/fake_bluetooth_input_client.h » ('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 00c8df4009832f704516736a16d4ff1a7a82996d..d12b42e41d7fb7a13a96b0860dce26ad158f63b1 100644
--- a/chromeos/dbus/fake_bluetooth_device_client.cc
+++ b/chromeos/dbus/fake_bluetooth_device_client.cc
@@ -19,6 +19,7 @@
#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
#include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
#include "chromeos/dbus/fake_bluetooth_agent_service_provider.h"
+#include "chromeos/dbus/fake_bluetooth_input_client.h"
#include "dbus/object_path.h"
#include "third_party/cros_system_api/dbus/service_constants.h"
@@ -416,6 +417,12 @@ void FakeBluetoothDeviceClient::RemoveDevice(
FOR_EACH_OBSERVER(ExperimentalBluetoothDeviceClient::Observer, observers_,
DeviceRemoved(device_path));
+ // Remove the Input interface if it exists.
+ FakeBluetoothInputClient* fake_bluetooth_input_client =
+ static_cast<FakeBluetoothInputClient*>(
+ DBusThreadManager::Get()->GetExperimentalBluetoothInputClient());
+ fake_bluetooth_input_client->RemoveInputDevice(device_path);
+
delete properties;
properties_map_.erase(iter);
}
@@ -628,6 +635,22 @@ void FakeBluetoothDeviceClient::CompleteSimulatedPairing(
properties->paired.ReplaceValue(true);
+ // If the paired device is a HID device based on it's bluetooth class,
+ // simulate the Input interface.
+ FakeBluetoothInputClient* fake_bluetooth_input_client =
+ static_cast<FakeBluetoothInputClient*>(
+ DBusThreadManager::Get()->GetExperimentalBluetoothInputClient());
+
+ if ((properties->bluetooth_class.value() & 0x001f03) == 0x000500) {
+ std::vector<std::string> uuids = properties->uuids.value();
+ if (std::find(uuids.begin(), uuids.end(),
+ "00001124-0000-1000-8000-00805f9b34fb") == uuids.end()) {
+ uuids.push_back("00001124-0000-1000-8000-00805f9b34fb");
+ properties->uuids.ReplaceValue(uuids);
+ fake_bluetooth_input_client->AddInputDevice(object_path);
+ }
+ }
keybuk 2013/04/18 22:37:44 This also needs to be run in the Connect() functio
deymo 2013/04/18 23:21:02 CompleteSimulatedPairing is called also for the Mi
keybuk 2013/04/18 23:45:09 It is, but for the "test a connect failing after p
deymo 2013/04/19 01:23:22 Done.
+
callback.Run();
properties->NotifyPropertyChanged(properties->paired.name());
}
« no previous file with comments | « chromeos/dbus/experimental_bluetooth_input_client.cc ('k') | chromeos/dbus/fake_bluetooth_input_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698