Get the default client if the address is NULL 54/265854/1 accepted/tizen/unified/20211102.024818 submit/tizen/20211101.044616
authordh79pyun <dh79.pyun@samsung.com>
Sun, 31 Oct 2021 23:14:47 +0000 (08:14 +0900)
committerdh79pyun <dh79.pyun@samsung.com>
Sun, 31 Oct 2021 23:14:47 +0000 (08:14 +0900)
Change-Id: I327169a22292034f33a5122de7f84837d9b85066
Signed-off-by: dh79pyun <dh79.pyun@samsung.com>
include/bluetooth_private.h
src/bluetooth-common.c
src/bluetooth-gatt.c

index 0850506..b925e02 100644 (file)
@@ -868,6 +868,8 @@ bool _bt_gatt_is_legacy_client_mode(void);
 
 bt_gatt_client_h _bt_gatt_get_client(const char *remote_addr);
 
+bt_gatt_client_h _bt_gatt_get_default_client(void);
+
 const GSList* _bt_gatt_get_server_list(void);
 
 #ifdef TIZEN_GATT_CLIENT
index 136c2eb..c979630 100644 (file)
@@ -3058,8 +3058,12 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                device_addr = NULL;
 
                if (client == NULL) {
-                       BT_ERR("There is NO matched client");
-                       break;
+                       client = _bt_gatt_get_default_client();
+
+                       if (client == NULL) {
+                               BT_ERR("There is NO matched client");
+                               break;
+                       }
                }
 
                if (service_change->change_type == BLUETOOTH_GATT_SERVICE_CHANGE_TYPE_ADD) {
index b75b5d4..33b0b47 100644 (file)
@@ -208,6 +208,22 @@ bt_gatt_client_h _bt_gatt_get_client(const char *remote_addr)
        return NULL;
 }
 
+bt_gatt_client_h _bt_gatt_get_default_client(void)
+{
+       GSList *l;
+
+       for (l = gatt_client_list; l; l = g_slist_next(l)) {
+               bt_gatt_client_s *client_s = l->data;
+
+               if (client_s == NULL)
+                       continue;
+
+               return (bt_gatt_client_h)client_s;
+       }
+
+       return NULL;
+}
+
 const GSList* _bt_gatt_get_server_list(void)
 {
        return gatt_server_list;