@@ -147,6 +147,22 @@ struct bt_cap_initiator_cb {
147
147
*/
148
148
void (* broadcast_stopped )(struct bt_cap_broadcast_source * source , uint8_t reason );
149
149
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE */
150
+ #if defined(CONFIG_BT_CAP_HANDOVER_SUPPORTED )
151
+ /**
152
+ * @brief The unicast to broadcast handover procedure has finished
153
+ *
154
+ * @param err 0 if success else a negative errno value.
155
+ * @param conn Pointer to the connection where the error
156
+ * occurred or NULL local failure.
157
+ * @param unicast_group NULL if the unicast group was deleted during the procedure, else
158
+ * pointer to the unicast group provided in the parameters.
159
+ * @param broadcast_source Pointer to newly created broadcast source, or NULL in case of an
160
+ * error happening before it was created.
161
+ */
162
+ void (* unicast_to_broadcast_complete )(int err , struct bt_conn * conn ,
163
+ struct bt_cap_unicast_group * unicast_group ,
164
+ struct bt_cap_broadcast_source * broadcast_source );
165
+ #endif /* CONFIG_BT_CAP_HANDOVER_SUPPORTED */
150
166
};
151
167
152
168
/**
@@ -398,6 +414,32 @@ int bt_cap_unicast_group_add_streams(struct bt_cap_unicast_group *unicast_group,
398
414
*/
399
415
int bt_cap_unicast_group_delete (struct bt_cap_unicast_group * unicast_group );
400
416
417
+ /** Callback function for bt_bap_unicast_group_foreach_stream()
418
+ *
419
+ * @param stream The audio stream
420
+ * @param user_data User data
421
+ *
422
+ * @retval true Stop iterating.
423
+ * @retval false Continue iterating.
424
+ */
425
+ typedef bool (* bt_cap_unicast_group_foreach_stream_func_t )(struct bt_cap_stream * stream ,
426
+ void * user_data );
427
+
428
+ /**
429
+ * @brief Iterate through all streams in a unicast group
430
+ *
431
+ * @param unicast_group The unicast group
432
+ * @param func The callback function
433
+ * @param user_data User specified data that sent to the callback function
434
+ *
435
+ * @retval 0 Success (even if no streams exists in the group).
436
+ * @retval -ECANCELED Iteration was stopped by the callback function before complete.
437
+ * @retval -EINVAL @p unicast_group or @p func were NULL.
438
+ */
439
+ int bt_cap_unicast_group_foreach_stream (struct bt_cap_unicast_group * unicast_group ,
440
+ bt_cap_unicast_group_foreach_stream_func_t func ,
441
+ void * user_data );
442
+
401
443
/** Stream specific parameters for the bt_cap_initiator_unicast_audio_start() function */
402
444
struct bt_cap_unicast_audio_start_stream_param {
403
445
/** Coordinated or ad-hoc set member. */
@@ -788,50 +830,47 @@ int bt_cap_initiator_broadcast_get_base(struct bt_cap_broadcast_source *broadcas
788
830
789
831
/** Parameters for bt_cap_initiator_unicast_to_broadcast() */
790
832
struct bt_cap_unicast_to_broadcast_param {
833
+ /** The type of the set. */
834
+ enum bt_cap_set_type type ;
835
+
791
836
/** The source unicast group with the streams. */
792
- struct bt_bap_unicast_group * unicast_group ;
837
+ struct bt_cap_unicast_group * unicast_group ;
793
838
794
839
/**
795
- * @brief Whether or not to encrypt the streams.
840
+ * @brief The advertising set to use for the broadcast source
796
841
*
797
- * If set to true, then the broadcast code in @p broadcast_code
798
- * will be used to encrypt the streams.
842
+ * This shall remain valid until the procedure has completed.
843
+ * If the advertising set is not started at the time of calling
844
+ * bt_cap_initiator_unicast_to_broadcast(),
845
+ * the procedure will start the advertising set with @ref BT_LE_EXT_ADV_START_DEFAULT.
799
846
*/
800
- bool encrypt ;
847
+ struct bt_le_ext_adv * ext_adv ;
848
+
849
+ uint8_t sid ;
850
+ uint16_t pa_interval ;
851
+ uint32_t broadcast_id ;
801
852
802
853
/**
803
- * @brief 16-octet broadcast code.
804
- *
805
- * Only valid if @p encrypt is true.
806
- *
807
- * If the value is a string or a the value is less than 16 octets,
808
- * the remaining octets shall be 0.
854
+ * @brief Broadcast source parameters
809
855
*
810
- * Example:
811
- * The string "Broadcast Code" shall be
812
- * [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
856
+ * These parameters shall remain valid until the procedure has completed.
813
857
*/
814
- uint8_t broadcast_code [ BT_ISO_BROADCAST_CODE_SIZE ] ;
858
+ struct bt_cap_initiator_broadcast_create_param * broadcast_create_param ;
815
859
};
816
860
817
861
/**
818
862
* @brief Hands over the data streams in a unicast group to a broadcast source.
819
863
*
820
864
* The streams in the unicast group will be stopped and the unicast group
821
- * will be deleted. This can only be done for source streams.
865
+ * will be deleted. This can only be done for sink streams.
822
866
*
823
- * @note @kconfig{CONFIG_BT_CAP_INITIATOR},
824
- * @kconfig{CONFIG_BT_BAP_UNICAST_CLIENT} and
825
- * @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
826
- * to be enabled.
867
+ * @kconfig_dep{CONFIG_BT_CAP_HANDOVER_SUPPORTED}
827
868
*
828
869
* @param param The parameters for the handover.
829
- * @param source The resulting broadcast source.
830
870
*
831
871
* @return 0 on success or negative error value on failure.
832
872
*/
833
- int bt_cap_initiator_unicast_to_broadcast (const struct bt_cap_unicast_to_broadcast_param * param ,
834
- struct bt_cap_broadcast_source * * source );
873
+ int bt_cap_initiator_unicast_to_broadcast (const struct bt_cap_unicast_to_broadcast_param * param );
835
874
836
875
/** Parameters for bt_cap_initiator_broadcast_to_unicast() */
837
876
struct bt_cap_broadcast_to_unicast_param {
@@ -864,10 +903,7 @@ struct bt_cap_broadcast_to_unicast_param {
864
903
* The streams in the broadcast source will be stopped and the broadcast source
865
904
* will be deleted.
866
905
*
867
- * @note @kconfig{CONFIG_BT_CAP_INITIATOR},
868
- * @kconfig{CONFIG_BT_BAP_UNICAST_CLIENT} and
869
- * @kconfig{CONFIG_BT_BAP_BROADCAST_SOURCE} must be enabled for this function
870
- * to be enabled.
906
+ * @kconfig_dep{CONFIG_BT_CAP_HANDOVER_SUPPORTED}
871
907
*
872
908
* @param[in] param The parameters for the handover.
873
909
* @param[out] unicast_group The resulting broadcast source.
0 commit comments