Bluetooth Media
API Reference
Media Control Service
- group bt_mcs
Media Control Service (MCS)
Definitions and types related to the Media Control Service and Media Control Profile specifications.
- Since
3.0
- Version
0.8.0
Playback speeds
The playback speed (s) is calculated by the value of 2 to the power of p divided by 64.
All values from -128 to 127 allowed, only some examples defined.
-
BT_MCS_PLAYBACK_SPEED_MIN
Minimum playback speed, resulting in 25 % speed.
-
BT_MCS_PLAYBACK_SPEED_QUARTER
Quarter playback speed, resulting in 25 % speed.
-
BT_MCS_PLAYBACK_SPEED_HALF
Half playback speed, resulting in 50 % speed.
-
BT_MCS_PLAYBACK_SPEED_UNITY
Unity playback speed, resulting in 100 % speed.
-
BT_MCS_PLAYBACK_SPEED_DOUBLE
Double playback speed, resulting in 200 % speed.
-
BT_MCS_PLAYBACK_SPEED_MAX
Max playback speed, resulting in 395.7 % speed (nearly 400 %)
Seeking speed
The allowed values for seeking speed are the range -64 to -4 (endpoints included), the value 0, and the range 4 to 64 (endpoints included).
-
BT_MCS_SEEKING_SPEED_FACTOR_MAX
Maximum seeking speed - Can be negated.
-
BT_MCS_SEEKING_SPEED_FACTOR_MIN
Minimum seeking speed - Can be negated.
-
BT_MCS_SEEKING_SPEED_FACTOR_ZERO
No seeking.
Playing orders
-
BT_MCS_PLAYING_ORDER_SINGLE_ONCE
A single track is played once; there is no next track.
-
BT_MCS_PLAYING_ORDER_SINGLE_REPEAT
A single track is played repeatedly; the next track is the current track.
-
BT_MCS_PLAYING_ORDER_INORDER_ONCE
The tracks within a group are played once in track order.
-
BT_MCS_PLAYING_ORDER_INORDER_REPEAT
The tracks within a group are played in track order repeatedly.
-
BT_MCS_PLAYING_ORDER_OLDEST_ONCE
The tracks within a group are played once only from the oldest first.
-
BT_MCS_PLAYING_ORDER_OLDEST_REPEAT
The tracks within a group are played from the oldest first repeatedly.
-
BT_MCS_PLAYING_ORDER_NEWEST_ONCE
The tracks within a group are played once only from the newest first.
-
BT_MCS_PLAYING_ORDER_NEWEST_REPEAT
The tracks within a group are played from the newest first repeatedly.
-
BT_MCS_PLAYING_ORDER_SHUFFLE_ONCE
The tracks within a group are played in random order once.
-
BT_MCS_PLAYING_ORDER_SHUFFLE_REPEAT
The tracks within a group are played in random order repeatedly.
Playing orders supported
A bitmap, in the same order as the playing orders above.
Note that playing order 1 corresponds to bit 0, and so on.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_SINGLE_ONCE
A single track is played once; there is no next track.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_SINGLE_REPEAT
A single track is played repeatedly; the next track is the current track.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_INORDER_ONCE
The tracks within a group are played once in track order.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_INORDER_REPEAT
The tracks within a group are played in track order repeatedly.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_OLDEST_ONCE
The tracks within a group are played once only from the oldest first.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_OLDEST_REPEAT
The tracks within a group are played from the oldest first repeatedly.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_NEWEST_ONCE
The tracks within a group are played once only from the newest first.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_NEWEST_REPEAT
The tracks within a group are played from the newest first repeatedly.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_SHUFFLE_ONCE
The tracks within a group are played in random order once.
-
BT_MCS_PLAYING_ORDERS_SUPPORTED_SHUFFLE_REPEAT
The tracks within a group are played in random order repeatedly.
Media states
-
BT_MCS_MEDIA_STATE_INACTIVE
The current track is invalid, and no track has been selected.
-
BT_MCS_MEDIA_STATE_PLAYING
The media player is playing the current track.
-
BT_MCS_MEDIA_STATE_PAUSED
The current track is paused.
The media player has a current track, but it is not being played
-
BT_MCS_MEDIA_STATE_SEEKING
The current track is fast forwarding or fast rewinding.
Media control point opcodes
-
BT_MCS_OPC_PLAY
Start playing the current track.
-
BT_MCS_OPC_PAUSE
Pause playing the current track.
-
BT_MCS_OPC_FAST_REWIND
Fast rewind the current track.
-
BT_MCS_OPC_FAST_FORWARD
Fast forward the current track.
-
BT_MCS_OPC_STOP
Stop current activity and return to the paused state and set the current track position to the start of the current track.
-
BT_MCS_OPC_MOVE_RELATIVE
Set a new current track position relative to the current track position.
-
BT_MCS_OPC_PREV_SEGMENT
Set the current track position to the starting position of the previous segment of the current track.
-
BT_MCS_OPC_NEXT_SEGMENT
Set the current track position to the starting position of the next segment of the current track.
-
BT_MCS_OPC_FIRST_SEGMENT
Set the current track position to the starting position of the first segment of the current track.
-
BT_MCS_OPC_LAST_SEGMENT
Set the current track position to the starting position of the last segment of the current track.
-
BT_MCS_OPC_GOTO_SEGMENT
Set the current track position to the starting position of the nth segment of the current track.
-
BT_MCS_OPC_PREV_TRACK
Set the current track to the previous track based on the playing order.
-
BT_MCS_OPC_NEXT_TRACK
Set the current track to the next track based on the playing order.
-
BT_MCS_OPC_FIRST_TRACK
Set the current track to the first track based on the playing order.
-
BT_MCS_OPC_LAST_TRACK
Set the current track to the last track based on the playing order.
-
BT_MCS_OPC_GOTO_TRACK
Set the current track to the nth track based on the playing order.
-
BT_MCS_OPC_PREV_GROUP
Set the current group to the previous group in the sequence of groups.
-
BT_MCS_OPC_NEXT_GROUP
Set the current group to the next group in the sequence of groups.
-
BT_MCS_OPC_FIRST_GROUP
Set the current group to the first group in the sequence of groups.
-
BT_MCS_OPC_LAST_GROUP
Set the current group to the last group in the sequence of groups.
-
BT_MCS_OPC_GOTO_GROUP
Set the current group to the nth group in the sequence of groups.
Media control point supported opcodes values
-
BT_MCS_OPC_SUP_PLAY
Support the Play opcode.
-
BT_MCS_OPC_SUP_PAUSE
Support the Pause opcode.
-
BT_MCS_OPC_SUP_FAST_REWIND
Support the Fast Rewind opcode.
-
BT_MCS_OPC_SUP_FAST_FORWARD
Support the Fast Forward opcode.
-
BT_MCS_OPC_SUP_STOP
Support the Stop opcode.
-
BT_MCS_OPC_SUP_MOVE_RELATIVE
Support the Move Relative opcode.
-
BT_MCS_OPC_SUP_PREV_SEGMENT
Support the Previous Segment opcode.
-
BT_MCS_OPC_SUP_NEXT_SEGMENT
Support the Next Segment opcode.
-
BT_MCS_OPC_SUP_FIRST_SEGMENT
Support the First Segment opcode.
-
BT_MCS_OPC_SUP_LAST_SEGMENT
Support the Last Segment opcode.
-
BT_MCS_OPC_SUP_GOTO_SEGMENT
Support the Goto Segment opcode.
-
BT_MCS_OPC_SUP_PREV_TRACK
Support the Previous Track opcode.
-
BT_MCS_OPC_SUP_NEXT_TRACK
Support the Next Track opcode.
-
BT_MCS_OPC_SUP_FIRST_TRACK
Support the First Track opcode.
-
BT_MCS_OPC_SUP_LAST_TRACK
Support the Last Track opcode.
-
BT_MCS_OPC_SUP_GOTO_TRACK
Support the Goto Track opcode.
-
BT_MCS_OPC_SUP_PREV_GROUP
Support the Previous Group opcode.
-
BT_MCS_OPC_SUP_NEXT_GROUP
Support the Next Group opcode.
-
BT_MCS_OPC_SUP_FIRST_GROUP
Support the First Group opcode.
-
BT_MCS_OPC_SUP_LAST_GROUP
Support the Last Group opcode.
-
BT_MCS_OPC_SUP_GOTO_GROUP
Support the Goto Group opcode.
Media control point notification result codes
-
BT_MCS_OPC_NTF_SUCCESS
Action requested by the opcode write was completed successfully.
-
BT_MCS_OPC_NTF_NOT_SUPPORTED
An invalid or unsupported opcode was used for the Media Control Point write.
-
BT_MCS_OPC_NTF_PLAYER_INACTIVE
The Media Player State characteristic value is Inactive when the opcode is received or the result of the requested action of the opcode results in the Media Player State characteristic being set to Inactive.
-
BT_MCS_OPC_NTF_CANNOT_BE_COMPLETED
The requested action of any Media Control Point write cannot be completed successfully because of a condition within the player.
Search control point type values
Reference: Media Control Service spec v1.0 section 3.20.2
-
BT_MCS_SEARCH_TYPE_TRACK_NAME
Search for Track Name.
-
BT_MCS_SEARCH_TYPE_ARTIST_NAME
Search for Artist Name.
-
BT_MCS_SEARCH_TYPE_ALBUM_NAME
Search for Album Name.
-
BT_MCS_SEARCH_TYPE_GROUP_NAME
Search for Group Name.
-
BT_MCS_SEARCH_TYPE_EARLIEST_YEAR
Search for Earliest Year.
-
BT_MCS_SEARCH_TYPE_LATEST_YEAR
Search for Latest Year.
-
BT_MCS_SEARCH_TYPE_GENRE
Search for Genre.
-
BT_MCS_SEARCH_TYPE_ONLY_TRACKS
Search for Tracks only.
-
BT_MCS_SEARCH_TYPE_ONLY_GROUPS
Search for Groups only.
Search notification result codes
Reference: Media Control Service spec v1.0 section 3.20.2
-
BT_MCS_SCP_NTF_SUCCESS
Search request was accepted; search has started.
-
BT_MCS_SCP_NTF_FAILURE
Search request was invalid; no search started.
Group object object types
Reference: Media Control Service spec v1.0 section 4.4.1
-
BT_MCS_GROUP_OBJECT_TRACK_TYPE
Group object type is track.
-
BT_MCS_GROUP_OBJECT_GROUP_TYPE
Group object type is group.
Defines
-
BT_MCS_ERR_LONG_VAL_CHANGED
A characteristic value has changed while a Read Long Value Characteristic sub-procedure is in progress.
-
BT_MCS_OPCODES_SUPPORTED_LEN
Media control point supported opcodes length.
-
SEARCH_LEN_MIN
Search control point minimum length.
At least one search control item (SCI), consisting of the length octet and the type octet. (The * parameter field may be empty.)
-
SEARCH_LEN_MAX
Search control point maximum length.
-
SEARCH_SCI_LEN_MIN
Search control point item (SCI) minimum length.
An SCI length can be as little as one byte, for an SCI that has only the type field. (The SCI len is the length of type + param.)
-
SEARCH_PARAM_MAX
Search parameters maximum length
Media Proxy
- group bt_media_proxy
Media proxy module.
The media proxy module is the connection point between media players and media controllers.
- Since
3.0
- Version
0.8.0
A media player has (access to) media content and knows how to navigate and play this content. A media controller reads or gets information from a player and controls the player by setting player parameters and giving the player commands.
The media proxy module allows media player implementations to make themselves available to media controllers. And it allows controllers to access, and get updates from, any player.
The media proxy module allows both local and remote control of local player instances: A media controller may be a local application, or it may be a Media Control Service relaying requests from a remote Media Control Client. There may be either local or remote control, or both, or even multiple instances of each.
Playback speed parameters
All values from -128 to 127 allowed, only some defined
-
MEDIA_PROXY_PLAYBACK_SPEED_MIN
Minimum playback speed, resulting in 25 % speed.
-
MEDIA_PROXY_PLAYBACK_SPEED_QUARTER
Quarter playback speed, resulting in 25 % speed.
-
MEDIA_PROXY_PLAYBACK_SPEED_HALF
Half playback speed, resulting in 50 % speed.
-
MEDIA_PROXY_PLAYBACK_SPEED_UNITY
Unity playback speed, resulting in 100 % speed.
-
MEDIA_PROXY_PLAYBACK_SPEED_DOUBLE
Double playback speed, resulting in 200 % speed.
-
MEDIA_PROXY_PLAYBACK_SPEED_MAX
Max playback speed, resulting in 395.7 % speed (nearly 400 %)
Seeking speed factors
The allowed values for seeking speed are the range -64 to -4 (endpoints included), the value 0, and the range 4 to 64 (endpoints included).
-
MEDIA_PROXY_SEEKING_SPEED_FACTOR_MAX
Maximum seeking speed - Can be negated.
-
MEDIA_PROXY_SEEKING_SPEED_FACTOR_MIN
Minimum seeking speed - Can be negated.
-
MEDIA_PROXY_SEEKING_SPEED_FACTOR_ZERO
No seeking.
Playing orders
-
MEDIA_PROXY_PLAYING_ORDER_SINGLE_ONCE
A single track is played once; there is no next track.
-
MEDIA_PROXY_PLAYING_ORDER_SINGLE_REPEAT
A single track is played repeatedly; the next track is the current track.
-
MEDIA_PROXY_PLAYING_ORDER_INORDER_ONCE
The tracks within a group are played once in track order.
-
MEDIA_PROXY_PLAYING_ORDER_INORDER_REPEAT
The tracks within a group are played in track order repeatedly.
-
MEDIA_PROXY_PLAYING_ORDER_OLDEST_ONCE
The tracks within a group are played once only from the oldest first.
-
MEDIA_PROXY_PLAYING_ORDER_OLDEST_REPEAT
The tracks within a group are played from the oldest first repeatedly.
-
MEDIA_PROXY_PLAYING_ORDER_NEWEST_ONCE
The tracks within a group are played once only from the newest first.
-
MEDIA_PROXY_PLAYING_ORDER_NEWEST_REPEAT
The tracks within a group are played from the newest first repeatedly.
-
MEDIA_PROXY_PLAYING_ORDER_SHUFFLE_ONCE
The tracks within a group are played in random order once.
-
MEDIA_PROXY_PLAYING_ORDER_SHUFFLE_REPEAT
The tracks within a group are played in random order repeatedly.
Playing orders supported
A bitmap, in the same order as the playing orders above.
Note that playing order 1 corresponds to bit 0, and so on.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_SINGLE_ONCE
A single track is played once; there is no next track.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_SINGLE_REPEAT
A single track is played repeatedly; the next track is the current track.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_INORDER_ONCE
The tracks within a group are played once in track order.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_INORDER_REPEAT
The tracks within a group are played in track order repeatedly.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_OLDEST_ONCE
The tracks within a group are played once only from the oldest first.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_OLDEST_REPEAT
The tracks within a group are played from the oldest first repeatedly.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_NEWEST_ONCE
The tracks within a group are played once only from the newest first.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_NEWEST_REPEAT
The tracks within a group are played from the newest first repeatedly.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_SHUFFLE_ONCE
The tracks within a group are played in random order once.
-
MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_SHUFFLE_REPEAT
The tracks within a group are played in random order repeatedly.
Media player states
-
MEDIA_PROXY_STATE_INACTIVE
The current track is invalid, and no track has been selected.
-
MEDIA_PROXY_STATE_PLAYING
The media player is playing the current track.
-
MEDIA_PROXY_STATE_PAUSED
The current track is paused.
The media player has a current track, but it is not being played
-
MEDIA_PROXY_STATE_SEEKING
The current track is fast forwarding or fast rewinding.
-
MEDIA_PROXY_STATE_LAST
Used internally as the last state value.
Media player command opcodes
-
MEDIA_PROXY_OP_PLAY
Start playing the current track.
-
MEDIA_PROXY_OP_PAUSE
Pause playing the current track.
-
MEDIA_PROXY_OP_FAST_REWIND
Fast rewind the current track.
-
MEDIA_PROXY_OP_FAST_FORWARD
Fast forward the current track.
-
MEDIA_PROXY_OP_STOP
Stop current activity and return to the paused state and set the current track position to the start of the current track.
-
MEDIA_PROXY_OP_MOVE_RELATIVE
Set a new current track position relative to the current track position.
-
MEDIA_PROXY_OP_PREV_SEGMENT
Set the current track position to the starting position of the previous segment of the current track.
-
MEDIA_PROXY_OP_NEXT_SEGMENT
Set the current track position to the starting position of the next segment of the current track.
-
MEDIA_PROXY_OP_FIRST_SEGMENT
Set the current track position to the starting position of the first segment of the current track.
-
MEDIA_PROXY_OP_LAST_SEGMENT
Set the current track position to the starting position of the last segment of the current track.
-
MEDIA_PROXY_OP_GOTO_SEGMENT
Set the current track position to the starting position of the nth segment of the current track.
-
MEDIA_PROXY_OP_PREV_TRACK
Set the current track to the previous track based on the playing order.
-
MEDIA_PROXY_OP_NEXT_TRACK
Set the current track to the next track based on the playing order.
-
MEDIA_PROXY_OP_FIRST_TRACK
Set the current track to the first track based on the playing order.
-
MEDIA_PROXY_OP_LAST_TRACK
Set the current track to the last track based on the playing order.
-
MEDIA_PROXY_OP_GOTO_TRACK
Set the current track to the nth track based on the playing order.
-
MEDIA_PROXY_OP_PREV_GROUP
Set the current group to the previous group in the sequence of groups.
-
MEDIA_PROXY_OP_NEXT_GROUP
Set the current group to the next group in the sequence of groups.
-
MEDIA_PROXY_OP_FIRST_GROUP
Set the current group to the first group in the sequence of groups.
-
MEDIA_PROXY_OP_LAST_GROUP
Set the current group to the last group in the sequence of groups.
-
MEDIA_PROXY_OP_GOTO_GROUP
Set the current group to the nth group in the sequence of groups.
Unnamed Group
-
MEDIA_PROXY_OP_SUP_PLAY
Media player supported command opcodes.
Support the Play opcode
-
MEDIA_PROXY_OP_SUP_PAUSE
Support the Pause opcode.
-
MEDIA_PROXY_OP_SUP_FAST_REWIND
Support the Fast Rewind opcode.
-
MEDIA_PROXY_OP_SUP_FAST_FORWARD
Support the Fast Forward opcode.
-
MEDIA_PROXY_OP_SUP_STOP
Support the Stop opcode.
-
MEDIA_PROXY_OP_SUP_MOVE_RELATIVE
Support the Move Relative opcode.
-
MEDIA_PROXY_OP_SUP_PREV_SEGMENT
Support the Previous Segment opcode.
-
MEDIA_PROXY_OP_SUP_NEXT_SEGMENT
Support the Next Segment opcode.
-
MEDIA_PROXY_OP_SUP_FIRST_SEGMENT
Support the First Segment opcode.
-
MEDIA_PROXY_OP_SUP_LAST_SEGMENT
Support the Last Segment opcode.
-
MEDIA_PROXY_OP_SUP_GOTO_SEGMENT
Support the Goto Segment opcode.
-
MEDIA_PROXY_OP_SUP_PREV_TRACK
Support the Previous Track opcode.
-
MEDIA_PROXY_OP_SUP_NEXT_TRACK
Support the Next Track opcode.
-
MEDIA_PROXY_OP_SUP_FIRST_TRACK
Support the First Track opcode.
-
MEDIA_PROXY_OP_SUP_LAST_TRACK
Support the Last Track opcode.
-
MEDIA_PROXY_OP_SUP_GOTO_TRACK
Support the Goto Track opcode.
-
MEDIA_PROXY_OP_SUP_PREV_GROUP
Support the Previous Group opcode.
-
MEDIA_PROXY_OP_SUP_NEXT_GROUP
Support the Next Group opcode.
-
MEDIA_PROXY_OP_SUP_FIRST_GROUP
Support the First Group opcode.
-
MEDIA_PROXY_OP_SUP_LAST_GROUP
Support the Last Group opcode.
-
MEDIA_PROXY_OP_SUP_GOTO_GROUP
Support the Goto Group opcode.
Media player command result codes
-
MEDIA_PROXY_CMD_SUCCESS
Action requested by the opcode write was completed successfully.
-
MEDIA_PROXY_CMD_NOT_SUPPORTED
An invalid or unsupported opcode was used for the Media Control Point write.
-
MEDIA_PROXY_CMD_PLAYER_INACTIVE
The Media Player State characteristic value is Inactive when the opcode is received or the result of the requested action of the opcode results in the Media Player State characteristic being set to Inactive.
-
MEDIA_PROXY_CMD_CANNOT_BE_COMPLETED
The requested action of any Media Control Point write cannot be completed successfully because of a condition within the player.
Search operation type values
-
MEDIA_PROXY_SEARCH_TYPE_TRACK_NAME
Search for Track Name.
-
MEDIA_PROXY_SEARCH_TYPE_ARTIST_NAME
Search for Artist Name.
-
MEDIA_PROXY_SEARCH_TYPE_ALBUM_NAME
Search for Album Name.
-
MEDIA_PROXY_SEARCH_TYPE_GROUP_NAME
Search for Group Name.
-
MEDIA_PROXY_SEARCH_TYPE_EARLIEST_YEAR
Search for Earliest Year.
-
MEDIA_PROXY_SEARCH_TYPE_LATEST_YEAR
Search for Latest Year.
-
MEDIA_PROXY_SEARCH_TYPE_GENRE
Search for Genre.
-
MEDIA_PROXY_SEARCH_TYPE_ONLY_TRACKS
Search for Tracks only.
-
MEDIA_PROXY_SEARCH_TYPE_ONLY_GROUPS
Search for Groups only.
Search notification result codes
-
MEDIA_PROXY_SEARCH_SUCCESS
Search request was accepted; search has started.
-
MEDIA_PROXY_SEARCH_FAILURE
Search request was invalid; no search started.
Group object object types
-
MEDIA_PROXY_GROUP_OBJECT_TRACK_TYPE
Group object type is track.
-
MEDIA_PROXY_GROUP_OBJECT_GROUP_TYPE
Group object type is group.
Defines
-
MEDIA_PROXY_OPCODES_SUPPORTED_LEN
Media player supported opcodes length.
Functions
-
int media_proxy_ctrl_register(struct media_proxy_ctrl_cbs *ctrl_cbs)
Register a controller with the media_proxy.
- Parameters:
ctrl_cbs – Callbacks to the controller
- Returns:
0 if success, errno on failure
-
int media_proxy_ctrl_discover_player(struct bt_conn *conn)
Discover a remote media player.
Discover a remote media player instance. The remote player instance will be discovered, and accessed, using Bluetooth, via the media control client and a remote media control service. This call will start a GATT discovery of the Media Control Service on the peer, and setup handles and subscriptions.
This shall be called once before any other actions can be executed for the remote player. The remote player instance will be returned in the discover_player() callback.
- Parameters:
conn – The connection to do discovery for
- Returns:
0 if success, errno on failure
-
int media_proxy_ctrl_get_player_name(struct media_player *player)
Read Media Player Name.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_icon_id(struct media_player *player)
Read Icon Object ID.
Get an ID (48 bit) that can be used to retrieve the Icon Object from an Object Transfer Service
See the Media Control Service spec v1.0 sections 3.2 and 4.1 for a description of the Icon Object.
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_icon_url(struct media_player *player)
Read Icon URL.
Get a URL to the media player’s icon.
- Parameters:
player – Media player instance pointer
-
int media_proxy_ctrl_get_track_title(struct media_player *player)
Read Track Title.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_track_duration(struct media_player *player)
Read Track Duration.
The duration of a track is measured in hundredths of a second.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_track_position(struct media_player *player)
Read Track Position.
The position of the player (the playing position) is measured in hundredths of a second from the beginning of the track
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_set_track_position(struct media_player *player, int32_t position)
Set Track Position.
Set the playing position of the media player in the current track. The position is given in hundredths of a second, from the beginning of the track of the track for positive values, and (backwards) from the end of the track for negative values.
- Parameters:
player – Media player instance pointer
position – The track position to set
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_playback_speed(struct media_player *player)
Get Playback Speed.
The playback speed parameter is related to the actual playback speed as follows: actual playback speed = 2^(speed_parameter/64)
A speed parameter of 0 corresponds to unity speed playback (i.e. playback at “normal” speed). A speed parameter of -128 corresponds to playback at one fourth of normal speed, 127 corresponds to playback at almost four times the normal speed.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_set_playback_speed(struct media_player *player, int8_t speed)
Set Playback Speed.
See the get_playback_speed() function for an explanation of the playback speed parameter.
Note that the media player may not support all possible values of the playback speed parameter. If the value given is not supported, and is higher than the current value, the player should set the playback speed to the next higher supported value. (And correspondingly to the next lower supported value for given values lower than the current value.)
- Parameters:
player – Media player instance pointer
speed – The playback speed parameter to set
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_seeking_speed(struct media_player *player)
Get Seeking Speed.
The seeking speed gives the speed with which the player is seeking. It is a factor, relative to real-time playback speed - a factor four means seeking happens at four times the real-time playback speed. Positive values are for forward seeking, negative values for backwards seeking.
The seeking speed is not settable - a non-zero seeking speed is the result of “fast rewind” of “fast forward” commands.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_track_segments_id(struct media_player *player)
Read Current Track Segments Object ID.
Get an ID (48 bit) that can be used to retrieve the Current Track Segments Object from an Object Transfer Service
See the Media Control Service spec v1.0 sections 3.10 and 4.2 for a description of the Track Segments Object.
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_current_track_id(struct media_player *player)
Read Current Track Object ID.
Get an ID (48 bit) that can be used to retrieve the Current Track Object from an Object Transfer Service
See the Media Control Service spec v1.0 sections 3.11 and 4.3 for a description of the Current Track Object.
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_set_current_track_id(struct media_player *player, uint64_t id)
Set Current Track Object ID.
Change the player’s current track to the track given by the ID. (Behaves similarly to the goto track command.)
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
id – The ID of a track object
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_next_track_id(struct media_player *player)
Read Next Track Object ID.
Get an ID (48 bit) that can be used to retrieve the Next Track Object from an Object Transfer Service
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_set_next_track_id(struct media_player *player, uint64_t id)
Set Next Track Object ID.
Change the player’s next track to the track given by the ID.
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
id – The ID of a track object
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_parent_group_id(struct media_player *player)
Read Parent Group Object ID.
Get an ID (48 bit) that can be used to retrieve the Parent Track Object from an Object Transfer Service
The parent group is the parent of the current group.
See the Media Control Service spec v1.0 sections 3.14 and 4.4 for a description of the Current Track Object.
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_current_group_id(struct media_player *player)
Read Current Group Object ID.
Get an ID (48 bit) that can be used to retrieve the Current Track Object from an Object Transfer Service
See the Media Control Service spec v1.0 sections 3.14 and 4.4 for a description of the Current Group Object.
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_set_current_group_id(struct media_player *player, uint64_t id)
Set Current Group Object ID.
Change the player’s current group to the group given by the ID, and the current track to the first track in that group.
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
id – The ID of a group object
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_playing_order(struct media_player *player)
Read Playing Order.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_set_playing_order(struct media_player *player, uint8_t order)
Set Playing Order.
Set the media player’s playing order
- Parameters:
player – Media player instance pointer
order – The playing order to set
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_playing_orders_supported(struct media_player *player)
Read Playing Orders Supported.
Read a bitmap containing the media player’s supported playing orders.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_media_state(struct media_player *player)
Read Media State.
Read the media player’s state
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_send_command(struct media_player *player, const struct mpl_cmd *command)
Send Command.
Send a command to the media player. Commands may cause the media player to change its state May result in two callbacks - one for the actual sending of the command to the player, one for the result of the command from the player.
- Parameters:
player – Media player instance pointer
command – The command to send
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_commands_supported(struct media_player *player)
Read Commands Supported.
Read a bitmap containing the media player’s supported command opcodes.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_send_search(struct media_player *player, const struct mpl_search *search)
Set Search.
Write a search to the media player. If the search is successful, the search results will be available as a group object in the Object Transfer Service (OTS).
May result in up to three callbacks
one for the actual sending of the search to the player
one for the result code for the search from the player
if the search is successful, one for the search results object ID in the OTs
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
search – The search to write
- Returns:
0 if success, errno on failure.
-
int media_proxy_ctrl_get_search_results_id(struct media_player *player)
Read Search Results Object ID.
Get an ID (48 bit) that can be used to retrieve the Search Results Object from an Object Transfer Service
The search results object is a group object. The search results object only exists if a successful search operation has been done.
Requires Object Transfer Service
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
uint8_t media_proxy_ctrl_get_content_ctrl_id(struct media_player *player)
Read Content Control ID.
The content control ID identifies a content control service on a device, and links it to the corresponding audio stream.
- Parameters:
player – Media player instance pointer
- Returns:
0 if success, errno on failure.
-
int media_proxy_pl_register(struct media_proxy_pl_calls *pl_calls)
Register a player with the media proxy.
Register a player with the media proxy module, for use by media controllers.
The media proxy may call any non-NULL function pointers in the supplied media_proxy_pl_calls structure.
- Parameters:
pl_calls – Function pointers to the media player’s calls
- Returns:
0 if success, errno on failure
-
int media_proxy_pl_init(void)
Initialize player.
TODO: Move to player header file
-
struct bt_ots *bt_mcs_get_ots(void)
Get the pointer of the Object Transfer Service used by the Media Control Service.
TODO: Find best location for this call, and move this one also
-
void media_proxy_pl_name_cb(const char *name)
Player name changed callback.
To be called when the player’s name is changed.
- Parameters:
name – The name of the player
-
void media_proxy_pl_icon_url_cb(const char *url)
Player icon URL changed callback.
To be called when the player’s icon URL is changed.
- Parameters:
url – The URL of the player’s icon
-
void media_proxy_pl_track_changed_cb(void)
Track changed callback.
To be called when the player’s current track is changed
-
void media_proxy_pl_track_title_cb(char *title)
Track title callback.
To be called when the player’s current track is changed
- Parameters:
title – The title of the track
-
void media_proxy_pl_track_duration_cb(int32_t duration)
Track duration callback.
To be called when the current track’s duration is changed (e.g. due to a track change)
The track duration is given in hundredths of a second.
- Parameters:
duration – The track duration
-
void media_proxy_pl_track_position_cb(int32_t position)
Track position callback.
To be called when the media player’s position in the track is changed, or when the player is paused or similar.
Exception: This callback should not be called when the position changes during regular playback, i.e. while the player is playing and playback happens at a constant speed.
The track position is given in hundredths of a second from the start of the track.
- Parameters:
position – The media player’s position in the track
-
void media_proxy_pl_playback_speed_cb(int8_t speed)
Playback speed callback.
To be called when the playback speed is changed.
- Parameters:
speed – The playback speed parameter
-
void media_proxy_pl_seeking_speed_cb(int8_t speed)
Seeking speed callback.
To be called when the seeking speed is changed.
- Parameters:
speed – The seeking speed factor
-
void media_proxy_pl_current_track_id_cb(uint64_t id)
Current track object ID callback.
To be called when the ID of the current track is changed (e.g. due to a track change).
- Parameters:
id – The ID of the current track object in the OTS
-
void media_proxy_pl_next_track_id_cb(uint64_t id)
Next track object ID callback.
To be called when the ID of the current track is changes
- Parameters:
id – The ID of the next track object in the OTS
-
void media_proxy_pl_parent_group_id_cb(uint64_t id)
Parent group object ID callback.
To be called when the ID of the parent group is changed
- Parameters:
id – The ID of the parent group object in the OTS
-
void media_proxy_pl_current_group_id_cb(uint64_t id)
Current group object ID callback.
To be called when the ID of the current group is changed
- Parameters:
id – The ID of the current group object in the OTS
-
void media_proxy_pl_playing_order_cb(uint8_t order)
Playing order callback.
To be called when the playing order is changed
- Parameters:
order – The playing order
-
void media_proxy_pl_media_state_cb(uint8_t state)
Media state callback.
To be called when the media state is changed
- Parameters:
state – The media player’s state
-
void media_proxy_pl_command_cb(const struct mpl_cmd_ntf *cmd_ntf)
Command callback.
To be called when a command has been sent, to notify whether the command was successfully performed or not. See the MEDIA_PROXY_CMD_* result code defines.
- Parameters:
cmd_ntf – The result of the command
-
void media_proxy_pl_commands_supported_cb(uint32_t opcodes)
Commands supported callback.
To be called when the set of commands supported is changed
- Parameters:
opcodes – The supported commands opcodes
-
void media_proxy_pl_search_cb(uint8_t result_code)
Search callback.
To be called when a search has been set to notify whether the search was successfully performed or not. See the MEDIA_PROXY_SEARCH_* result code defines.
The actual results of the search, if successful, can be found in the search results object.
- Parameters:
result_code – The result (success or failure) of the search
-
void media_proxy_pl_search_results_id_cb(uint64_t id)
Search Results object ID callback.
To be called when the ID of the search results is changed (typically as the result of a new successful search).
- Parameters:
id – The ID of the search results object in the OTS
-
struct mpl_cmd
- #include <media_proxy.h>
Media player command.
Public Members
-
uint8_t opcode
The opcode.
See the MEDIA_PROXY_OP_* values
-
bool use_param
Whether or not the mpl_cmd::param is used.
-
int32_t param
A 32-bit signed parameter.
The parameter value depends on the mpl_cmd::opcode
-
uint8_t opcode
-
struct mpl_cmd_ntf
- #include <media_proxy.h>
Media command notification.
-
struct mpl_sci
- #include <media_proxy.h>
Search control item.
-
struct mpl_search
- #include <media_proxy.h>
Search.
Public Members
-
uint8_t len
The length of the mpl_search::search value.
-
char search[64]
Concatenated search control items - (type, length, param)
-
uint8_t len
-
struct media_proxy_ctrl_cbs
- #include <media_proxy.h>
Callbacks to a controller, from the media proxy.
Given by a controller when registering
Public Members
-
void (*local_player_instance)(struct media_player *player, int err)
Media Player Instance callback.
Called when the local Media Player instance is registered or read (TODO). Also called if the local player instance is already registered when the controller is registered. Provides the controller with the pointer to the local player instance.
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, or errno on negative value.
-
void (*player_name_recv)(struct media_player *player, int err, const char *name)
Media Player Name receive callback.
Called when the Media Player Name is read or changed See also media_proxy_ctrl_name_get()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param name:
The name of the media player
-
void (*icon_id_recv)(struct media_player *player, int err, uint64_t id)
Media Player Icon Object ID receive callback.
Called when the Media Player Icon Object ID is read See also media_proxy_ctrl_get_icon_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID of the Icon object in the Object Transfer Service (48 bits)
-
void (*icon_url_recv)(struct media_player *player, int err, const char *url)
Media Player Icon URL receive callback.
Called when the Media Player Icon URL is read See also media_proxy_ctrl_get_icon_url()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param url:
The URL of the icon
-
void (*track_changed_recv)(struct media_player *player, int err)
Track changed receive callback.
Called when the Current Track is changed
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
-
void (*track_title_recv)(struct media_player *player, int err, const char *title)
Track Title receive callback.
Called when the Track Title is read or changed See also media_proxy_ctrl_get_track_title()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param title:
The title of the current track
-
void (*track_duration_recv)(struct media_player *player, int err, int32_t duration)
Track Duration receive callback.
Called when the Track Duration is read or changed See also media_proxy_ctrl_get_track_duration()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param duration:
The duration of the current track
-
void (*track_position_recv)(struct media_player *player, int err, int32_t position)
Track Position receive callback.
Called when the Track Position is read or changed See also media_proxy_ctrl_get_track_position() and media_proxy_ctrl_set_track_position()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param position:
The player’s position in the track
-
void (*track_position_write)(struct media_player *player, int err, int32_t position)
Track Position write callback.
Called when the Track Position is written See also media_proxy_ctrl_set_track_position().
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param position:
The position given attempted to write
-
void (*playback_speed_recv)(struct media_player *player, int err, int8_t speed)
Playback Speed receive callback.
Called when the Playback Speed is read or changed See also media_proxy_ctrl_get_playback_speed() and media_proxy_ctrl_set_playback_speed()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param speed:
The playback speed parameter
-
void (*playback_speed_write)(struct media_player *player, int err, int8_t speed)
Playback Speed write callback.
Called when the Playback Speed is written See also media_proxy_ctrl_set_playback_speed()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param speed:
The playback speed parameter attempted to write
-
void (*seeking_speed_recv)(struct media_player *player, int err, int8_t speed)
Seeking Speed receive callback.
Called when the Seeking Speed is read or changed See also media_proxy_ctrl_get_seeking_speed()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param speed:
The seeking speed factor
-
void (*track_segments_id_recv)(struct media_player *player, int err, uint64_t id)
Track Segments Object ID receive callback.
Called when the Track Segments Object ID is read See also media_proxy_ctrl_get_track_segments_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID of the track segments object in Object Transfer Service (48 bits)
-
void (*current_track_id_recv)(struct media_player *player, int err, uint64_t id)
Current Track Object ID receive callback.
Called when the Current Track Object ID is read or changed See also media_proxy_ctrl_get_current_track_id() and media_proxy_ctrl_set_current_track_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID of the current track object in Object Transfer Service (48 bits)
-
void (*current_track_id_write)(struct media_player *player, int err, uint64_t id)
Current Track Object ID write callback.
Called when the Current Track Object ID is written See also media_proxy_ctrl_set_current_track_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID (48 bits) attempted to write
-
void (*next_track_id_recv)(struct media_player *player, int err, uint64_t id)
Next Track Object ID receive callback.
Called when the Next Track Object ID is read or changed See also media_proxy_ctrl_get_next_track_id() and media_proxy_ctrl_set_next_track_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID of the next track object in Object Transfer Service (48 bits)
-
void (*next_track_id_write)(struct media_player *player, int err, uint64_t id)
Next Track Object ID write callback.
Called when the Next Track Object ID is written See also media_proxy_ctrl_set_next_track_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID (48 bits) attempted to write
-
void (*parent_group_id_recv)(struct media_player *player, int err, uint64_t id)
Parent Group Object ID receive callback.
Called when the Parent Group Object ID is read or changed See also media_proxy_ctrl_get_parent_group_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID of the parent group object in Object Transfer Service (48 bits)
-
void (*current_group_id_recv)(struct media_player *player, int err, uint64_t id)
Current Group Object ID receive callback.
Called when the Current Group Object ID is read or changed See also media_proxy_ctrl_get_current_group_id() and media_proxy_ctrl_set_current_group_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID of the current group object in Object Transfer Service (48 bits)
-
void (*current_group_id_write)(struct media_player *player, int err, uint64_t id)
Current Group Object ID write callback.
Called when the Current Group Object ID is written See also media_proxy_ctrl_set_current_group_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID (48 bits) attempted to write
-
void (*playing_order_recv)(struct media_player *player, int err, uint8_t order)
Playing Order receive callback.
Called when the Playing Order is read or changed See also media_proxy_ctrl_get_playing_order() and media_proxy_ctrl_set_playing_order()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param order:
The playing order
-
void (*playing_order_write)(struct media_player *player, int err, uint8_t order)
Playing Order write callback.
Called when the Playing Order is written See also media_proxy_ctrl_set_playing_order()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param order:
The playing order attempted to write
-
void (*playing_orders_supported_recv)(struct media_player *player, int err, uint16_t orders)
Playing Orders Supported receive callback.
Called when the Playing Orders Supported is read See also media_proxy_ctrl_get_playing_orders_supported()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param orders:
The playing orders supported
-
void (*media_state_recv)(struct media_player *player, int err, uint8_t state)
Media State receive callback.
Called when the Media State is read or changed See also media_proxy_ctrl_get_media_state() and media_proxy_ctrl_send_command()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param state:
The media player state
-
void (*command_send)(struct media_player *player, int err, const struct mpl_cmd *cmd)
Command send callback.
Called when a command has been sent See also media_proxy_ctrl_send_command()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param cmd:
The command sent
-
void (*command_recv)(struct media_player *player, int err, const struct mpl_cmd_ntf *result)
Command result receive callback.
Called when a command result has been received See also media_proxy_ctrl_send_command()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param result:
The result received
-
void (*commands_supported_recv)(struct media_player *player, int err, uint32_t opcodes)
Commands supported receive callback.
Called when the Commands Supported is read or changed See also media_proxy_ctrl_get_commands_supported()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param opcodes:
The supported command opcodes (bitmap)
-
void (*search_send)(struct media_player *player, int err, const struct mpl_search *search)
Search send callback.
Called when a search has been sent See also media_proxy_ctrl_send_search()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param search:
The search sent
-
void (*search_recv)(struct media_player *player, int err, uint8_t result_code)
Search result code receive callback.
Called when a search result code has been received See also media_proxy_ctrl_send_search()
The search result code tells whether the search was successful or not. For a successful search, the actual results of the search (i.e. what was found as a result of the search)can be accessed using the Search Results Object ID. The Search Results Object ID has a separate callback - search_results_id_recv().
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param result_code:
Search result code
-
void (*search_results_id_recv)(struct media_player *player, int err, uint64_t id)
Search Results Object ID receive callback See also media_proxy_ctrl_get_search_results_id()
Called when the Search Results Object ID is read or changed
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param id:
The ID of the search results object in Object Transfer Service (48 bits)
-
void (*content_ctrl_id_recv)(struct media_player *player, int err, uint8_t ccid)
Content Control ID receive callback.
Called when the Content Control ID is read See also media_proxy_ctrl_get_content_ctrl_id()
- Param player:
Media player instance pointer
- Param err:
Error value. 0 on success, GATT error on positive value or errno on negative value.
- Param ccid:
The content control ID
-
void (*local_player_instance)(struct media_player *player, int err)
-
struct media_proxy_pl_calls
- #include <media_proxy.h>
Available calls in a player, that the media proxy can call.
Given by a player when registering.
Public Members
-
const char *(*get_player_name)(void)
Read Media Player Name.
- Return:
The name of the media player
-
uint64_t (*get_icon_id)(void)
Read Icon Object ID.
Get an ID (48 bit) that can be used to retrieve the Icon Object from an Object Transfer Service
See the Media Control Service spec v1.0 sections 3.2 and 4.1 for a description of the Icon Object.
- Return:
The Icon Object ID
-
const char *(*get_icon_url)(void)
Read Icon URL.
Get a URL to the media player’s icon.
- Return:
The URL of the Icon
-
const char *(*get_track_title)(void)
Read Track Title.
- Return:
The title of the current track
-
int32_t (*get_track_duration)(void)
Read Track Duration.
The duration of a track is measured in hundredths of a second.
- Return:
The duration of the current track
-
int32_t (*get_track_position)(void)
Read Track Position.
The position of the player (the playing position) is measured in hundredths of a second from the beginning of the track
- Return:
The position of the player in the current track
-
void (*set_track_position)(int32_t position)
Set Track Position.
Set the playing position of the media player in the current track. The position is given in hundredths of a second, from the beginning of the track of the track for positive values, and (backwards) from the end of the track for negative values.
- Param position:
The player position to set
-
int8_t (*get_playback_speed)(void)
Get Playback Speed.
The playback speed parameter is related to the actual playback speed as follows: actual playback speed = 2^(speed_parameter/64)
A speed parameter of 0 corresponds to unity speed playback (i.e. playback at “normal” speed). A speed parameter of -128 corresponds to playback at one fourth of normal speed, 127 corresponds to playback at almost four times the normal speed.
- Return:
The playback speed parameter
-
void (*set_playback_speed)(int8_t speed)
Set Playback Speed.
See the get_playback_speed() function for an explanation of the playback speed parameter.
Note that the media player may not support all possible values of the playback speed parameter. If the value given is not supported, and is higher than the current value, the player should set the playback speed to the next higher supported value. (And correspondingly to the next lower supported value for given values lower than the current value.)
- Param speed:
The playback speed parameter to set
-
int8_t (*get_seeking_speed)(void)
Get Seeking Speed.
The seeking speed gives the speed with which the player is seeking. It is a factor, relative to real-time playback speed - a factor four means seeking happens at four times the real-time playback speed. Positive values are for forward seeking, negative values for backwards seeking.
The seeking speed is not settable - a non-zero seeking speed is the result of “fast rewind” of “fast forward” commands.
- Return:
The seeking speed factor
-
uint64_t (*get_track_segments_id)(void)
Read Current Track Segments Object ID.
Get an ID (48 bit) that can be used to retrieve the Current Track Segments Object from an Object Transfer Service
See the Media Control Service spec v1.0 sections 3.10 and 4.2 for a description of the Track Segments Object.
- Return:
Current The Track Segments Object ID
-
uint64_t (*get_current_track_id)(void)
Read Current Track Object ID.
Get an ID (48 bit) that can be used to retrieve the Current Track Object from an Object Transfer Service
See the Media Control Service spec v1.0 sections 3.11 and 4.3 for a description of the Current Track Object.
- Return:
The Current Track Object ID
-
void (*set_current_track_id)(uint64_t id)
Set Current Track Object ID.
Change the player’s current track to the track given by the ID. (Behaves similarly to the goto track command.)
- Param id:
The ID of a track object
-
uint64_t (*get_next_track_id)(void)
Read Next Track Object ID.
Get an ID (48 bit) that can be used to retrieve the Next Track Object from an Object Transfer Service
- Return:
The Next Track Object ID
-
void (*set_next_track_id)(uint64_t id)
Set Next Track Object ID.
Change the player’s next track to the track given by the ID.
- Param id:
The ID of a track object
-
uint64_t (*get_parent_group_id)(void)
Read Parent Group Object ID.
Get an ID (48 bit) that can be used to retrieve the Parent Track Object from an Object Transfer Service
The parent group is the parent of the current group.
See the Media Control Service spec v1.0 sections 3.14 and 4.4 for a description of the Current Track Object.
- Return:
The Current Group Object ID
-
uint64_t (*get_current_group_id)(void)
Read Current Group Object ID.
Get an ID (48 bit) that can be used to retrieve the Current Track Object from an Object Transfer Service
See the Media Control Service spec v1.0 sections 3.14 and 4.4 for a description of the Current Group Object.
- Return:
The Current Group Object ID
-
void (*set_current_group_id)(uint64_t id)
Set Current Group Object ID.
Change the player’s current group to the group given by the ID, and the current track to the first track in that group.
- Param id:
The ID of a group object
-
uint8_t (*get_playing_order)(void)
Read Playing Order.
return The media player’s current playing order
-
void (*set_playing_order)(uint8_t order)
Set Playing Order.
Set the media player’s playing order. See the MEDIA_PROXY_PLAYING_ORDER_* defines.
- Param order:
The playing order to set
-
uint16_t (*get_playing_orders_supported)(void)
Read Playing Orders Supported.
Read a bitmap containing the media player’s supported playing orders. See the MEDIA_PROXY_PLAYING_ORDERS_SUPPORTED_* defines.
- Return:
The media player’s supported playing orders
-
uint8_t (*get_media_state)(void)
Read Media State.
Read the media player’s state See the MEDIA_PROXY_MEDIA_STATE_* defines.
- Return:
The media player’s state
-
void (*send_command)(const struct mpl_cmd *command)
Send Command.
Send a command to the media player. For command opcodes (play, pause, …) - see the MEDIA_PROXY_OP_* defines.
- Param command:
The command to send
-
uint32_t (*get_commands_supported)(void)
Read Commands Supported.
Read a bitmap containing the media player’s supported command opcodes. See the MEDIA_PROXY_OP_SUP_* defines.
- Return:
The media player’s supported command opcodes
-
void (*send_search)(const struct mpl_search *search)
Set Search.
Write a search to the media player. (For the formatting of a search, see the Media Control Service spec and the mcs.h file.)
- Param search:
The search to write
-
uint64_t (*get_search_results_id)(void)
Read Search Results Object ID.
Get an ID (48 bit) that can be used to retrieve the Search Results Object from an Object Transfer Service
The search results object is a group object. The search results object only exists if a successful search operation has been done.
- Return:
The Search Results Object ID
-
uint8_t (*get_content_ctrl_id)(void)
Read Content Control ID.
The content control ID identifies a content control service on a device, and links it to the corresponding audio stream.
- Return:
The content control ID for the media player
-
const char *(*get_player_name)(void)
Media Control Client
- group bt_gatt_mcc
Bluetooth Media Control Client (MCC) interface.
Updated to the Media Control Profile specification revision 1.0
- Since
3.0
- Version
0.8.0
Typedefs
-
typedef void (*bt_mcc_discover_mcs_cb)(struct bt_conn *conn, int err)
Callback function for bt_mcc_discover_mcs()
Called when a media control server is discovered
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
-
typedef void (*bt_mcc_read_player_name_cb)(struct bt_conn *conn, int err, const char *name)
Callback function for bt_mcc_read_player_name()
Called when the player name is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param name:
Player name
-
typedef void (*bt_mcc_read_icon_obj_id_cb)(struct bt_conn *conn, int err, uint64_t icon_id)
Callback function for bt_mcc_read_icon_obj_id()
Called when the icon object ID is read
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param icon_id:
The ID of the Icon Object. This is a UINT48 in a uint64_t
-
typedef void (*bt_mcc_read_icon_url_cb)(struct bt_conn *conn, int err, const char *icon_url)
Callback function for bt_mcc_read_icon_url()
Called when the icon URL is read
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param icon_url:
The URL of the Icon
-
typedef void (*bt_mcc_track_changed_ntf_cb)(struct bt_conn *conn, int err)
Callback function for track changed notifications.
Called when a track change is notified.
The track changed characteristic is a special case. It can not be read or set, it can only be notified.
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
-
typedef void (*bt_mcc_read_track_title_cb)(struct bt_conn *conn, int err, const char *title)
Callback function for bt_mcc_read_track_title()
Called when the track title is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param title:
The title of the track
-
typedef void (*bt_mcc_read_track_duration_cb)(struct bt_conn *conn, int err, int32_t dur)
Callback function for bt_mcc_read_track_duration()
Called when the track duration is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param dur:
The duration of the track
-
typedef void (*bt_mcc_read_track_position_cb)(struct bt_conn *conn, int err, int32_t pos)
Callback function for bt_mcc_read_track_position()
Called when the track position is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param pos:
The Track Position
-
typedef void (*bt_mcc_set_track_position_cb)(struct bt_conn *conn, int err, int32_t pos)
Callback function for bt_mcc_set_track_position()
Called when the track position is set
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param pos:
The Track Position set (or attempted to set)
-
typedef void (*bt_mcc_read_playback_speed_cb)(struct bt_conn *conn, int err, int8_t speed)
Callback function for bt_mcc_read_playback_speed()
Called when the playback speed is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param speed:
The Playback Speed
-
typedef void (*bt_mcc_set_playback_speed_cb)(struct bt_conn *conn, int err, int8_t speed)
Callback function for bt_mcc_set_playback_speed()
Called when the playback speed is set
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param speed:
The Playback Speed set (or attempted to set)
-
typedef void (*bt_mcc_read_seeking_speed_cb)(struct bt_conn *conn, int err, int8_t speed)
Callback function for bt_mcc_read_seeking_speed()
Called when the seeking speed is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param speed:
The Seeking Speed
-
typedef void (*bt_mcc_read_segments_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id)
Callback function for bt_mcc_read_segments_obj_id()
Called when the track segments object ID is read
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param id:
The Track Segments Object ID (UINT48)
-
typedef void (*bt_mcc_read_current_track_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id)
Callback function for bt_mcc_read_current_track_obj_id()
Called when the current track object ID is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param id:
The Current Track Object ID (UINT48)
-
typedef void (*bt_mcc_set_current_track_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id)
Callback function for bt_mcc_set_current_track_obj_id()
Called when the current track object ID is set
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param id:
The Object ID (UINT48) set (or attempted to set)
-
typedef void (*bt_mcc_read_next_track_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id)
Callback function for bt_mcc_read_next_track_obj_id_obj()
Called when the next track object ID is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param id:
The Next Track Object ID (UINT48)
-
typedef void (*bt_mcc_set_next_track_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id)
Callback function for bt_mcc_set_next_track_obj_id()
Called when the next track object ID is set
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param id:
The Object ID (UINT48) set (or attempted to set)
-
typedef void (*bt_mcc_read_parent_group_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id)
Callback function for bt_mcc_read_parent_group_obj_id()
Called when the parent group object ID is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param id:
The Parent Group Object ID (UINT48)
-
typedef void (*bt_mcc_read_current_group_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id)
Callback function for bt_mcc_read_current_group_obj_id()
Called when the current group object ID is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param id:
The Current Group Object ID (UINT48)
-
typedef void (*bt_mcc_set_current_group_obj_id_cb)(struct bt_conn *conn, int err, uint64_t obj_id)
Callback function for bt_mcc_set_current_group_obj_id()
Called when the current group object ID is set
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param obj_id:
The Object ID (UINT48) set (or attempted to set)
-
typedef void (*bt_mcc_read_playing_order_cb)(struct bt_conn *conn, int err, uint8_t order)
Callback function for bt_mcc_read_playing_order()
Called when the playing order is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param order:
The playback order
-
typedef void (*bt_mcc_set_playing_order_cb)(struct bt_conn *conn, int err, uint8_t order)
Callback function for bt_mcc_set_playing_order()
Called when the playing order is set
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param order:
The Playing Order set (or attempted to set)
-
typedef void (*bt_mcc_read_playing_orders_supported_cb)(struct bt_conn *conn, int err, uint16_t orders)
Callback function for bt_mcc_read_playing_orders_supported()
Called when the supported playing orders are read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param orders:
The playing orders supported (bitmap)
-
typedef void (*bt_mcc_read_media_state_cb)(struct bt_conn *conn, int err, uint8_t state)
Callback function for bt_mcc_read_media_state()
Called when the media state is read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param state:
The Media State
-
typedef void (*bt_mcc_send_cmd_cb)(struct bt_conn *conn, int err, const struct mpl_cmd *cmd)
Callback function for bt_mcc_send_cmd()
Called when a command is sent, i.e. when the media control point is set
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param cmd:
The command sent
-
typedef void (*bt_mcc_cmd_ntf_cb)(struct bt_conn *conn, int err, const struct mpl_cmd_ntf *ntf)
Callback function for command notifications.
Called when the media control point is notified
Notifications for commands (i.e. for writes to the media control point) use a different parameter structure than what is used for sending commands (writing to the media control point)
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param ntf:
The command notification
-
typedef void (*bt_mcc_read_opcodes_supported_cb)(struct bt_conn *conn, int err, uint32_t opcodes)
Callback function for bt_mcc_read_opcodes_supported()
Called when the supported opcodes (commands) are read or notified
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param opcodes:
The supported opcodes
-
typedef void (*bt_mcc_send_search_cb)(struct bt_conn *conn, int err, const struct mpl_search *search)
Callback function for bt_mcc_send_search()
Called when a search is sent, i.e. when the search control point is set
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param search:
The search set (or attempted to set)
-
typedef void (*bt_mcc_search_ntf_cb)(struct bt_conn *conn, int err, uint8_t result_code)
Callback function for search notifications.
Called when the search control point is notified
Notifications for searches (i.e. for writes to the search control point) use a different parameter structure than what is used for sending searches (writing to the search control point)
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param result_code:
The search notification
-
typedef void (*bt_mcc_read_search_results_obj_id_cb)(struct bt_conn *conn, int err, uint64_t id)
Callback function for bt_mcc_read_search_results_obj_id()
Called when the search results object ID is read or notified
Note that the Search Results Object ID value may be zero, in case the characteristic does not exist on the server. (This will be the case if there has not been a successful search.)
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param id:
The Search Results Object ID (UINT48)
-
typedef void (*bt_mcc_read_content_control_id_cb)(struct bt_conn *conn, int err, uint8_t ccid)
Callback function for bt_mcc_read_content_control_id()
Called when the content control ID is read
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param ccid:
The Content Control ID
-
typedef void (*bt_mcc_otc_obj_selected_cb)(struct bt_conn *conn, int err)
Callback function for object selected.
Called when an object is selected
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
-
typedef void (*bt_mcc_otc_obj_metadata_cb)(struct bt_conn *conn, int err)
Callback function for bt_mcc_otc_read_object_metadata()
Called when object metadata is read
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
-
typedef void (*bt_mcc_otc_read_icon_object_cb)(struct bt_conn *conn, int err, struct net_buf_simple *buf)
Callback function for bt_mcc_otc_read_icon_object()
Called when the icon object is read
If err is EMSGSIZE, the object contents have been truncated.
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param buf:
Buffer containing the object contents
-
typedef void (*bt_mcc_otc_read_track_segments_object_cb)(struct bt_conn *conn, int err, struct net_buf_simple *buf)
Callback function for bt_mcc_otc_read_track_segments_object()
Called when the track segments object is read
If err is EMSGSIZE, the object contents have been truncated.
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param buf:
Buffer containing the object contents
-
typedef void (*bt_mcc_otc_read_current_track_object_cb)(struct bt_conn *conn, int err, struct net_buf_simple *buf)
Callback function for bt_mcc_otc_read_current_track_object()
Called when the current track object is read
If err is EMSGSIZE, the object contents have been truncated.
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param buf:
Buffer containing the object contents
-
typedef void (*bt_mcc_otc_read_next_track_object_cb)(struct bt_conn *conn, int err, struct net_buf_simple *buf)
Callback function for bt_mcc_otc_read_next_track_object()
Called when the next track object is read
If err is EMSGSIZE, the object contents have been truncated.
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param buf:
Buffer containing the object contents
-
typedef void (*bt_mcc_otc_read_parent_group_object_cb)(struct bt_conn *conn, int err, struct net_buf_simple *buf)
Callback function for bt_mcc_otc_read_parent_group_object()
Called when the parent group object is read
If err is EMSGSIZE, the object contents have been truncated.
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param buf:
Buffer containing the object contents
-
typedef void (*bt_mcc_otc_read_current_group_object_cb)(struct bt_conn *conn, int err, struct net_buf_simple *buf)
Callback function for bt_mcc_otc_read_current_group_object()
Called when the current group object is read
If err is EMSGSIZE, the object contents have been truncated.
- Param conn:
The connection that was used to initialise the media control client
- Param err:
Error value. 0 on success, GATT error or errno on fail
- Param buf:
Buffer containing the object contents
Functions
-
int bt_mcc_init(struct bt_mcc_cb *cb)
Initialize Media Control Client.
- Parameters:
cb – Callbacks to be used
- Returns:
0 if success, errno on failure.
-
int bt_mcc_discover_mcs(struct bt_conn *conn, bool subscribe)
Discover Media Control Service.
Discover Media Control Service (MCS) on the server given by the connection Optionally subscribe to notifications.
Shall be called once, after media control client initialization and before using other media control client functionality.
- Parameters:
conn – Connection to the peer device
subscribe – Whether to subscribe to notifications
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_player_name(struct bt_conn *conn)
Read Media Player Name.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_icon_obj_id(struct bt_conn *conn)
Read Icon Object ID.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_icon_url(struct bt_conn *conn)
Read Icon Object URL.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_track_title(struct bt_conn *conn)
Read Track Title.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_track_duration(struct bt_conn *conn)
Read Track Duration.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_track_position(struct bt_conn *conn)
Read Track Position.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_set_track_position(struct bt_conn *conn, int32_t pos)
Set Track position.
- Parameters:
conn – Connection to the peer device
pos – Track position
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_playback_speed(struct bt_conn *conn)
Read Playback speed.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_set_playback_speed(struct bt_conn *conn, int8_t speed)
Set Playback Speed.
- Parameters:
conn – Connection to the peer device
speed – Playback speed
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_seeking_speed(struct bt_conn *conn)
Read Seeking speed.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_segments_obj_id(struct bt_conn *conn)
Read Track Segments Object ID.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_current_track_obj_id(struct bt_conn *conn)
Read Current Track Object ID.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_set_current_track_obj_id(struct bt_conn *conn, uint64_t id)
Set Current Track Object ID.
Set the Current Track to the track given by the
id
parameter- Parameters:
conn – Connection to the peer device
id – Object Transfer Service ID (UINT48) of the track to set as the current track
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_next_track_obj_id(struct bt_conn *conn)
Read Next Track Object ID.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_set_next_track_obj_id(struct bt_conn *conn, uint64_t id)
Set Next Track Object ID.
Set the Next Track to the track given by the
id
parameter- Parameters:
conn – Connection to the peer device
id – Object Transfer Service ID (UINT48) of the track to set as the next track
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_current_group_obj_id(struct bt_conn *conn)
Read Current Group Object ID.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_set_current_group_obj_id(struct bt_conn *conn, uint64_t id)
Set Current Group Object ID.
Set the Current Group to the group given by the
id
parameter- Parameters:
conn – Connection to the peer device
id – Object Transfer Service ID (UINT48) of the group to set as the current group
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_parent_group_obj_id(struct bt_conn *conn)
Read Parent Group Object ID.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_playing_order(struct bt_conn *conn)
Read Playing Order.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_set_playing_order(struct bt_conn *conn, uint8_t order)
Set Playing Order.
- Parameters:
conn – Connection to the peer device
order – Playing order
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_playing_orders_supported(struct bt_conn *conn)
Read Playing Orders Supported.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_media_state(struct bt_conn *conn)
Read Media State.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_send_cmd(struct bt_conn *conn, const struct mpl_cmd *cmd)
Send a command.
Write a command (e.g. “play”, “pause”) to the server’s media control point.
- Parameters:
conn – Connection to the peer device
cmd – The command to send
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_opcodes_supported(struct bt_conn *conn)
Read Opcodes Supported.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_send_search(struct bt_conn *conn, const struct mpl_search *search)
Send a Search command.
Write a search to the server’s search control point.
- Parameters:
conn – Connection to the peer device
search – The search
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_search_results_obj_id(struct bt_conn *conn)
Search Results Group Object ID.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_read_content_control_id(struct bt_conn *conn)
Read Content Control ID.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_otc_read_object_metadata(struct bt_conn *conn)
Read the current object metadata.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_otc_read_icon_object(struct bt_conn *conn)
Read the Icon Object.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_otc_read_track_segments_object(struct bt_conn *conn)
Read the Track Segments Object.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_otc_read_current_track_object(struct bt_conn *conn)
Read the Current Track Object.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_otc_read_next_track_object(struct bt_conn *conn)
Read the Next Track Object.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_otc_read_current_group_object(struct bt_conn *conn)
Read the Current Group Object.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
int bt_mcc_otc_read_parent_group_object(struct bt_conn *conn)
Read the Parent Group Object.
- Parameters:
conn – Connection to the peer device
- Returns:
0 if success, errno on failure.
-
struct bt_ots_client *bt_mcc_otc_inst(struct bt_conn *conn)
Look up MCC OTC instance.
- Parameters:
conn – The connection to the MCC server.
- Returns:
Pointer to a MCC OTC instance if found else NULL.
-
struct bt_mcc_cb
- #include <mcc.h>
Media control client callbacks.
Public Members
-
bt_mcc_discover_mcs_cb discover_mcs
Callback when discovery has finished.
-
bt_mcc_read_player_name_cb read_player_name
Callback when reading the player name.
-
bt_mcc_read_icon_obj_id_cb read_icon_obj_id
Callback when reading the icon object ID.
-
bt_mcc_read_icon_url_cb read_icon_url
Callback when reading the icon URL.
-
bt_mcc_track_changed_ntf_cb track_changed_ntf
Callback when getting a track changed notification.
-
bt_mcc_read_track_title_cb read_track_title
Callback when reading the track title.
-
bt_mcc_read_track_duration_cb read_track_duration
Callback when reading the track duration.
-
bt_mcc_read_track_position_cb read_track_position
Callback when reading the track position.
-
bt_mcc_set_track_position_cb set_track_position
Callback when setting the track position.
-
bt_mcc_read_playback_speed_cb read_playback_speed
Callback when reading the playback speed.
-
bt_mcc_set_playback_speed_cb set_playback_speed
Callback when setting the playback speed.
-
bt_mcc_read_seeking_speed_cb read_seeking_speed
Callback when reading the seeking speed.
-
bt_mcc_read_segments_obj_id_cb read_segments_obj_id
Callback when reading the segments object ID.
-
bt_mcc_read_current_track_obj_id_cb read_current_track_obj_id
Callback when reading the current track object ID.
-
bt_mcc_set_current_track_obj_id_cb set_current_track_obj_id
Callback when setting the current track object ID.
-
bt_mcc_read_next_track_obj_id_cb read_next_track_obj_id
Callback when reading the next track object ID.
-
bt_mcc_set_next_track_obj_id_cb set_next_track_obj_id
Callback when setting the next track object ID.
-
bt_mcc_read_current_group_obj_id_cb read_current_group_obj_id
Callback when reading the current group object ID.
-
bt_mcc_set_current_group_obj_id_cb set_current_group_obj_id
Callback when setting the current group object ID.
-
bt_mcc_read_parent_group_obj_id_cb read_parent_group_obj_id
Callback when reading the parent group object ID.
-
bt_mcc_read_playing_order_cb read_playing_order
Callback when reading the playing order.
-
bt_mcc_set_playing_order_cb set_playing_order
Callback when setting the playing order.
-
bt_mcc_read_playing_orders_supported_cb read_playing_orders_supported
Callback when reading the supported playing orders.
-
bt_mcc_read_media_state_cb read_media_state
Callback when reading the media state.
-
bt_mcc_send_cmd_cb send_cmd
Callback when sending a command.
-
bt_mcc_cmd_ntf_cb cmd_ntf
Callback command notifications.
-
bt_mcc_read_opcodes_supported_cb read_opcodes_supported
Callback when reading the supported opcodes.
-
bt_mcc_send_search_cb send_search
Callback when sending the a search query.
-
bt_mcc_search_ntf_cb search_ntf
Callback when receiving a search notification.
-
bt_mcc_read_search_results_obj_id_cb read_search_results_obj_id
Callback when reading the search results object ID.
-
bt_mcc_read_content_control_id_cb read_content_control_id
Callback when reading the content control ID.
-
bt_mcc_otc_obj_selected_cb otc_obj_selected
Callback when selecting an object.
-
bt_mcc_otc_obj_metadata_cb otc_obj_metadata
Callback when receiving the current object metadata.
-
bt_mcc_otc_read_icon_object_cb otc_icon_object
Callback when reading the current icon object.
-
bt_mcc_otc_read_track_segments_object_cb otc_track_segments_object
Callback when reading the track segments object.
-
bt_mcc_otc_read_current_track_object_cb otc_current_track_object
Callback when reading the current track object.
-
bt_mcc_otc_read_next_track_object_cb otc_next_track_object
Callback when reading the next track object.
-
bt_mcc_otc_read_current_group_object_cb otc_current_group_object
Callback when reading the current group object.
-
bt_mcc_otc_read_parent_group_object_cb otc_parent_group_object
Callback when reading the parent group object.
-
bt_mcc_discover_mcs_cb discover_mcs