shared/gatt-client: Add op validation check logic and debug log 22/320422/1 accepted/tizen/7.0/unified/20241118.161615
authorWootak Jung <wootak.jung@samsung.com>
Fri, 15 Nov 2024 05:13:23 +0000 (14:13 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Fri, 15 Nov 2024 05:13:23 +0000 (14:13 +0900)
Change-Id: Ibb7d302978ad99a93e63a24fc1faac1731be7c39
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/shared/gatt-client.c

index de348c22b1ea0d7723f4d0cf80f5a50a129d4dad..0416d05d5bc67bb1b9c2d0ec6c072c1e24eb06b5 100644 (file)
@@ -3141,6 +3141,11 @@ static void destroy_read_long_op(void *data)
 {
        struct read_long_op *op = data;
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       util_debug(op->client->debug_callback, op->client->debug_data,
+                       "destroy read_long_op(%p)", op);
+#endif
+
        if (op->destroy)
                op->destroy(op->user_data);
 
@@ -3185,6 +3190,11 @@ static void read_long_cb(uint8_t opcode, const void *pdu,
                goto done;
        }
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       if (!op)
+               return;
+#endif
+
        if ((!op->offset && opcode != BT_ATT_OP_READ_RSP)
                        || (op->offset && opcode != BT_ATT_OP_READ_BLOB_RSP)
                        || (!pdu && length)) {
@@ -3210,6 +3220,11 @@ static void read_long_cb(uint8_t opcode, const void *pdu,
                put_le16(op->value_handle, pdu);
                put_le16(op->offset, pdu + 2);
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+               util_debug(op->client->debug_callback, op->client->debug_data,
+                               "resend with op(%p)", op);
+#endif
+
                err = bt_att_resend(op->client->att, req->att_id,
                                                        BT_ATT_OP_READ_BLOB_REQ,
                                                        pdu, sizeof(pdu),
@@ -3290,6 +3305,11 @@ unsigned int bt_gatt_client_read_long_value(struct bt_gatt_client *client,
                att_op = BT_ATT_OP_READ_REQ;
        }
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       util_debug(client->debug_callback, client->debug_data,
+                       "Read long value with op(%p) and att_op(0x%x)", op, att_op);
+#endif
+
        req->att_id = bt_att_send(client->att, att_op, pdu, pdu_len,
                                        read_long_cb, req, request_unref);