@@ -50,6 +50,9 @@ extern "C" {
50
50
/** @brief Abstract Audio Broadcast Source structure. */
51
51
struct bt_cap_broadcast_source ;
52
52
53
+ /** @brief Abstract CAP Unicast Group structure. */
54
+ struct bt_cap_unicast_group ;
55
+
53
56
/**
54
57
* @brief Register the Common Audio Service.
55
58
*
@@ -254,6 +257,147 @@ int bt_cap_stream_send_ts(struct bt_cap_stream *stream, struct net_buf *buf, uin
254
257
*/
255
258
int bt_cap_stream_get_tx_sync (struct bt_cap_stream * stream , struct bt_iso_tx_info * info );
256
259
260
+ /** Parameter struct for each stream in the unicast group */
261
+ struct bt_cap_unicast_group_stream_param {
262
+ /** Pointer to a stream object. */
263
+ struct bt_cap_stream * stream ;
264
+
265
+ /** The QoS settings for the stream object. */
266
+ struct bt_bap_qos_cfg * qos_cfg ;
267
+ };
268
+
269
+ /**
270
+ * @brief Parameter struct for the unicast group functions
271
+ *
272
+ * Parameter struct for the bt_cap_unicast_group_create() and
273
+ * bt_cap_unicast_group_add_streams() functions.
274
+ */
275
+ struct bt_cap_unicast_group_stream_pair_param {
276
+ /** Pointer to a receiving stream parameters. */
277
+ struct bt_cap_unicast_group_stream_param * rx_param ;
278
+
279
+ /** Pointer to a transmitting stream parameters. */
280
+ struct bt_cap_unicast_group_stream_param * tx_param ;
281
+ };
282
+
283
+ /** Parameters for the creating unicast groups with bt_cap_unicast_group_create() */
284
+ struct bt_cap_unicast_group_param {
285
+ /** The number of parameters in @p params */
286
+ size_t params_count ;
287
+
288
+ /** Array of stream parameters */
289
+ struct bt_cap_unicast_group_stream_pair_param * params ;
290
+
291
+ /**
292
+ * @brief Unicast Group packing mode.
293
+ *
294
+ * @ref BT_ISO_PACKING_SEQUENTIAL or @ref BT_ISO_PACKING_INTERLEAVED.
295
+ *
296
+ * @note This is a recommendation to the controller, which the controller may ignore.
297
+ */
298
+ uint8_t packing ;
299
+
300
+ #if defined(CONFIG_BT_ISO_TEST_PARAMS ) || defined(__DOXYGEN__ )
301
+ /**
302
+ * @brief Central to Peripheral flush timeout
303
+ *
304
+ * The flush timeout in multiples of ISO_Interval for each payload sent
305
+ * from the Central to Peripheral.
306
+ *
307
+ * Value range from @ref BT_ISO_FT_MIN to @ref BT_ISO_FT_MAX
308
+ */
309
+ uint8_t c_to_p_ft ;
310
+
311
+ /**
312
+ * @brief Peripheral to Central flush timeout
313
+ *
314
+ * The flush timeout in multiples of ISO_Interval for each payload sent
315
+ * from the Peripheral to Central.
316
+ *
317
+ * Value range from @ref BT_ISO_FT_MIN to @ref BT_ISO_FT_MAX.
318
+ */
319
+ uint8_t p_to_c_ft ;
320
+
321
+ /**
322
+ * @brief ISO interval
323
+ *
324
+ * Time between consecutive CIS anchor points.
325
+ *
326
+ * Value range from @ref BT_ISO_ISO_INTERVAL_MIN to @ref BT_ISO_ISO_INTERVAL_MAX.
327
+ */
328
+ uint16_t iso_interval ;
329
+ #endif /* CONFIG_BT_ISO_TEST_PARAMS */
330
+ };
331
+
332
+ /**
333
+ * @brief Create unicast group.
334
+ *
335
+ * Create a new audio unicast group with one or more audio streams as a unicast client.
336
+ * All streams shall share the same framing.
337
+ * All streams in the same direction shall share the same interval and latency (see
338
+ * @ref bt_bap_qos_cfg).
339
+ *
340
+ * @param[in] param The unicast group create parameters.
341
+ * @param[out] unicast_group Pointer to the unicast group created.
342
+ *
343
+ * @return Zero on success or (negative) error code otherwise.
344
+ */
345
+ int bt_cap_unicast_group_create (const struct bt_cap_unicast_group_param * param ,
346
+ struct bt_cap_unicast_group * * unicast_group );
347
+
348
+ /**
349
+ * @brief Reconfigure unicast group.
350
+ *
351
+ * Reconfigure a unicast group with one or more audio streams as a unicast client.
352
+ * All streams shall share the same framing.
353
+ * All streams in the same direction shall share the same interval and latency (see
354
+ * @ref bt_bap_qos_cfg).
355
+ * All streams in @p param shall already belong to @p unicast_group.
356
+ * Use bt_cap_unicast_group_add_streams() to add additional streams.
357
+ *
358
+ * @param unicast_group Pointer to the unicast group created.
359
+ * @param param The unicast group reconfigure parameters.
360
+ *
361
+ * @return Zero on success or (negative) error code otherwise.
362
+ */
363
+ int bt_cap_unicast_group_reconfig (struct bt_cap_unicast_group * unicast_group ,
364
+ const struct bt_cap_unicast_group_param * param );
365
+
366
+ /**
367
+ * @brief Add streams to a unicast group as a unicast client
368
+ *
369
+ * This function can be used to add additional streams to a bt_cap_unicast_group.
370
+ *
371
+ * This can be called at any time before any of the streams in the group has been started
372
+ * (see bt_bap_stream_ops.started()).
373
+ * This can also be called after the streams have been stopped (see bt_bap_stream_ops.stopped()).
374
+ *
375
+ * Once a stream has been added to a unicast group, it cannot be removed. To remove a stream from a
376
+ * group, the group must be deleted with bt_cap_unicast_group_delete(), but this will require all
377
+ * streams in the group to be released first.
378
+ *
379
+ * @param unicast_group Pointer to the unicast group
380
+ * @param params Array of stream parameters with streams being added to the group.
381
+ * @param num_param Number of parameters in @p params.
382
+ *
383
+ * @return 0 in case of success or negative value in case of error.
384
+ */
385
+ int bt_cap_unicast_group_add_streams (struct bt_cap_unicast_group * unicast_group ,
386
+ const struct bt_cap_unicast_group_stream_pair_param params [],
387
+ size_t num_param );
388
+
389
+ /**
390
+ * @brief Delete audio unicast group.
391
+ *
392
+ * Delete a audio unicast group as a client. All streams in the group shall
393
+ * be in the idle or configured state.
394
+ *
395
+ * @param unicast_group Pointer to the unicast group to delete
396
+ *
397
+ * @return Zero on success or (negative) error code otherwise.
398
+ */
399
+ int bt_cap_unicast_group_delete (struct bt_cap_unicast_group * unicast_group );
400
+
257
401
/** Stream specific parameters for the bt_cap_initiator_unicast_audio_start() function */
258
402
struct bt_cap_unicast_audio_start_stream_param {
259
403
/** Coordinated or ad-hoc set member. */
0 commit comments