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

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: Moved kBluetoothAudioSinkUUID to BluetoothMediaClient. 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 namespace {
12
13 // The default codec is SBC(0x00).
14 const uint8_t kDefaultCodec = 0x00;
armansito 2015/01/29 04:22:55 I'd move this to the header as a static const clas
Miao 2015/01/29 23:58:38 Done.
15
16 // Except for |kError|, the other two erros are defined in BlueZ D-Bus Media
17 // API.
18 const char kFailedError[] = "org.chromium.Error.Failed";
19 const char kInvalidArgumentsError[] = "org.chromium.Error.InvalidArguments";
20
21 } // namespace
22
7 namespace chromeos { 23 namespace chromeos {
8 24
9 FakeBluetoothMediaClient::FakeBluetoothMediaClient() { 25 FakeBluetoothMediaClient::FakeBluetoothMediaClient() {
10 } 26 }
11 27
12 FakeBluetoothMediaClient::~FakeBluetoothMediaClient() { 28 FakeBluetoothMediaClient::~FakeBluetoothMediaClient() {
13 } 29 }
14 30
15 void FakeBluetoothMediaClient::Init(dbus::Bus* bus) { 31 void FakeBluetoothMediaClient::Init(dbus::Bus* bus) {
16 } 32 }
17 33
18 void FakeBluetoothMediaClient::AddObserver( 34 void FakeBluetoothMediaClient::AddObserver(
19 BluetoothMediaClient::Observer* observer) { 35 BluetoothMediaClient::Observer* observer) {
20 DCHECK(observer); 36 DCHECK(observer);
21 observers_.AddObserver(observer); 37 observers_.AddObserver(observer);
22 } 38 }
23 39
24 void FakeBluetoothMediaClient::RemoveObserver( 40 void FakeBluetoothMediaClient::RemoveObserver(
25 BluetoothMediaClient::Observer* observer) { 41 BluetoothMediaClient::Observer* observer) {
26 DCHECK(observer); 42 DCHECK(observer);
27 observers_.RemoveObserver(observer); 43 observers_.RemoveObserver(observer);
28 } 44 }
29 45
30 // TODO(mcchou): Add method definition for |RegisterEndpoint|,
31 // |UnregisterEndpoint|, |RegisterPlayer| and |UnregisterPlayer|.
32 void FakeBluetoothMediaClient::RegisterEndpoint( 46 void FakeBluetoothMediaClient::RegisterEndpoint(
33 const dbus::ObjectPath& object_path, 47 const ObjectPath& object_path,
34 const dbus::ObjectPath& endpoint_path, 48 const ObjectPath& endpoint_path,
35 const EndpointProperties& properties, 49 const EndpointProperties& properties,
36 const base::Closure& callback, 50 const base::Closure& callback,
37 const ErrorCallback& error_callback) { 51 const ErrorCallback& error_callback) {
38 error_callback.Run("org.bluez.NotImplemented", ""); 52 VLOG(1) << "RegisterEndpoint: " << endpoint_path.value();
53
54 // The object paths of the media client and adapter client should be the same.
55 if (object_path != ObjectPath(FakeBluetoothAdapterClient::kAdapterPath) ||
56 properties.uuid != BluetoothMediaClient::kBluetoothAudioSinkUUID ||
57 properties.codec != kDefaultCodec ||
58 properties.capabilities.empty()) {
59 error_callback.Run(kInvalidArgumentsError, "");
60 return;
61 }
62 callback.Run();
39 } 63 }
40 64
41 void FakeBluetoothMediaClient::UnregisterEndpoint( 65 void FakeBluetoothMediaClient::UnregisterEndpoint(
42 const dbus::ObjectPath& object_path, 66 const ObjectPath& object_path,
43 const dbus::ObjectPath& endpoint_path, 67 const ObjectPath& endpoint_path,
44 const base::Closure& callback, 68 const base::Closure& callback,
45 const ErrorCallback& error_callback) { 69 const ErrorCallback& error_callback) {
46 error_callback.Run("org.bluez.NotImplemented", ""); 70 error_callback.Run(kFailedError, "");
armansito 2015/01/29 04:22:55 Add a TODO here for making this do something meani
Miao 2015/01/29 23:58:38 Done.
47 } 71 }
48 72
49 } // namespace chromeos 73 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698