Bluetooth: GATT: Add bt_gatt_get_mtu API

bt_gatt_get_mtu can be useful when GATT is used to transport another
protocol on top.

Change-Id: I328ef49138ccc4ce642b0019d08060f6022d5aa7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Luiz Augusto von Dentz 2017-02-27 13:28:36 +02:00 committed by Johan Hedberg
commit 480cdbd6d3
2 changed files with 16 additions and 0 deletions

View file

@ -729,6 +729,17 @@ struct bt_gatt_indicate_params {
int bt_gatt_indicate(struct bt_conn *conn,
struct bt_gatt_indicate_params *params);
/** @brief Get ATT MTU for a connection
*
* Get negotiated ATT connection MTU, note that this does not equal the largest
* amount of attribute data that can be transferred within a single packet.
*
* @param conn Connection object.
*
* @return MTU in bytes
*/
uint16_t bt_gatt_get_mtu(struct bt_conn *conn);
/* Client API */
/** @brief GATT Exchange MTU parameters */

View file

@ -594,6 +594,11 @@ int bt_gatt_indicate(struct bt_conn *conn,
return 0;
}
uint16_t bt_gatt_get_mtu(struct bt_conn *conn)
{
return bt_att_get_mtu(conn);
}
static uint8_t connected_cb(const struct bt_gatt_attr *attr, void *user_data)
{
struct bt_conn *conn = user_data;