From: dh79pyun Date: Sun, 31 Oct 2021 23:14:47 +0000 (+0900) Subject: Get the default client if the address is NULL X-Git-Tag: submit/tizen/20211101.044616^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3bea15268a6dc1d1cb0dc3a2a7999508a5829419;p=platform%2Fcore%2Fapi%2Fbluetooth.git Get the default client if the address is NULL Change-Id: I327169a22292034f33a5122de7f84837d9b85066 Signed-off-by: dh79pyun --- diff --git a/include/bluetooth_private.h b/include/bluetooth_private.h index 0850506..b925e02 100644 --- a/include/bluetooth_private.h +++ b/include/bluetooth_private.h @@ -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 diff --git a/src/bluetooth-common.c b/src/bluetooth-common.c index 136c2eb..c979630 100644 --- a/src/bluetooth-common.c +++ b/src/bluetooth-common.c @@ -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) { diff --git a/src/bluetooth-gatt.c b/src/bluetooth-gatt.c index b75b5d4..33b0b47 100644 --- a/src/bluetooth-gatt.c +++ b/src/bluetooth-gatt.c @@ -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;