Skip to content

Commit b0f2d04

Browse files
Thalleynashif
authored andcommitted
Bluetooth: MCS: Add missing documentation in mcs.h
Add missing documentation for some defintions in mcs.h Signed-off-by: Emil Gydesen <[email protected]>
1 parent 8679dcd commit b0f2d04

File tree

1 file changed

+203
-28
lines changed
  • include/zephyr/bluetooth/audio

1 file changed

+203
-28
lines changed

include/zephyr/bluetooth/audio/mcs.h

Lines changed: 203 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
/**
2+
* @file
3+
* @brief Bluetooth Media Control Service (MCS) APIs.
4+
*/
15
/*
2-
* Copyright (c) 2019 - 2021 Nordic Semiconductor ASA
6+
* Copyright (c) 2019 - 2024 Nordic Semiconductor ASA
37
*
48
* SPDX-License-Identifier: Apache-2.0
59
*/
@@ -29,166 +33,337 @@
2933
extern "C" {
3034
#endif
3135

36+
/**
37+
* A characteristic value has changed while a Read Long Value Characteristic sub-procedure is in
38+
* progress.
39+
*/
3240
#define BT_MCS_ERR_LONG_VAL_CHANGED 0x80
3341

34-
/** @brief Playback speeds
42+
/**
43+
* @name Playback speeds
3544
*
36-
* All values from -128 to 127 allowed, only some defined
45+
* The playback speed (s) is calculated by the value of 2 to the power of p divided by 64.
46+
* All values from -128 to 127 allowed, only some examples defined.
47+
* @{
3748
*/
49+
/** Minimum playback speed, resulting in 25 % speed */
3850
#define BT_MCS_PLAYBACK_SPEED_MIN -128
51+
/** Quarter playback speed, resulting in 25 % speed */
3952
#define BT_MCS_PLAYBACK_SPEED_QUARTER -128
53+
/** Half playback speed, resulting in 50 % speed */
4054
#define BT_MCS_PLAYBACK_SPEED_HALF -64
55+
/** Unity playback speed, resulting in 100 % speed */
4156
#define BT_MCS_PLAYBACK_SPEED_UNITY 0
57+
/** Double playback speed, resulting in 200 % speed */
4258
#define BT_MCS_PLAYBACK_SPEED_DOUBLE 64
59+
/** Max playback speed, resulting in 395.7 % speed (nearly 400 %) */
4360
#define BT_MCS_PLAYBACK_SPEED_MAX 127
61+
/** @} */
4462

45-
/** @brief Seeking speed
63+
/**
64+
* @name Seeking speed
4665
*
4766
* The allowed values for seeking speed are the range -64 to -4
4867
* (endpoints included), the value 0, and the range 4 to 64
4968
* (endpoints included).
69+
* @{
5070
*/
71+
/** Maximum seeking speed - Can be negated */
5172
#define BT_MCS_SEEKING_SPEED_FACTOR_MAX 64
73+
/** Minimum seeking speed - Can be negated */
5274
#define BT_MCS_SEEKING_SPEED_FACTOR_MIN 4
75+
/** No seeking */
5376
#define BT_MCS_SEEKING_SPEED_FACTOR_ZERO 0
77+
/** @} */
5478

55-
/** Playing orders */
79+
/**
80+
* @name Playing orders
81+
* @{
82+
*/
83+
/** A single track is played once; there is no next track. */
5684
#define BT_MCS_PLAYING_ORDER_SINGLE_ONCE 0X01
85+
/** A single track is played repeatedly; the next track is the current track. */
5786
#define BT_MCS_PLAYING_ORDER_SINGLE_REPEAT 0x02
87+
/** The tracks within a group are played once in track order. */
5888
#define BT_MCS_PLAYING_ORDER_INORDER_ONCE 0x03
89+
/** The tracks within a group are played in track order repeatedly. */
5990
#define BT_MCS_PLAYING_ORDER_INORDER_REPEAT 0x04
91+
/** The tracks within a group are played once only from the oldest first. */
6092
#define BT_MCS_PLAYING_ORDER_OLDEST_ONCE 0x05
93+
/** The tracks within a group are played from the oldest first repeatedly. */
6194
#define BT_MCS_PLAYING_ORDER_OLDEST_REPEAT 0x06
95+
/** The tracks within a group are played once only from the newest first. */
6296
#define BT_MCS_PLAYING_ORDER_NEWEST_ONCE 0x07
97+
/** The tracks within a group are played from the newest first repeatedly. */
6398
#define BT_MCS_PLAYING_ORDER_NEWEST_REPEAT 0x08
99+
/** The tracks within a group are played in random order once. */
64100
#define BT_MCS_PLAYING_ORDER_SHUFFLE_ONCE 0x09
101+
/** The tracks within a group are played in random order repeatedly. */
65102
#define BT_MCS_PLAYING_ORDER_SHUFFLE_REPEAT 0x0a
103+
/** @} */
66104

67-
/** @brief Playing orders supported
105+
/** @name Playing orders supported
68106
*
69107
* A bitmap, in the same order as the playing orders above.
70108
* Note that playing order 1 corresponds to bit 0, and so on.
109+
* @{
71110
*/
111+
/** A single track is played once; there is no next track. */
72112
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_SINGLE_ONCE BIT(0)
113+
/** A single track is played repeatedly; the next track is the current track. */
73114
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_SINGLE_REPEAT BIT(1)
115+
/** The tracks within a group are played once in track order. */
74116
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_INORDER_ONCE BIT(2)
117+
/** The tracks within a group are played in track order repeatedly. */
75118
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_INORDER_REPEAT BIT(3)
119+
/** The tracks within a group are played once only from the oldest first. */
76120
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_OLDEST_ONCE BIT(4)
121+
/** The tracks within a group are played from the oldest first repeatedly. */
77122
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_OLDEST_REPEAT BIT(5)
123+
/** The tracks within a group are played once only from the newest first. */
78124
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_NEWEST_ONCE BIT(6)
125+
/** The tracks within a group are played from the newest first repeatedly. */
79126
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_NEWEST_REPEAT BIT(7)
127+
/** The tracks within a group are played in random order once. */
80128
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_SHUFFLE_ONCE BIT(8)
129+
/** The tracks within a group are played in random order repeatedly. */
81130
#define BT_MCS_PLAYING_ORDERS_SUPPORTED_SHUFFLE_REPEAT BIT(9)
131+
/** @} */
82132

83-
/** Media states */
133+
/**
134+
* @name Media states
135+
* @{
136+
*/
137+
/** The current track is invalid, and no track has been selected. */
84138
#define BT_MCS_MEDIA_STATE_INACTIVE 0x00
139+
/** The media player is playing the current track. */
85140
#define BT_MCS_MEDIA_STATE_PLAYING 0x01
141+
/** The current track is paused. The media player has a current track, but it is not being played */
86142
#define BT_MCS_MEDIA_STATE_PAUSED 0x02
143+
/** The current track is fast forwarding or fast rewinding. */
87144
#define BT_MCS_MEDIA_STATE_SEEKING 0x03
88-
#define BT_MCS_MEDIA_STATE_LAST 0x04
145+
/** @} */
89146

90-
/** Media control point opcodes */
147+
/**
148+
* @name Media control point opcodes
149+
* @{
150+
*/
151+
/** Start playing the current track. */
91152
#define BT_MCS_OPC_PLAY 0x01
153+
/** Pause playing the current track. */
92154
#define BT_MCS_OPC_PAUSE 0x02
155+
/** Fast rewind the current track. */
93156
#define BT_MCS_OPC_FAST_REWIND 0x03
157+
/** Fast forward the current track. */
94158
#define BT_MCS_OPC_FAST_FORWARD 0x04
159+
/**
160+
* Stop current activity and return to the paused state and set the current track position to the
161+
* start of the current track.
162+
*/
95163
#define BT_MCS_OPC_STOP 0x05
96164

165+
/** Set a new current track position relative to the current track position. */
97166
#define BT_MCS_OPC_MOVE_RELATIVE 0x10
98167

168+
/**
169+
* Set the current track position to the starting position of the previous segment of the current
170+
* track.
171+
*/
99172
#define BT_MCS_OPC_PREV_SEGMENT 0x20
173+
/**
174+
* Set the current track position to the starting position of
175+
* the next segment of the current track.
176+
*/
100177
#define BT_MCS_OPC_NEXT_SEGMENT 0x21
178+
/**
179+
* Set the current track position to the starting position of
180+
* the first segment of the current track.
181+
*/
101182
#define BT_MCS_OPC_FIRST_SEGMENT 0x22
183+
/**
184+
* Set the current track position to the starting position of
185+
* the last segment of the current track.
186+
*/
102187
#define BT_MCS_OPC_LAST_SEGMENT 0x23
188+
/**
189+
* Set the current track position to the starting position of
190+
* the nth segment of the current track.
191+
*/
103192
#define BT_MCS_OPC_GOTO_SEGMENT 0x24
104193

194+
/** Set the current track to the previous track based on the playing order. */
105195
#define BT_MCS_OPC_PREV_TRACK 0x30
196+
/** Set the current track to the next track based on the playing order. */
106197
#define BT_MCS_OPC_NEXT_TRACK 0x31
198+
/** Set the current track to the first track based on the playing order. */
107199
#define BT_MCS_OPC_FIRST_TRACK 0x32
200+
/** Set the current track to the last track based on the playing order. */
108201
#define BT_MCS_OPC_LAST_TRACK 0x33
202+
/** Set the current track to the nth track based on the playing order. */
109203
#define BT_MCS_OPC_GOTO_TRACK 0x34
110204

205+
/** Set the current group to the previous group in the sequence of groups. */
111206
#define BT_MCS_OPC_PREV_GROUP 0x40
207+
/** Set the current group to the next group in the sequence of groups. */
112208
#define BT_MCS_OPC_NEXT_GROUP 0x41
209+
/** Set the current group to the first group in the sequence of groups. */
113210
#define BT_MCS_OPC_FIRST_GROUP 0x42
211+
/** Set the current group to the last group in the sequence of groups. */
114212
#define BT_MCS_OPC_LAST_GROUP 0x43
213+
/** Set the current group to the nth group in the sequence of groups. */
115214
#define BT_MCS_OPC_GOTO_GROUP 0x44
215+
/** @} */
116216

117217
/** Media control point supported opcodes length */
118218
#define BT_MCS_OPCODES_SUPPORTED_LEN 4
119219

120-
/** Media control point supported opcodes values */
220+
/**
221+
* @name Media control point supported opcodes values
222+
* @{
223+
*/
224+
/** Support the Play opcode */
121225
#define BT_MCS_OPC_SUP_PLAY BIT(0)
226+
/** Support the Pause opcode */
122227
#define BT_MCS_OPC_SUP_PAUSE BIT(1)
228+
/** Support the Fast Rewind opcode */
123229
#define BT_MCS_OPC_SUP_FAST_REWIND BIT(2)
230+
/** Support the Fast Forward opcode */
124231
#define BT_MCS_OPC_SUP_FAST_FORWARD BIT(3)
232+
/** Support the Stop opcode */
125233
#define BT_MCS_OPC_SUP_STOP BIT(4)
126234

235+
/** Support the Move Relative opcode */
127236
#define BT_MCS_OPC_SUP_MOVE_RELATIVE BIT(5)
128237

238+
/** Support the Previous Segment opcode */
129239
#define BT_MCS_OPC_SUP_PREV_SEGMENT BIT(6)
240+
/** Support the Next Segment opcode */
130241
#define BT_MCS_OPC_SUP_NEXT_SEGMENT BIT(7)
242+
/** Support the First Segment opcode */
131243
#define BT_MCS_OPC_SUP_FIRST_SEGMENT BIT(8)
244+
/** Support the Last Segment opcode */
132245
#define BT_MCS_OPC_SUP_LAST_SEGMENT BIT(9)
246+
/** Support the Goto Segment opcode */
133247
#define BT_MCS_OPC_SUP_GOTO_SEGMENT BIT(10)
134248

249+
/** Support the Previous Track opcode */
135250
#define BT_MCS_OPC_SUP_PREV_TRACK BIT(11)
251+
/** Support the Next Track opcode */
136252
#define BT_MCS_OPC_SUP_NEXT_TRACK BIT(12)
253+
/** Support the First Track opcode */
137254
#define BT_MCS_OPC_SUP_FIRST_TRACK BIT(13)
255+
/** Support the Last Track opcode */
138256
#define BT_MCS_OPC_SUP_LAST_TRACK BIT(14)
257+
/** Support the Goto Track opcode */
139258
#define BT_MCS_OPC_SUP_GOTO_TRACK BIT(15)
140259

260+
/** Support the Previous Group opcode */
141261
#define BT_MCS_OPC_SUP_PREV_GROUP BIT(16)
262+
/** Support the Next Group opcode */
142263
#define BT_MCS_OPC_SUP_NEXT_GROUP BIT(17)
264+
/** Support the First Group opcode */
143265
#define BT_MCS_OPC_SUP_FIRST_GROUP BIT(18)
266+
/** Support the Last Group opcode */
144267
#define BT_MCS_OPC_SUP_LAST_GROUP BIT(19)
268+
/** Support the Goto Group opcode */
145269
#define BT_MCS_OPC_SUP_GOTO_GROUP BIT(20)
270+
/** @} */
146271

147-
/** Media control point notification result codes */
272+
/**
273+
* @name Media control point notification result codes
274+
* @{
275+
*/
276+
/** Action requested by the opcode write was completed successfully. */
148277
#define BT_MCS_OPC_NTF_SUCCESS 0x01
278+
/** An invalid or unsupported opcode was used for the Media Control Point write. */
149279
#define BT_MCS_OPC_NTF_NOT_SUPPORTED 0x02
280+
/**
281+
* The Media Player State characteristic value is Inactive when the opcode is received or the
282+
* result of the requested action of the opcode results in the Media Player State characteristic
283+
* being set to Inactive.
284+
*/
150285
#define BT_MCS_OPC_NTF_PLAYER_INACTIVE 0x03
286+
/**
287+
* The requested action of any Media Control Point write cannot be completed successfully because of
288+
* a condition within the player.
289+
*/
151290
#define BT_MCS_OPC_NTF_CANNOT_BE_COMPLETED 0x04
291+
/** @} */
152292

153-
/** Search control point type values */
154-
/* Reference: Media Control Service spec v1.0 section 3.20.2 */
293+
/**
294+
* @name Search control point type values
295+
*
296+
* Reference: Media Control Service spec v1.0 section 3.20.2
297+
* @{
298+
*/
299+
/** Search for Track Name */
155300
#define BT_MCS_SEARCH_TYPE_TRACK_NAME 0x01
301+
/** Search for Artist Name */
156302
#define BT_MCS_SEARCH_TYPE_ARTIST_NAME 0x02
303+
/** Search for Album Name */
157304
#define BT_MCS_SEARCH_TYPE_ALBUM_NAME 0x03
305+
/** Search for Group Name */
158306
#define BT_MCS_SEARCH_TYPE_GROUP_NAME 0x04
307+
/** Search for Earliest Year */
159308
#define BT_MCS_SEARCH_TYPE_EARLIEST_YEAR 0x05
309+
/** Search for Latest Year */
160310
#define BT_MCS_SEARCH_TYPE_LATEST_YEAR 0x06
311+
/** Search for Genre */
161312
#define BT_MCS_SEARCH_TYPE_GENRE 0x07
313+
/** Search for Tracks only */
162314
#define BT_MCS_SEARCH_TYPE_ONLY_TRACKS 0x08
315+
/** Search for Groups only */
163316
#define BT_MCS_SEARCH_TYPE_ONLY_GROUPS 0x09
317+
/** @} */
164318

165-
/** Search control point values */
166-
#define SEARCH_LEN_MIN 2 /* At least one search control item (SCI),
167-
* consisting of the length octet and the type
168-
* octet. (The parameter field may be empty.)
169-
*/
319+
/**
320+
* @brief Search control point minimum length
321+
*
322+
* At least one search control item (SCI), consisting of the length octet and the type octet.
323+
* (The * parameter field may be empty.)
324+
*/
325+
#define SEARCH_LEN_MIN 2
170326

327+
/** Search control point maximum length */
328+
#define SEARCH_LEN_MAX 64
329+
330+
/**
331+
* @brief Search control point item (SCI) minimum length
332+
*
333+
* An SCI length can be as little as one byte, for an SCI that has only the type field.
334+
* (The SCI len is the length of type + param.)
335+
*/
171336
#define SEARCH_SCI_LEN_MIN 1 /* An SCI length can be as little as one byte,
172337
* for an SCI that has only the type field.
173338
* (The SCI len is the length of type + param.)
174339
*/
175340

176-
#define SEARCH_LEN_MAX 64 /* Max total length of search, defined by spec */
341+
/** Search parameters maximum length */
342+
#define SEARCH_PARAM_MAX 62
177343

178-
#define SEARCH_PARAM_MAX 62 /* A search may have a single search control item
179-
* consisting of length, type and parameter
180-
*/
181-
182-
/** Search notification result codes */
183-
/* Reference: Media Control Service spec v1.0 section 3.20.2 */
344+
/**
345+
* @name Search notification result codes
346+
*
347+
* Reference: Media Control Service spec v1.0 section 3.20.2
348+
* @{
349+
*/
350+
/** Search request was accepted; search has started. */
184351
#define BT_MCS_SCP_NTF_SUCCESS 0x01
352+
/** Search request was invalid; no search started. */
185353
#define BT_MCS_SCP_NTF_FAILURE 0x02
354+
/** @} */
186355

187-
/* Group object object types */
188-
/* Reference: Media Control Service spec v1.0 section 4.4.1 */
356+
/**
357+
* @name Group object object types
358+
*
359+
* Reference: Media Control Service spec v1.0 section 4.4.1
360+
* @{
361+
*/
362+
/** Group object type is track */
189363
#define BT_MCS_GROUP_OBJECT_TRACK_TYPE 0x00
364+
/** Group object type is group */
190365
#define BT_MCS_GROUP_OBJECT_GROUP_TYPE 0x01
191-
366+
/** @} */
192367

193368
#ifdef __cplusplus
194369
}

0 commit comments

Comments
 (0)