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

Unified Diff: chromeos/dbus/fake_bluetooth_media_client.cc

Issue 876153002: device/bluetooth:Implement Register() for BluetoothAudioSinkChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marked BluetoothAudioSink with DEVICE_BLUETOOTH_EXPORT. 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_media_client.h ('k') | device/bluetooth/bluetooth_adapter_chromeos.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_bluetooth_media_client.cc
diff --git a/chromeos/dbus/fake_bluetooth_media_client.cc b/chromeos/dbus/fake_bluetooth_media_client.cc
index 3e57b91f439b858851fe17f5532d4b8d8440f12e..a4a77d3a9294c822866fe231c7a1bb2c9ef4099f 100644
--- a/chromeos/dbus/fake_bluetooth_media_client.cc
+++ b/chromeos/dbus/fake_bluetooth_media_client.cc
@@ -4,8 +4,26 @@
#include "chromeos/dbus/fake_bluetooth_media_client.h"
+#include <string>
+
+#include "chromeos/dbus/fake_bluetooth_adapter_client.h"
+
+using dbus::ObjectPath;
+
+namespace {
+
+// Except for |kFailedError|, the other error is defined in BlueZ D-Bus Media
+// API.
+const char kFailedError[] = "org.chromium.Error.Failed";
+const char kInvalidArgumentsError[] = "org.chromium.Error.InvalidArguments";
+
+} // namespace
+
namespace chromeos {
+// static
+const uint8_t FakeBluetoothMediaClient::kDefaultCodec = 0x00;
+
FakeBluetoothMediaClient::FakeBluetoothMediaClient() {
}
@@ -27,23 +45,32 @@ void FakeBluetoothMediaClient::RemoveObserver(
observers_.RemoveObserver(observer);
}
-// TODO(mcchou): Add method definition for |RegisterEndpoint|,
-// |UnregisterEndpoint|, |RegisterPlayer| and |UnregisterPlayer|.
void FakeBluetoothMediaClient::RegisterEndpoint(
- const dbus::ObjectPath& object_path,
- const dbus::ObjectPath& endpoint_path,
+ const ObjectPath& object_path,
+ const ObjectPath& endpoint_path,
const EndpointProperties& properties,
const base::Closure& callback,
const ErrorCallback& error_callback) {
- error_callback.Run("org.bluez.NotImplemented", "");
+ VLOG(1) << "RegisterEndpoint: " << endpoint_path.value();
+
+ // The object paths of the media client and adapter client should be the same.
+ if (object_path != ObjectPath(FakeBluetoothAdapterClient::kAdapterPath) ||
+ properties.uuid != BluetoothMediaClient::kBluetoothAudioSinkUUID ||
+ properties.codec != kDefaultCodec ||
+ properties.capabilities.empty()) {
+ error_callback.Run(kInvalidArgumentsError, "");
+ return;
+ }
+ callback.Run();
}
void FakeBluetoothMediaClient::UnregisterEndpoint(
- const dbus::ObjectPath& object_path,
- const dbus::ObjectPath& endpoint_path,
+ const ObjectPath& object_path,
+ const ObjectPath& endpoint_path,
const base::Closure& callback,
const ErrorCallback& error_callback) {
- error_callback.Run("org.bluez.NotImplemented", "");
+ // TODO(mcchou): Come up with some corresponding actions.
+ error_callback.Run(kFailedError, "");
}
} // namespace chromeos
« no previous file with comments | « chromeos/dbus/fake_bluetooth_media_client.h ('k') | device/bluetooth/bluetooth_adapter_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698