shared/gatt-client: Do not read device name gatt char in DA 39/316739/3 accepted/tizen/7.0/unified/20241219.160525
authorSohyeon Choi <shss.choi@samsung.com>
Fri, 13 Dec 2024 06:19:53 +0000 (15:19 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Wed, 18 Dec 2024 02:27:42 +0000 (11:27 +0900)
if remote adv is non-discoverable and not bonded,
request for reading GATT characterisitic device name (2A00) makes confirm popup for security.
to prevent unnecessary popup, Do not read device name in DA products.

Change-Id: Id3067e8e1ec83ec0c5c985022b9164822fd6780c
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Makefile.tools
profiles/gap/gas.c
src/shared/gatt-client.c

index 2cceb693921e8e46173089e7464b02aeaffd4e0b..495ac23dd738fc2639ddb6d2e5255a7fd8787a32 100755 (executable)
@@ -103,7 +103,7 @@ peripheral_btsensor_SOURCES = peripheral/main.c \
                                peripheral/log.h peripheral/log.c \
                                peripheral/gap.h peripheral/gap.c \
                                peripheral/gatt.h peripheral/gatt.c
-peripheral_btsensor_LDADD = src/libshared-mainloop.la \
+peripheral_btsensor_LDADD = src/libshared-mainloop.la @LIBXML_LIBS@ \
                                lib/libbluetooth-internal.la
 
 tools_3dsp_SOURCES = tools/3dsp.c monitor/bt.h
@@ -348,7 +348,7 @@ noinst_PROGRAMS += tools/bdaddr tools/avinfo \
                        tools/test-runner tools/check-selftest
 
 tools_bdaddr_SOURCES = tools/bdaddr.c src/oui.h src/oui.c
-tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@
+tools_bdaddr_LDADD = lib/libbluetooth-internal.la @UDEV_LIBS@ @LIBXML_LIBS@
 
 tools_avinfo_LDADD = lib/libbluetooth-internal.la
 
@@ -410,7 +410,7 @@ tools_ibeacon_SOURCES = tools/ibeacon.c monitor/bt.h
 tools_ibeacon_LDADD = src/libshared-mainloop.la
 
 tools_btgatt_client_SOURCES = tools/btgatt-client.c src/uuid-helper.c
-tools_btgatt_client_LDADD = src/libshared-mainloop.la \
+tools_btgatt_client_LDADD = src/libshared-mainloop.la @LIBXML_LIBS@ \
                                                lib/libbluetooth-internal.la
 
 tools_btgatt_server_SOURCES = tools/btgatt-server.c src/uuid-helper.c
index 2125b723999c5883b1e2e39a30b7357cbb19a004..5d80ecff32e95be4c2ca09c8c36f444131ae3718 100755 (executable)
 #include "src/service.h"
 #include "src/log.h"
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#include "../../profile.h"
+#endif
+
 #define GAP_UUID16 0x1800
 
 /* Generic Attribute/Access Service */
@@ -109,6 +113,13 @@ static void read_device_name_cb(bool success, uint8_t att_ecode,
 
 static void handle_device_name(struct gas *gas, uint16_t value_handle)
 {
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       if (TIZEN_FEATURE_BLUEZ_DA) {
+               DBG("Do not try to read device name in DA");
+               return;
+       }
+#endif
+
        if (!bt_gatt_client_read_long_value(gas->client, value_handle, 0,
                                                read_device_name_cb, gas, NULL))
                DBG("Failed to send request to read device name");
index 0416d05d5bc67bb1b9c2d0ec6c072c1e24eb06b5..16ebc212990e2aae1bb47380daddb47aba4fc940 100644 (file)
@@ -1086,10 +1086,15 @@ static void discover_chrcs_cb(bool success, uint8_t att_ecode,
 
 #ifdef TIZEN_FEATURE_BLUEZ_MODIFY
                if (!strcmp(uuid_str, "00002a00-0000-1000-8000-00805f9b34fb")) {
-                       if (!bt_gatt_client_read_value(client, chrc_data->value_handle,
-                                               read_name_cb, client, NULL)) {
+                       if (TIZEN_FEATURE_BLUEZ_DA) {
                                util_debug(client->debug_callback, client->debug_data,
-                                               "Failed to read value");
+                                               "device name char found but do not read in DA");
+                       } else {
+                               if (!bt_gatt_client_read_value(client, chrc_data->value_handle,
+                                               read_name_cb, client, NULL)) {
+                                       util_debug(client->debug_callback, client->debug_data,
+                                                       "Failed to read value");
+                               }
                        }
                }
 #endif