summaryrefslogtreecommitdiff
path: root/src/gatt-client.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-11-29 09:59:42 -0800
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-11-29 09:59:42 -0800
commitaa361e22164aeb8a161a75e7704ea265eeae7472 (patch)
tree19ed7097abed5917d8236fc4bf1f417100b0d35f /src/gatt-client.c
parentebf2d7935690c00c7fd12768177e2023fc63c9fe (diff)
downloadbluez-aa361e22164aeb8a161a75e7704ea265eeae7472.tar.gz
gatt: Omit MTU if not connected
If not connected there is no reason to expose the MTU as that only valid while connected.
Diffstat (limited to 'src/gatt-client.c')
-rw-r--r--src/gatt-client.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gatt-client.c b/src/gatt-client.c
index 6ee984db9..b2fc16b90 100644
--- a/src/gatt-client.c
+++ b/src/gatt-client.c
@@ -890,6 +890,14 @@ static gboolean characteristic_get_mtu(const GDBusPropertyTable *property,
return TRUE;
}
+static gboolean characteristic_mtu_exists(const GDBusPropertyTable *property,
+ void *data)
+{
+ struct characteristic *chrc = data;
+
+ return chrc->service->client->gatt ? TRUE : FALSE;
+}
+
static void write_characteristic_cb(struct gatt_db_attribute *attr, int err,
void *user_data)
{
@@ -1663,7 +1671,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 },
+ { "MTU", "q", characteristic_get_mtu, NULL, characteristic_mtu_exists },
{ }
};