summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnuj Jain <anuj01.jain@samsung.com>2021-08-03 14:16:59 +0530
committerAnuj Jain <anuj01.jain@samsung.com>2021-08-04 09:14:36 +0530
commit0e8fc7e441903c4f8465c73b55d14f24594fb9be (patch)
treebae4d5cc5d197004913234463d02130a257b113f
parent123e22537c814b0e8f9134df66c989bfe489ead5 (diff)
downloadbluez-submit/tizen_6.5/20211028.163301.tar.gz
bluez-submit/tizen_6.5/20211028.163301.tar.bz2
bluez-submit/tizen_6.5/20211028.163301.zip
In gatt Server role Client address is added to dbus method calls corresponding to StartNotify and StopNotify methods at BLUEZ layer. This patchset should be merged with the following capi and bluetooth-frwk's patchset in order to match API and avoid crash: bluetooth-frwk Change-Id: Ib54ba54c318692b4ee0eaef9b2310c60dadeb661 capi Change-Id: Ic4868234a4fc682f9bff2c66ac1aee2683f3d6c6 Change-Id: I81a0994f2299e988f8ef6428537647c899700fda Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
-rw-r--r--src/gatt-database.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/gatt-database.c b/src/gatt-database.c
index a6b9dbcf..6e659299 100644
--- a/src/gatt-database.c
+++ b/src/gatt-database.c
@@ -3043,6 +3043,23 @@ static struct pending_op *acquire_write(struct external_chrc *chrc,
return NULL;
}
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static void start_notify_setup(DBusMessageIter *iter, void *user_data)
+{
+ struct pending_op *op = user_data;
+ struct btd_device *device = op->device;
+ char dst_addr[18] = { 0 };
+ char *addr_value = dst_addr;
+
+ if (device_get_rpa_exist(device) == true)
+ ba2str(device_get_rpa(device), dst_addr);
+ else
+ ba2str(device_get_address(device), dst_addr);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &addr_value);
+}
+#endif
+
static void acquire_notify_reply(DBusMessage *message, void *user_data)
{
struct pending_op *op = user_data;
@@ -3088,9 +3105,13 @@ static void acquire_notify_reply(DBusMessage *message, void *user_data)
return;
retry:
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ g_dbus_proxy_method_call(chrc->proxy, "StartNotify",
+ start_notify_setup, NULL, op, NULL);
+#else
g_dbus_proxy_method_call(chrc->proxy, "StartNotify", NULL, NULL,
NULL, NULL);
-
+#endif
__sync_fetch_and_add(&chrc->ntfy_cnt, 1);
}
@@ -3111,6 +3132,23 @@ static void acquire_notify_setup(DBusMessageIter *iter, void *user_data)
dbus_message_iter_close_container(iter, &dict);
}
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+static void stop_notify_setup(DBusMessageIter *iter, void *user_data)
+{
+ struct pending_op *op = user_data;
+ struct btd_device *device = op->device;
+ char dst_addr[18] = { 0 };
+ char *addr_value = dst_addr;
+
+ if (device_get_rpa_exist(device) == true)
+ ba2str(device_get_rpa(device), dst_addr);
+ else
+ ba2str(device_get_address(device), dst_addr);
+
+ dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &addr_value);
+}
+#endif
+
static uint8_t ccc_write_cb(struct pending_op *op, void *user_data)
{
struct external_chrc *chrc = user_data;
@@ -3143,8 +3181,13 @@ static uint8_t ccc_write_cb(struct pending_op *op, void *user_data)
* Send request to stop notifying. This is best-effort
* operation, so simply ignore the return the value.
*/
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ g_dbus_proxy_method_call(chrc->proxy, "StopNotify",
+ stop_notify_setup, NULL, op, NULL);
+#else
g_dbus_proxy_method_call(chrc->proxy, "StopNotify", NULL,
NULL, NULL, NULL);
+#endif
goto done;
}
@@ -3179,8 +3222,13 @@ static uint8_t ccc_write_cb(struct pending_op *op, void *user_data)
* Always call StartNotify for an incoming enable and ignore the return
* value for now.
*/
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ if (g_dbus_proxy_method_call(chrc->proxy, "StartNotify", start_notify_setup, NULL,
+ op, NULL) == FALSE)
+#else
if (g_dbus_proxy_method_call(chrc->proxy, "StartNotify", NULL, NULL,
NULL, NULL) == FALSE)
+#endif
return BT_ATT_ERROR_UNLIKELY;
__sync_fetch_and_add(&chrc->ntfy_cnt, 1);