@@ -273,6 +273,86 @@ struct bt_conn_le_read_all_remote_feat_complete {
273273 const uint8_t * features ;
274274};
275275
276+ #define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_ACL_IFS \
277+ (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_CP_MASK | \
278+ BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_PC_MASK)
279+
280+ #define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_ACL \
281+ (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_CP_MASK | \
282+ BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_ACL_PC_MASK | \
283+ BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MCES_MASK)
284+
285+ #define BT_CONN_LE_FRAME_SPACE_TYPES_MASK_CIS \
286+ (BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_IFS_CIS_MASK | \
287+ BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_MSS_CIS_MASK)
288+
289+ /** Maximum frame space in microseconds.
290+ * As defined in Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151.
291+ */
292+ #define BT_CONN_LE_FRAME_SPACE_MAX (10000U)
293+
294+ /** Frame space update initiator. */
295+ enum bt_conn_le_frame_space_update_initiator {
296+ /** Initiated by local host */
297+ BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST =
298+ BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_HOST ,
299+ /** Initiated by local controller */
300+ BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER =
301+ BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_LOCAL_CONTROLLER ,
302+ /** Initiated by peer */
303+ BT_CONN_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER =
304+ BT_HCI_LE_FRAME_SPACE_UPDATE_INITIATOR_PEER
305+ };
306+
307+ /** Frame space update params */
308+ struct bt_conn_le_frame_space_update_param {
309+ /** Phy mask of the PHYs to be updated.
310+ * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_* for values.
311+ */
312+ uint8_t phys ;
313+ /** Spacing types mask of the spacing types to be updated.
314+ * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_* and
315+ * BT_CONN_LE_FRAME_SPACE_TYPES_MASK_* for values.
316+ */
317+ uint16_t spacing_types ;
318+ /** Minimum frame space in microseconds.
319+ * Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151
320+ * allows for a range of frame space from 0 to 10000 microseconds.
321+ * The actual supported frame space values will be dependent on
322+ * the controller's capabilities.
323+ */
324+ uint16_t frame_space_min ;
325+ /** Maximum frame space in microseconds.
326+ * Bluetooth Core Specification, Vol 4, Part E, Section 7.8.151
327+ * allows for a range of frame space from 0 to 10000 microseconds.
328+ * The actual supported frame space values will be dependent on
329+ * the controller's capabilities.
330+ */
331+ uint16_t frame_space_max ;
332+ };
333+
334+ /** Frame space updated callback params */
335+ struct bt_conn_le_frame_space_updated {
336+ /** HCI Status from LE Frame Space Update Complete event.
337+ * The remaining parameters will be invalid if status is not
338+ * @ref BT_HCI_ERR_SUCCESS.
339+ */
340+ uint8_t status ;
341+ /** Initiator of the frame space update. */
342+ enum bt_conn_le_frame_space_update_initiator initiator ;
343+ /** Updated frame space in microseconds. */
344+ uint16_t frame_space ;
345+ /** Phy mask of the PHYs updated.
346+ * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_PHY_* for values.
347+ */
348+ uint8_t phys ;
349+ /** Spacing types mask of the spacing types updated.
350+ * Refer to BT_HCI_LE_FRAME_SPACE_UPDATE_SPACING_TYPE_* and
351+ * BT_CONN_LE_FRAME_SPACE_TYPES_MASK_* for values.
352+ */
353+ uint16_t spacing_types ;
354+ };
355+
276356/** Connection Type */
277357enum __packed bt_conn_type {
278358 /** LE Connection Type */
@@ -1225,6 +1305,23 @@ int bt_conn_le_subrate_request(struct bt_conn *conn,
12251305 */
12261306int bt_conn_le_read_all_remote_features (struct bt_conn * conn , uint8_t pages_requested );
12271307
1308+ /** @brief Update frame space.
1309+ *
1310+ * Request a change to the frame space parameters of a connection.
1311+ * This function will trigger the frame_space_updated callback when the
1312+ * procedure is completed.
1313+ *
1314+ * @kconfig_dep{CONFIG_BT_FRAME_SPACE_UPDATE}.
1315+ *
1316+ * @param conn @ref BT_CONN_TYPE_LE connection object.
1317+ * @param params Frame Space Update parameters.
1318+ *
1319+ * @return Zero on success or (negative) error code on failure.
1320+ * @return -EINVAL @p conn is not a valid @ref BT_CONN_TYPE_LE connection.
1321+ */
1322+ int bt_conn_le_frame_space_update (struct bt_conn * conn ,
1323+ const struct bt_conn_le_frame_space_update_param * params );
1324+
12281325/** @brief Update the connection parameters.
12291326 *
12301327 * If the local device is in the peripheral role then updating the connection
@@ -1935,6 +2032,26 @@ struct bt_conn_cb {
19352032 const struct bt_conn_le_read_all_remote_feat_complete * params );
19362033#endif /* CONFIG_BT_LE_EXTENDED_FEAT_SET */
19372034
2035+ #if defined(CONFIG_BT_FRAME_SPACE_UPDATE )
2036+ /** @brief Frame Space Update Complete event.
2037+ *
2038+ * This callback notifies the application that the frame space of
2039+ * the connection may have changed.
2040+ * The frame space update parameters will be invalid
2041+ * if status is not @ref BT_HCI_ERR_SUCCESS.
2042+ *
2043+ * This callback can be triggered by calling @ref
2044+ * bt_conn_le_frame_space_update, by the procedure running
2045+ * autonomously in the controller or by the peer.
2046+ *
2047+ * @param conn Connection object.
2048+ * @param params New frame space update parameters.
2049+ */
2050+ void (* frame_space_updated )(
2051+ struct bt_conn * conn ,
2052+ const struct bt_conn_le_frame_space_updated * params );
2053+ #endif /* CONFIG_BT_FRAME_SPACE_UPDATE */
2054+
19382055#if defined(CONFIG_BT_CHANNEL_SOUNDING )
19392056 /** @brief LE CS Read Remote Supported Capabilities Complete event.
19402057 *
0 commit comments