summaryrefslogtreecommitdiff
path: root/src/gatt-client.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-09-28 15:45:05 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-09-28 15:45:05 -0700
commitaaa0c4996ae9638be5b97de916acfcf68782430a (patch)
tree78f9deedfaf87dd754313ae1355895da5466a758 /src/gatt-client.c
parent1abf1400fa18e70a9085be7864f68f7c054fca14 (diff)
downloadbluez-aaa0c4996ae9638be5b97de916acfcf68782430a.tar.gz
gatt: Add implementation of GattCharacteristic1.MTU
This implements MTU property in GattCharacteristic1 interface.
Diffstat (limited to 'src/gatt-client.c')
-rw-r--r--src/gatt-client.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gatt-client.c b/src/gatt-client.c
index 6bed77793..5b10cbfa0 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -873,6 +873,25 @@ characteristic_notify_acquired_exists(const GDBusPropertyTable *property,
return (chrc->props & BT_GATT_CHRC_PROP_NOTIFY);
}
+static gboolean characteristic_get_mtu(const GDBusPropertyTable *property,
+ DBusMessageIter *iter, void *data)
+{
+ struct characteristic *chrc = data;
+ struct bt_gatt_client *gatt = chrc->service->client->gatt;
+ struct bt_att *att;
+ uint16_t mtu;
+
+ att = bt_gatt_client_get_att(gatt);
+ if (!att)
+ return FALSE;
+
+ mtu = bt_att_get_mtu(att);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT16, &mtu);
+
+ return TRUE;
+}
+
static void write_characteristic_cb(struct gatt_db_attribute *attr, int err,
void *user_data)
{
@@ -1646,6 +1665,7 @@ static const GDBusPropertyTable characteristic_properties[] = {
characteristic_write_acquired_exists },
{ "NotifyAcquired", "b", characteristic_get_notify_acquired, NULL,
characteristic_notify_acquired_exists },
+ { "MTU", "q", characteristic_get_mtu, NULL, NULL },
{ }
};