[PATCH v3 BlueZ 1/4] src: provide MTU on GATT value reads and writes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/gatt-database.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/src/gatt-database.c b/src/gatt-database.c
index 99c8ea231..287074f0a 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -1932,7 +1932,9 @@ static void append_options(DBusMessageIter *iter, void *user_data)
 {
 	struct pending_op *op = user_data;
 	const char *path = device_get_path(op->device);
+	struct bt_gatt_server *server;
 	const char *link;
+	uint16_t mtu;
 
 	switch (op->link_type) {
 	case BT_ATT_LINK_BREDR:
@@ -1955,6 +1957,14 @@ static void append_options(DBusMessageIter *iter, void *user_data)
 	if (op->prep_authorize)
 		dict_append_entry(iter, "prepare-authorize", DBUS_TYPE_BOOLEAN,
 							&op->prep_authorize);
+
+	server = btd_device_get_gatt_server(op->device);
+	mtu = bt_gatt_server_get_mtu(server);
+
+	dict_append_entry(iter, "mtu", DBUS_TYPE_UINT16, &mtu);
+
+        /* deprecated */
+	dict_append_entry(iter, "MTU", DBUS_TYPE_UINT16, &mtu);
 }
 
 static void read_setup_cb(DBusMessageIter *iter, void *user_data)
@@ -2234,8 +2244,6 @@ static void acquire_write_setup(DBusMessageIter *iter, void *user_data)
 {
 	struct pending_op *op = user_data;
 	DBusMessageIter dict;
-	struct bt_gatt_server *server;
-	uint16_t mtu;
 
 	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
 					DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
@@ -2246,12 +2254,6 @@ static void acquire_write_setup(DBusMessageIter *iter, void *user_data)
 
 	append_options(&dict, op);
 
-	server = btd_device_get_gatt_server(op->device);
-
-	mtu = bt_gatt_server_get_mtu(server);
-
-	dict_append_entry(&dict, "MTU", DBUS_TYPE_UINT16, &mtu);
-
 	dbus_message_iter_close_container(iter, &dict);
 }
 
@@ -2320,8 +2322,6 @@ static void acquire_notify_setup(DBusMessageIter *iter, void *user_data)
 {
 	DBusMessageIter dict;
 	struct pending_op *op = user_data;
-	struct bt_gatt_server *server;
-	uint16_t mtu;
 
 	dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY,
 					DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
@@ -2332,12 +2332,6 @@ static void acquire_notify_setup(DBusMessageIter *iter, void *user_data)
 
 	append_options(&dict, op);
 
-	server = btd_device_get_gatt_server(op->device);
-
-	mtu = bt_gatt_server_get_mtu(server);
-
-	dict_append_entry(&dict, "MTU", DBUS_TYPE_UINT16, &mtu);
-
 	dbus_message_iter_close_container(iter, &dict);
 }
 
-- 
2.18.0

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux