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

Side by Side 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, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/dbus/fake_bluetooth_media_client.h" 5 #include "chromeos/dbus/fake_bluetooth_media_client.h"
6 6
7 #include <string>
8
9 #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
10
11 using dbus::ObjectPath;
12
13 namespace {
14
15 // Except for |kFailedError|, the other error is defined in BlueZ D-Bus Media
16 // API.
17 const char kFailedError[] = "org.chromium.Error.Failed";
18 const char kInvalidArgumentsError[] = "org.chromium.Error.InvalidArguments";
19
20 } // namespace
21
7 namespace chromeos { 22 namespace chromeos {
8 23
24 // static
25 const uint8_t FakeBluetoothMediaClient::kDefaultCodec = 0x00;
26
9 FakeBluetoothMediaClient::FakeBluetoothMediaClient() { 27 FakeBluetoothMediaClient::FakeBluetoothMediaClient() {
10 } 28 }
11 29
12 FakeBluetoothMediaClient::~FakeBluetoothMediaClient() { 30 FakeBluetoothMediaClient::~FakeBluetoothMediaClient() {
13 } 31 }
14 32
15 void FakeBluetoothMediaClient::Init(dbus::Bus* bus) { 33 void FakeBluetoothMediaClient::Init(dbus::Bus* bus) {
16 } 34 }
17 35
18 void FakeBluetoothMediaClient::AddObserver( 36 void FakeBluetoothMediaClient::AddObserver(
19 BluetoothMediaClient::Observer* observer) { 37 BluetoothMediaClient::Observer* observer) {
20 DCHECK(observer); 38 DCHECK(observer);
21 observers_.AddObserver(observer); 39 observers_.AddObserver(observer);
22 } 40 }
23 41
24 void FakeBluetoothMediaClient::RemoveObserver( 42 void FakeBluetoothMediaClient::RemoveObserver(
25 BluetoothMediaClient::Observer* observer) { 43 BluetoothMediaClient::Observer* observer) {
26 DCHECK(observer); 44 DCHECK(observer);
27 observers_.RemoveObserver(observer); 45 observers_.RemoveObserver(observer);
28 } 46 }
29 47
30 // TODO(mcchou): Add method definition for |RegisterEndpoint|,
31 // |UnregisterEndpoint|, |RegisterPlayer| and |UnregisterPlayer|.
32 void FakeBluetoothMediaClient::RegisterEndpoint( 48 void FakeBluetoothMediaClient::RegisterEndpoint(
33 const dbus::ObjectPath& object_path, 49 const ObjectPath& object_path,
34 const dbus::ObjectPath& endpoint_path, 50 const ObjectPath& endpoint_path,
35 const EndpointProperties& properties, 51 const EndpointProperties& properties,
36 const base::Closure& callback, 52 const base::Closure& callback,
37 const ErrorCallback& error_callback) { 53 const ErrorCallback& error_callback) {
38 error_callback.Run("org.bluez.NotImplemented", ""); 54 VLOG(1) << "RegisterEndpoint: " << endpoint_path.value();
55
56 // The object paths of the media client and adapter client should be the same.
57 if (object_path != ObjectPath(FakeBluetoothAdapterClient::kAdapterPath) ||
58 properties.uuid != BluetoothMediaClient::kBluetoothAudioSinkUUID ||
59 properties.codec != kDefaultCodec ||
60 properties.capabilities.empty()) {
61 error_callback.Run(kInvalidArgumentsError, "");
62 return;
63 }
64 callback.Run();
39 } 65 }
40 66
41 void FakeBluetoothMediaClient::UnregisterEndpoint( 67 void FakeBluetoothMediaClient::UnregisterEndpoint(
42 const dbus::ObjectPath& object_path, 68 const ObjectPath& object_path,
43 const dbus::ObjectPath& endpoint_path, 69 const ObjectPath& endpoint_path,
44 const base::Closure& callback, 70 const base::Closure& callback,
45 const ErrorCallback& error_callback) { 71 const ErrorCallback& error_callback) {
46 error_callback.Run("org.bluez.NotImplemented", ""); 72 // TODO(mcchou): Come up with some corresponding actions.
73 error_callback.Run(kFailedError, "");
47 } 74 }
48 75
49 } // namespace chromeos 76 } // namespace chromeos
OLDNEW
« 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