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

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

Issue 725383003: chromeos/dbus: Add BlueZ Media Endpoint Service Provider API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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_ENDPOINT_SERVICE_PROVIDER_H_
6 #define CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "chromeos/chromeos_export.h"
12 #include "dbus/bus.h"
13 #include "dbus/message.h"
14 #include "dbus/object_path.h"
15
16 namespace chromeos {
17
18 // BluetoothMediaEndpointServiceProvider is used to provide a D-Bus object that
19 // the bluetooth daemon can commuicate with to serve as media source/sink.
Ben Chan 2014/11/16 18:57:56 bluetooth -> Bluetooth as media -> as a media
Miao 2014/11/17 20:51:02 Done.
20 //
21 // Instantiate with a chosen D-Bus object path and a delegate object, and pass
22 // chromsthe D-Bus object path as |endpoint_path| argument to the
Ben Chan 2014/11/16 18:57:56 chromsthe -> the
Miao 2014/11/17 20:51:02 Done.
23 // chromeos::BluetoothMediaClient::RegisterEndoint() method.
24 //
25 // After initiateing a connection between an audio source and an audio sink, the
Ben Chan 2014/11/16 18:57:56 initiateing -> initiating
Miao 2014/11/17 20:51:02 Done.
26 // Bluetooth daemon will make calls to this endpoint object and they will be
27 // passed to user's Delegate object for handling. Responses should be returned
28 // using the callbacks supplied to this methods.
Ben Chan 2014/11/16 18:57:56 this methods? these methods or this method? actu
Miao 2014/11/17 20:51:02 Done.
29 class CHROMEOS_EXPORT BluetoothMediaEndpointServiceProvider {
30 public:
31 // Delegate is the interface for reacting to endpoint requests. User
32 // applications will implement this interface to handle either A2DP Sink or
33 // Source.
34 class Delegate {
35 public:
36 virtual ~Delegate() {}
37
38 // SelectConfigurationCallback is used for the SelectConfiguration() method,
39 // it should be called with two arguements, the |configuration| which is
40 // agreed by the application and the |length| of |configuration|.
41 typedef base::Callback<void(const uint8_t*, size_t)>
42 SelectConfigurationCallback;
43
44 // This method will be called after an Audio Source receives the agreed
45 // capabilities from the Audio Sink to set the configuration for the
46 // media transport object. |transport_path| is the path to the
47 // MediaTransport object, and |properties| are the properties for that
48 // MediaTransport object.
49 virtual void SetConfiguration(const dbus::ObjectPath& transport_path,
50 const dbus::MessageReader& properties) = 0;
51
52 // This method will be called when an Audio Source connects to an Audio Sink
53 // and asks it to decide the configuration to be used during the oncoming
54 // streaing. Audio Sources provide |capabilities| as a reference, where
Ben Chan 2014/11/16 18:57:56 streaing -> streaming
Miao 2014/11/17 20:51:02 Done.
55 // a user application can use this |capabilities| to figure out
Ben Chan 2014/11/16 18:57:56 this |capabilities| -> these |capabilities|
Miao 2014/11/17 20:51:02 Done.
56 // a well-matched configuration and return it to the Audio Source via
57 // |callback|.
58 virtual void SelectConfiguration(
59 const uint8_t* capabilities,
60 size_t length,
61 const SelectConfigurationCallback& callback) = 0;
62
63 // This method will be called when an Audio Source disconnects to an Audio
Ben Chan 2014/11/16 18:57:56 disconnects to -> disconnects from
Miao 2014/11/17 20:51:02 Done.
64 // Sink. A user applications is supposed to clear any of its resources which
Ben Chan 2014/11/16 18:57:56 applications -> application
Miao 2014/11/17 20:51:02 Done.
65 // it keeps for that partiular connection. |transport_path| is the Media
Ben Chan 2014/11/16 18:57:56 partiular -> particular
Miao 2014/11/17 20:51:02 Done.
66 // Transport object which has been kept by an endpoint during the
67 // connection.
68 virtual void ClearConfiguration(const dbus::ObjectPath& transport_path) = 0;
69
70 // This method will be called when the Bluetooth daemon unregisters the
71 // Media Endpoint. Media Endpoint objects can use this method to clean up
72 // tasks. These is no need to unregister the endpoint, since when this
Ben Chan 2014/11/16 18:57:56 These -> There
Miao 2014/11/17 20:51:02 Done.
73 // method gets called, that endpoint has been unregistered.
74 virtual void Release() = 0;
75 };
76
77 virtual ~BluetoothMediaEndpointServiceProvider();
78
79 // Create the instance where |bus| is the D-Bus bus connection to export the
Ben Chan 2014/11/16 18:57:56 Create -> Creates (for consistency with comments i
Miao 2014/11/17 20:51:02 Done.
80 // object noto, |object_path| is the object path that it should have and
Ben Chan 2014/11/16 18:57:56 noto?
Miao 2014/11/17 20:51:02 Done.
81 // |delegate| is the object to which all method calls will be passed and
82 // responses generated from.
83 static BluetoothMediaEndpointServiceProvider* Create(
84 dbus::Bus* bus,
85 const dbus::ObjectPath& object_path,
86 Delegate* delegate);
87
88 protected:
89 BluetoothMediaEndpointServiceProvider();
90
91 private:
92 DISALLOW_COPY_AND_ASSIGN(BluetoothMediaEndpointServiceProvider);
93 };
94
95 } // namespace chromeos
96
97 #endif // CHROMEOS_DBUS_BLUETOOTH_MEDIA_ENDPOINT_SERVICE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698