[GATT] Send prepare_authorize parameter to HAL layer. 50/251750/3 accepted/tizen/unified/20210128.132355 submit/tizen/20210127.232224
authorAyush Garg <ayush.garg@samsung.com>
Tue, 19 Jan 2021 04:57:26 +0000 (10:27 +0530)
committerAyush Garg <ayush.garg@samsung.com>
Wed, 27 Jan 2021 14:28:36 +0000 (19:58 +0530)
In GATT Server role, prepare_authorize parameter will be used
to ask authorization permission from the application when
ATT_PREPARE_WRITE_REQUEST PDU receive for the first time in case
of long write.

This patchset should be merged with the following bluetooth-frwk's
patchset in order to match API and avoid crash:
bluetooth-frwk Change-Id: Ic4397ae86760177e08ccd283e80d4526bd32e0c4

Change-Id: I93bc46151ebbe695c74b224c3a3579c6e5d0de14
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
src/gatt-database.c

index 5f94576..927224e 100644 (file)
@@ -2615,6 +2615,7 @@ static void write_setup_cb(DBusMessageIter *iter, void *user_data)
        char dst_addr[18] = { 0 };
        char *addr_value = dst_addr;
        gboolean response_needed = FALSE;
+       gboolean prep_auth = FALSE;
 
        if (device_get_rpa_exist(op->device) == true) {
                ba2str(device_get_rpa(op->device), dst_addr);
@@ -2628,6 +2629,9 @@ static void write_setup_cb(DBusMessageIter *iter, void *user_data)
        if (op->opcode == BT_ATT_OP_WRITE_REQ)
                response_needed = TRUE;
        dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &response_needed);
+       if (op->prep_authorize)
+               prep_auth = TRUE;
+       dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &prep_auth);
 #endif
 
        dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "y", &array);