2010-09-15 20:05:15 +08:00
|
|
|
BlueZ D-Bus Media API description
|
|
|
|
*********************************
|
|
|
|
|
|
|
|
Media hierarchy
|
|
|
|
===============
|
|
|
|
|
|
|
|
Service org.bluez
|
|
|
|
Interface org.bluez.Media
|
|
|
|
Object path [variable prefix]/{hci0,hci1,...}
|
|
|
|
|
|
|
|
Methods void RegisterEndpoint(object endpoint, dict properties)
|
|
|
|
|
|
|
|
Register a local end point to sender, the sender can
|
|
|
|
register as many end points as it likes.
|
|
|
|
|
|
|
|
Note: If the sender disconnects the end points are
|
|
|
|
automatically unregistered.
|
|
|
|
|
|
|
|
possible properties:
|
|
|
|
|
|
|
|
string UUID:
|
|
|
|
|
|
|
|
UUID of the profile which the endpoint
|
|
|
|
is for.
|
|
|
|
|
|
|
|
byte Codec:
|
|
|
|
|
2012-04-12 23:03:09 +08:00
|
|
|
Assigned number of codec that the
|
2010-09-15 20:05:15 +08:00
|
|
|
endpoint implements. The values should
|
|
|
|
match the profile specification which
|
|
|
|
is indicated by the UUID.
|
|
|
|
|
|
|
|
array{byte} Capabilities:
|
|
|
|
|
|
|
|
Capabilities blob, it is used as it is
|
|
|
|
so the size and byte order must match.
|
|
|
|
|
2011-03-28 22:21:57 +08:00
|
|
|
Possible Errors: org.bluez.Error.InvalidArguments
|
|
|
|
org.bluez.Error.NotSupported - emitted
|
|
|
|
when interface for the end-point is
|
|
|
|
disabled.
|
|
|
|
|
2010-09-15 20:05:15 +08:00
|
|
|
void UnregisterEndpoint(object endpoint)
|
|
|
|
|
|
|
|
Unregister sender end point.
|
|
|
|
|
2011-10-06 04:02:15 +08:00
|
|
|
void RegisterPlayer(object player, dict properties,
|
|
|
|
dict metadata)
|
|
|
|
|
|
|
|
Register a media player object to sender, the sender
|
2012-10-23 20:02:42 +08:00
|
|
|
can register as many objects as it likes.
|
2011-10-06 04:02:15 +08:00
|
|
|
|
|
|
|
Note: If the sender disconnects its objects are
|
|
|
|
automatically unregistered.
|
|
|
|
|
|
|
|
Properties:
|
|
|
|
|
|
|
|
string Equalizer:
|
|
|
|
|
|
|
|
Possible values: "off" or "on"
|
|
|
|
|
|
|
|
string Repeat:
|
|
|
|
|
|
|
|
Possible values: "off", "singletrack",
|
|
|
|
"alltracks" or "group"
|
|
|
|
|
|
|
|
string Shuffle:
|
|
|
|
|
|
|
|
Possible values: "off", "alltracks" or
|
|
|
|
"group"
|
|
|
|
|
|
|
|
string Scan:
|
|
|
|
|
|
|
|
Possible values: "off", "alltracks" or
|
|
|
|
"group"
|
|
|
|
|
|
|
|
string Status:
|
|
|
|
|
|
|
|
Possible values: "playing", "stopped",
|
|
|
|
"paused",
|
|
|
|
"forward-seek",
|
|
|
|
"reverse-seek" or
|
|
|
|
"error"
|
|
|
|
|
|
|
|
uint32 Position
|
|
|
|
|
|
|
|
Playback position in milliseconds
|
|
|
|
|
|
|
|
Metadata:
|
|
|
|
|
|
|
|
string Title:
|
|
|
|
|
|
|
|
Track title name
|
|
|
|
|
|
|
|
string Artist:
|
|
|
|
|
|
|
|
Track artist name
|
|
|
|
|
|
|
|
string Album:
|
|
|
|
|
|
|
|
Track album name
|
|
|
|
|
|
|
|
string Genre:
|
|
|
|
|
|
|
|
Track genre name
|
|
|
|
|
|
|
|
uint32 NumberOfTracks:
|
|
|
|
|
|
|
|
Number of tracks in total
|
|
|
|
|
|
|
|
uint32 Number:
|
|
|
|
|
|
|
|
Track number
|
|
|
|
|
|
|
|
uint32 Duration:
|
|
|
|
|
|
|
|
Track duration in milliseconds
|
|
|
|
|
|
|
|
Possible Errors: org.bluez.Error.InvalidArguments
|
|
|
|
org.bluez.Error.NotSupported
|
|
|
|
|
|
|
|
void UnregisterPlayer(object player)
|
|
|
|
|
|
|
|
Unregister sender media player.
|
|
|
|
|
|
|
|
MediaPlayer hierarchy
|
|
|
|
=====================
|
|
|
|
|
2012-10-29 22:41:44 +08:00
|
|
|
Service unique name (Target role)
|
|
|
|
org.bluez (Controller role)
|
2011-10-06 04:02:15 +08:00
|
|
|
Interface org.bluez.MediaPlayer
|
2012-10-29 22:41:44 +08:00
|
|
|
Object path freely definable (Target role)
|
|
|
|
[variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/playerX
|
|
|
|
(Controller role)
|
2011-10-06 04:02:15 +08:00
|
|
|
|
2012-10-29 22:41:44 +08:00
|
|
|
Methods dict GetProperties()
|
|
|
|
|
|
|
|
Returns all properties for the interface. See the
|
|
|
|
properties section for available properties.
|
|
|
|
|
|
|
|
dict GetTrack()
|
|
|
|
|
|
|
|
Returns known metadata of the current track.
|
|
|
|
|
|
|
|
See TrackChanged for possible values.
|
|
|
|
|
|
|
|
void SetProperty(string property, variant value)
|
2011-10-06 04:02:15 +08:00
|
|
|
|
|
|
|
Changes the value of the specified property. Only
|
2011-10-12 23:11:12 +08:00
|
|
|
properties that are listed as read-write can be changed.
|
2011-10-06 04:02:15 +08:00
|
|
|
|
|
|
|
On success this will emit a PropertyChanged signal.
|
|
|
|
|
2011-10-28 15:49:20 +08:00
|
|
|
void Release()
|
|
|
|
|
|
|
|
This method gets called when the service daemon
|
|
|
|
unregisters the player which can then perform
|
|
|
|
cleanup tasks. There is no need to unregister the
|
|
|
|
player, because when this method gets called it has
|
|
|
|
already been unregistered.
|
|
|
|
|
2011-10-06 04:02:15 +08:00
|
|
|
Signals PropertyChanged(string setting, variant value)
|
|
|
|
|
|
|
|
This signal indicates a changed value of the given
|
|
|
|
property.
|
|
|
|
|
|
|
|
TrackChanged(dict metadata)
|
|
|
|
|
2011-10-13 20:57:02 +08:00
|
|
|
This signal indicates that current track has changed.
|
|
|
|
All available metadata for the new track shall be set
|
|
|
|
at once in the metadata argument. Metadata cannot be
|
|
|
|
updated in parts, otherwise it will be interpreted as
|
|
|
|
multiple track changes.
|
|
|
|
|
2011-10-06 04:02:15 +08:00
|
|
|
Possible values:
|
|
|
|
|
|
|
|
string Title:
|
|
|
|
|
|
|
|
Track title name
|
|
|
|
|
|
|
|
string Artist:
|
|
|
|
|
|
|
|
Track artist name
|
|
|
|
|
|
|
|
string Album:
|
|
|
|
|
|
|
|
Track album name
|
|
|
|
|
|
|
|
string Genre:
|
|
|
|
|
|
|
|
Track genre name
|
|
|
|
|
|
|
|
uint32 NumberOfTracks:
|
|
|
|
|
|
|
|
Number of tracks in total
|
|
|
|
|
|
|
|
uint32 Number:
|
|
|
|
|
|
|
|
Track number
|
|
|
|
|
|
|
|
uint32 Duration:
|
|
|
|
|
|
|
|
Track duration in milliseconds
|
|
|
|
|
|
|
|
Properties string Equalizer [readwrite]
|
|
|
|
|
|
|
|
Possible values: "off" or "on"
|
|
|
|
|
|
|
|
string Repeat [readwrite]
|
|
|
|
|
|
|
|
Possible values: "off", "singletrack", "alltracks" or
|
|
|
|
"group"
|
|
|
|
|
|
|
|
string Shuffle [readwrite]
|
|
|
|
|
|
|
|
Possible values: "off", "alltracks" or "group"
|
|
|
|
|
|
|
|
string Scan [readwrite]
|
|
|
|
|
|
|
|
Possible values: "off", "alltracks" or "group"
|
|
|
|
|
|
|
|
string Status [readonly]
|
|
|
|
|
|
|
|
Possible status: "playing", "stopped", "paused",
|
|
|
|
"forward-seek", "reverse-seek" or
|
|
|
|
"error"
|
|
|
|
|
|
|
|
uint32 Position [readonly]
|
|
|
|
|
2011-11-04 00:28:08 +08:00
|
|
|
Playback position in milliseconds. Changing the
|
|
|
|
position may generate additional events that will be
|
|
|
|
sent to the remote device. When position is 0 it means
|
|
|
|
the track is starting and when it's greater than or
|
|
|
|
equal to track's duration the track has ended. Note
|
|
|
|
that even if duration is not available in metadata it's
|
|
|
|
possible to signal its end by setting position to the
|
|
|
|
maximum uint32 value.
|
2011-10-06 04:02:15 +08:00
|
|
|
|
2010-09-15 20:05:15 +08:00
|
|
|
MediaEndpoint hierarchy
|
|
|
|
=======================
|
|
|
|
|
|
|
|
Service unique name
|
|
|
|
Interface org.bluez.MediaEndpoint
|
|
|
|
Object path freely definable
|
|
|
|
|
2010-09-20 22:41:51 +08:00
|
|
|
Methods void SetConfiguration(object transport, dict properties)
|
2010-09-15 20:05:15 +08:00
|
|
|
|
|
|
|
Set configuration for the transport.
|
|
|
|
|
|
|
|
array{byte} SelectConfiguration(array{byte} capabilities)
|
|
|
|
|
|
|
|
Select preferable configuration from the supported
|
|
|
|
capabilities.
|
|
|
|
|
|
|
|
Returns a configuration which can be used to setup
|
|
|
|
a transport.
|
|
|
|
|
|
|
|
Note: There is no need to cache the selected
|
|
|
|
configuration since on success the configuration is
|
|
|
|
send back as parameter of SetConfiguration.
|
|
|
|
|
2010-09-22 21:16:43 +08:00
|
|
|
void ClearConfiguration(object transport)
|
2010-09-15 20:05:15 +08:00
|
|
|
|
2010-09-22 21:16:43 +08:00
|
|
|
Clear transport configuration.
|
2010-09-15 20:05:15 +08:00
|
|
|
|
|
|
|
void Release()
|
|
|
|
|
|
|
|
This method gets called when the service daemon
|
|
|
|
unregisters the endpoint. An endpoint can use it to do
|
|
|
|
cleanup tasks. There is no need to unregister the
|
|
|
|
endpoint, because when this method gets called it has
|
|
|
|
already been unregistered.
|
|
|
|
|
|
|
|
MediaTransport hierarchy
|
|
|
|
========================
|
|
|
|
|
|
|
|
Service org.bluez
|
|
|
|
Interface org.bluez.MediaTransport
|
|
|
|
Object path [variable prefix]/{hci0,hci1,...}/dev_XX_XX_XX_XX_XX_XX/fdX
|
|
|
|
|
|
|
|
Methods dict GetProperties()
|
|
|
|
|
|
|
|
Returns all properties for the interface. See the
|
|
|
|
properties section for available properties.
|
|
|
|
|
2011-01-18 18:00:12 +08:00
|
|
|
fd, uint16, uint16 Acquire(string accesstype)
|
2010-09-15 20:05:15 +08:00
|
|
|
|
2011-01-18 18:00:12 +08:00
|
|
|
Acquire transport file descriptor and the MTU for read
|
|
|
|
and write respectively.
|
2010-09-15 20:05:15 +08:00
|
|
|
|
|
|
|
possible accesstype:
|
|
|
|
|
|
|
|
"r" : Read only access
|
|
|
|
|
|
|
|
"w" : Write only access
|
|
|
|
|
|
|
|
"rw": Read and write access
|
|
|
|
|
media: Extend media API with optional acquire
Acquiring a transport is needed in two different situations: either
we are initiating the audio stream locally, or the remote side initiated
it and thus we are just reacting. In the second case, we would expect
the stream is already available, and otherwise the operation should
fail. This means the media API needs to be extended in order to make
this difference.
This issue is specially relevant in the case of SCO, because the current
approach is racy. With HFP, for example (say BlueZ has the HS role), the
following race condition could be met:
1. Phone has an incoming call and thus starts in-band ringing.
2. SCO connection is accepted and stablished by BlueZ.
3. Gateway interface state is changed to Playing.
4. Exactly afterwards, the user routes the audio to the phone, to have
a private conversation. So the SCO link is closed.
5. In parallel, PulseAudio sees the transition to Playing, and acquires
the transport.
6. BlueZ receives an Acquire() request, but SCO is down. So it tries to
reconnect the SCO link.
The last step is an undesired behavior (the audio is routed back to the
car). BlueZ should be smart enough to know that the SCO connection
shouldn't be reestablished, but this is only possible if the endpoint
provides additional information in the media API.
Note that the API change introduced by this patch is backward
compatible, meaning that older versions of BlueZ will just ignore the
flag. So clients are encouraged to use it without necessarily adding a
dependency to newer versions of BlueZ.
2012-09-14 20:56:00 +08:00
|
|
|
The accesstype string can also be combined with a "?"
|
|
|
|
suffix, which will make the request optional. This
|
|
|
|
typically means the transport will only be acquired if
|
|
|
|
it is already available (remote-initiated), but
|
|
|
|
otherwise no request will be sent to the remote side.
|
|
|
|
In this last case the function will fail. Note that,
|
|
|
|
due to compatibility issues with older versions of
|
|
|
|
BlueZ, clients are encouraged to use exactly the same
|
|
|
|
accesstype for Release(), matching the string provided
|
|
|
|
to Acquire().
|
|
|
|
|
2010-09-15 20:05:15 +08:00
|
|
|
void Release(string accesstype)
|
|
|
|
|
|
|
|
Releases file descriptor.
|
|
|
|
|
|
|
|
void SetProperty(string name, variant value)
|
|
|
|
|
|
|
|
Changes the value of the specified property. Only
|
2012-06-27 21:27:36 +08:00
|
|
|
properties that are listed as read-write can be changed.
|
2010-09-15 20:05:15 +08:00
|
|
|
|
|
|
|
On success this will emit a PropertyChanged signal.
|
|
|
|
|
|
|
|
Signals void PropertyChanged(string name, variant value)
|
|
|
|
|
|
|
|
This signal indicates a changed value of the given
|
|
|
|
property.
|
|
|
|
|
|
|
|
Properties object Device [readonly]
|
|
|
|
|
|
|
|
Device object which the transport is connected to.
|
|
|
|
|
|
|
|
string UUID [readonly]
|
|
|
|
|
|
|
|
UUID of the profile which the transport is for.
|
|
|
|
|
|
|
|
byte Codec [readonly]
|
|
|
|
|
2012-04-12 23:03:09 +08:00
|
|
|
Assigned number of codec that the transport support.
|
2010-09-15 20:05:15 +08:00
|
|
|
The values should match the profile specification which
|
|
|
|
is indicated by the UUID.
|
|
|
|
|
|
|
|
array{byte} Configuration [readonly]
|
|
|
|
|
|
|
|
Configuration blob, it is used as it is so the size and
|
|
|
|
byte order must match.
|
|
|
|
|
2012-09-14 20:55:58 +08:00
|
|
|
string State [readonly]
|
|
|
|
|
|
|
|
Indicates the state of the transport. Possible
|
|
|
|
values are:
|
|
|
|
"idle": not streaming
|
|
|
|
"pending": streaming but not acquired
|
|
|
|
"active": streaming and acquired
|
|
|
|
|
2010-09-15 20:05:15 +08:00
|
|
|
uint16 Delay [readwrite]
|
|
|
|
|
2012-04-12 23:03:09 +08:00
|
|
|
Optional. Transport delay in 1/10 of millisecond, this
|
2010-09-15 20:05:15 +08:00
|
|
|
property is only writeable when the transport was
|
|
|
|
acquired by the sender.
|
|
|
|
|
|
|
|
boolean NREC [readwrite]
|
|
|
|
|
|
|
|
Optional. Indicates if echo cancelling and noise
|
|
|
|
reduction functions are active in the transport, this
|
|
|
|
property is only writeable when the transport was
|
|
|
|
acquired by the sender.
|
|
|
|
|
|
|
|
boolean InbandRingtone [readwrite]
|
|
|
|
|
|
|
|
Optional. Indicates if the transport support sending
|
|
|
|
ringtones, this property is only writeable when the
|
|
|
|
transport was acquired by the sender.
|
2011-01-18 18:00:14 +08:00
|
|
|
|
|
|
|
string Routing [readonly]
|
|
|
|
|
|
|
|
Optional. Indicates where is the transport being routed
|
|
|
|
|
|
|
|
Possible Values: "HCI" or "PCM"
|
2012-05-24 21:22:48 +08:00
|
|
|
|
|
|
|
uint16 Volume [readwrite]
|
|
|
|
|
|
|
|
Optional. Indicates volume level of the transport,
|
|
|
|
this property is only writeable when the transport was
|
|
|
|
acquired by the sender.
|
|
|
|
|
|
|
|
Possible Values: 0-127
|