shared/gatt-client: Add op validation check logic and debug log 89/316789/1
authorWootak Jung <wootak.jung@samsung.com>
Fri, 15 Nov 2024 05:13:23 +0000 (14:13 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Tue, 17 Dec 2024 02:09:42 +0000 (11:09 +0900)
Change-Id: Ibb7d302978ad99a93e63a24fc1faac1731be7c39
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
src/shared/gatt-client.c

index 309f4dc5667b7c12ed585365f5198a74dd4fedda..49e94335bbb284f2460657399129436cc2785fb5 100644 (file)
@@ -3225,6 +3225,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);
 
@@ -3269,6 +3274,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)) {
@@ -3294,6 +3304,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),
@@ -3374,6 +3389,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);