Skip to content

Commit

Permalink
Bluetooth: Audio: Rename bt_audio_codec_qos -> bt_bap_qos_cfg
Browse files Browse the repository at this point in the history
The QoS structure is not related to a codec, but rather a
stream, and should thus not use the "Codec" name.

The BAP and ASCS specs refer to the QoS as
"QoS configuration" several places, so it is an obvious
choice for a name.

Since the structure is defined and used by BAP, the prefix
was changed from bt_audio to bt_bap.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
  • Loading branch information
Thalley committed Sep 11, 2024
1 parent 884a4e5 commit 91a22a5
Show file tree
Hide file tree
Showing 50 changed files with 516 additions and 522 deletions.
5 changes: 5 additions & 0 deletions doc/releases/migration-guide-4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,11 @@ Bluetooth Audio
:c:func:`bt_bap_unicast_server_unregister` has been called.
(:github:`76632`)

* There has been a rename from ``bt_audio_codec_qos`` to ``bt_bap_qos_cfg``. This effects all
structs, enums and defines that used the ``bt_audio_codec_qos`` name. To use the new naming simply
do a search-and-replace for ``bt_audio_codec_qos`` to ``bt_bap_qos_cfg`` and
``BT_AUDIO_CODEC_QOS`` to ``BT_BAP_QOS_CFG``. (:github:`76633`)

Bluetooth Classic
=================

Expand Down
245 changes: 0 additions & 245 deletions include/zephyr/bluetooth/audio/audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -777,251 +777,6 @@ enum bt_audio_dir {
BT_AUDIO_DIR_SOURCE = 0x02,
};

/**
* @brief Helper to declare elements of bt_audio_codec_qos
*
* @param _interval SDU interval (usec)
* @param _framing Framing
* @param _phy Target PHY
* @param _sdu Maximum SDU Size
* @param _rtn Retransmission number
* @param _latency Maximum Transport Latency (msec)
* @param _pd Presentation Delay (usec)
*/
#define BT_AUDIO_CODEC_QOS(_interval, _framing, _phy, _sdu, _rtn, _latency, _pd) \
((struct bt_audio_codec_qos){ \
.interval = _interval, \
.framing = _framing, \
.phy = _phy, \
.sdu = _sdu, \
.rtn = _rtn, \
IF_ENABLED(UTIL_OR(IS_ENABLED(CONFIG_BT_BAP_BROADCAST_SOURCE), \
IS_ENABLED(CONFIG_BT_BAP_UNICAST)), \
(.latency = _latency,)) \
.pd = _pd, \
})

/** @brief Codec QoS Framing */
enum bt_audio_codec_qos_framing {
/** Packets may be framed or unframed */
BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED = 0x00,
/** Packets are always framed */
BT_AUDIO_CODEC_QOS_FRAMING_FRAMED = 0x01,
};

/** @brief Codec QoS Preferred PHY */
enum {
/** LE 1M PHY */
BT_AUDIO_CODEC_QOS_1M = BIT(0),
/** LE 2M PHY */
BT_AUDIO_CODEC_QOS_2M = BIT(1),
/** LE Coded PHY */
BT_AUDIO_CODEC_QOS_CODED = BIT(2),
};

/**
* @brief Helper to declare Input Unframed bt_audio_codec_qos
*
* @param _interval SDU interval (usec)
* @param _sdu Maximum SDU Size
* @param _rtn Retransmission number
* @param _latency Maximum Transport Latency (msec)
* @param _pd Presentation Delay (usec)
*/
#define BT_AUDIO_CODEC_QOS_UNFRAMED(_interval, _sdu, _rtn, _latency, _pd) \
BT_AUDIO_CODEC_QOS(_interval, BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED, BT_AUDIO_CODEC_QOS_2M, \
_sdu, _rtn, _latency, _pd)

/**
* @brief Helper to declare Input Framed bt_audio_codec_qos
*
* @param _interval SDU interval (usec)
* @param _sdu Maximum SDU Size
* @param _rtn Retransmission number
* @param _latency Maximum Transport Latency (msec)
* @param _pd Presentation Delay (usec)
*/
#define BT_AUDIO_CODEC_QOS_FRAMED(_interval, _sdu, _rtn, _latency, _pd) \
BT_AUDIO_CODEC_QOS(_interval, BT_AUDIO_CODEC_QOS_FRAMING_FRAMED, BT_AUDIO_CODEC_QOS_2M, \
_sdu, _rtn, _latency, _pd)

/** @brief Codec QoS structure. */
struct bt_audio_codec_qos {
/**
* @brief Presentation Delay in microseconds
*
* This value can be changed up and until bt_bap_stream_qos() has been called.
* Once a stream has been QoS configured, modifying this field does not modify the value.
* It is however possible to modify this field and call bt_bap_stream_qos() again to update
* the value, assuming that the stream is in the correct state.
*
* Value range 0 to @ref BT_AUDIO_PD_MAX.
*/
uint32_t pd;

/**
* @brief Connected Isochronous Group (CIG) parameters
*
* The fields in this struct affect the value sent to the controller via HCI
* when creating the CIG. Once the group has been created with
* bt_bap_unicast_group_create(), modifying these fields will not affect the group.
*/
struct {
/** QoS Framing */
enum bt_audio_codec_qos_framing framing;

/**
* @brief PHY
*
* Allowed values are @ref BT_AUDIO_CODEC_QOS_1M, @ref BT_AUDIO_CODEC_QOS_2M and
* @ref BT_AUDIO_CODEC_QOS_CODED.
*/
uint8_t phy;

/**
* @brief Retransmission Number
*
* This a recommendation to the controller, and the actual retransmission number
* may be different than this.
*/
uint8_t rtn;

/**
* @brief Maximum SDU size
*
* Value range @ref BT_ISO_MIN_SDU to @ref BT_ISO_MAX_SDU.
*/
uint16_t sdu;

#if defined(CONFIG_BT_BAP_BROADCAST_SOURCE) || defined(CONFIG_BT_BAP_UNICAST) || \
defined(__DOXYGEN__)
/**
* @brief Maximum Transport Latency
*
* Not used for the @kconfig{CONFIG_BT_BAP_BROADCAST_SINK} role.
*/
uint16_t latency;
#endif /* CONFIG_BT_BAP_BROADCAST_SOURCE || CONFIG_BT_BAP_UNICAST */

/**
* @brief SDU Interval
*
* Value range @ref BT_ISO_SDU_INTERVAL_MIN to @ref BT_ISO_SDU_INTERVAL_MAX
*/
uint32_t interval;

#if defined(CONFIG_BT_ISO_TEST_PARAMS) || defined(__DOXYGEN__)
/**
* @brief Maximum PDU size
*
* Maximum size, in octets, of the payload from link layer to link layer.
*
* Value range @ref BT_ISO_CONNECTED_PDU_MIN to @ref BT_ISO_PDU_MAX for
* connected ISO.
*
* Value range @ref BT_ISO_BROADCAST_PDU_MIN to @ref BT_ISO_PDU_MAX for
* broadcast ISO.
*/
uint16_t max_pdu;

/**
* @brief Burst number
*
* Value range @ref BT_ISO_BN_MIN to @ref BT_ISO_BN_MAX.
*/
uint8_t burst_number;

/**
* @brief Number of subevents
*
* Maximum number of subevents in each CIS or BIS event.
*
* Value range @ref BT_ISO_NSE_MIN to @ref BT_ISO_NSE_MAX.
*/
uint8_t num_subevents;
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
};
};

/**
* @brief Helper to declare elements of @ref bt_audio_codec_qos_pref
*
* @param _unframed_supported Unframed PDUs supported
* @param _phy Preferred Target PHY
* @param _rtn Preferred Retransmission number
* @param _latency Preferred Maximum Transport Latency (msec)
* @param _pd_min Minimum Presentation Delay (usec)
* @param _pd_max Maximum Presentation Delay (usec)
* @param _pref_pd_min Preferred Minimum Presentation Delay (usec)
* @param _pref_pd_max Preferred Maximum Presentation Delay (usec)
*/
#define BT_AUDIO_CODEC_QOS_PREF(_unframed_supported, _phy, _rtn, _latency, _pd_min, _pd_max, \
_pref_pd_min, _pref_pd_max) \
{ \
.unframed_supported = _unframed_supported, \
.phy = _phy, \
.rtn = _rtn, \
.latency = _latency, \
.pd_min = _pd_min, \
.pd_max = _pd_max, \
.pref_pd_min = _pref_pd_min, \
.pref_pd_max = _pref_pd_max, \
}

/** @brief Audio Stream Quality of Service Preference structure. */
struct bt_audio_codec_qos_pref {
/**
* @brief Unframed PDUs supported
*
* Unlike the other fields, this is not a preference but whether
* the codec supports unframed ISOAL PDUs.
*/
bool unframed_supported;

/** Preferred PHY */
uint8_t phy;

/** Preferred Retransmission Number */
uint8_t rtn;

/** Preferred Transport Latency */
uint16_t latency;

/**
* @brief Minimum Presentation Delay in microseconds
*
* Unlike the other fields, this is not a preference but a minimum requirement.
*
* Value range 0 to @ref BT_AUDIO_PD_MAX, or @ref BT_AUDIO_PD_PREF_NONE
* to indicate no preference.
*/
uint32_t pd_min;

/**
* @brief Maximum Presentation Delay
*
* Unlike the other fields, this is not a preference but a maximum requirement.
*
* Value range 0 to @ref BT_AUDIO_PD_MAX, or @ref BT_AUDIO_PD_PREF_NONE
* to indicate no preference.
*/
uint32_t pd_max;

/**
* @brief Preferred minimum Presentation Delay
*
* Value range 0 to @ref BT_AUDIO_PD_MAX.
*/
uint32_t pref_pd_min;

/**
* @brief Preferred maximum Presentation Delay
*
* Value range 0 to @ref BT_AUDIO_PD_MAX.
*/
uint32_t pref_pd_max;
};

/**
* @brief Audio codec Config APIs
* @defgroup bt_audio_codec_cfg Codec config parsing APIs
Expand Down
Loading

0 comments on commit 91a22a5

Please sign in to comment.