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

Side by Side Diff: chromeos/dbus/bluetooth_media_client.h

Issue 1347193004: Refactor DBusThreadManager to split away BT clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/callback.h"
13 #include "base/values.h"
14 #include "chromeos/chromeos_export.h"
15 #include "chromeos/dbus/dbus_client.h"
16 #include "dbus/object_path.h"
17 #include "dbus/property.h"
18
19 namespace chromeos {
20
21 // BluetoothMediaClient is used to communicate with the Media interface of a
22 // local Bluetooth adapter.
23 class CHROMEOS_EXPORT BluetoothMediaClient : public DBusClient {
24 public:
25 // Properties used to register a Media Endpoint.
26 struct CHROMEOS_EXPORT EndpointProperties {
27 EndpointProperties();
28 ~EndpointProperties();
29
30 // UUID of the profile implemented by the endpoint.
31 std::string uuid;
32
33 // Assigned codec value supported by the endpoint. The byte should match the
34 // codec specification indicated by the UUID.
35 // Since SBC codec is mandatory for A2DP, the default value of codec should
36 // be 0x00.
37 uint8_t codec;
38
39 // Capabilities of the endpoints. The order of bytes should match the bit
40 // arrangement in the specification indicated by the UUID.
41 std::vector<uint8_t> capabilities;
42 };
43
44 class Observer {
45 public:
46 virtual ~Observer() {}
47
48 // Called when the Media object with object path |object_path| is added to
49 // the system.
50 virtual void MediaAdded(const dbus::ObjectPath& object_path) {}
51
52 // Called when the Media object with object path |object_path| is removed
53 // from the system.
54 virtual void MediaRemoved(const dbus::ObjectPath& object_path) {}
55 };
56
57 // Constants used to indicate exceptional error conditions.
58 static const char kNoResponseError[];
59
60 // The string representation for the 128-bit UUID for A2DP Sink.
61 static const char kBluetoothAudioSinkUUID[];
62
63 ~BluetoothMediaClient() override;
64
65 // The ErrorCallback is used by media API methods to indicate failure.
66 // It receives two arguments: the name of the error in |error_name| and
67 // an optional message in |error_message|.
68 typedef base::Callback<void(const std::string& error_name,
69 const std::string& error_message)> ErrorCallback;
70
71 // Adds and removes observers for events on all Media objects. Check the
72 // |object_path| parameter of observer methods to determine which Media object
73 // is issuing the event.
74 virtual void AddObserver(Observer* observer) = 0;
75 virtual void RemoveObserver(Observer* observer) = 0;
76
77 // Registers a media endpoint to sender at the D-Bus object path
78 // |endpoint_path|. |properties| specifies profile UUID which the endpoint is
79 // for, Codec implemented by the endpoint and the Capabilities of the
80 // endpoint.
81 virtual void RegisterEndpoint(const dbus::ObjectPath& object_path,
82 const dbus::ObjectPath& endpoint_path,
83 const EndpointProperties& properties,
84 const base::Closure& callback,
85 const ErrorCallback& error_callback) = 0;
86
87 // Unregisters the media endpoint with the D-Bus object path |endpoint_path|.
88 virtual void UnregisterEndpoint(const dbus::ObjectPath& object_path,
89 const dbus::ObjectPath& endpoint_path,
90 const base::Closure& callback,
91 const ErrorCallback& error_callback) = 0;
92
93 // TODO(mcchou): The RegisterPlayer and UnregisterPlayer methods are not
94 // included, since they are not used. These two methods may be added later.
95
96 static BluetoothMediaClient* Create();
97
98 protected:
99 BluetoothMediaClient();
100
101 private:
102 DISALLOW_COPY_AND_ASSIGN(BluetoothMediaClient);
103 };
104
105 } // namespace chromeos
106
107 #endif // CHROMEOS_DBUS_BLUETOOTH_MEDIA_CLIENT_H_
OLDNEW
« no previous file with comments | « chromeos/dbus/bluetooth_le_advertising_manager_client.cc ('k') | chromeos/dbus/bluetooth_media_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698