From e28289038655c97b72d439ea4d0c1e09430f4fd7 Mon Sep 17 00:00:00 2001 From: DoHyun Pyun Date: Thu, 25 Feb 2021 10:48:03 +0900 Subject: [PATCH] Disable NAP connection in IOT headed profile Change-Id: I9b60fc122d81490918500f7560e1c527d8b59fa0 Signed-off-by: DoHyun Pyun --- standard/bt-callback.c | 6 ++++ standard/bt-main-view.c | 71 +++++++++++++++++++++++++--------------------- standard/bt-profile-view.c | 18 ++++++------ 3 files changed, 55 insertions(+), 40 deletions(-) diff --git a/standard/bt-callback.c b/standard/bt-callback.c index 12b983d..b3e421b 100644 --- a/standard/bt-callback.c +++ b/standard/bt-callback.c @@ -812,6 +812,12 @@ void _bt_cb_bonding_created(int result, bt_device_info_s *dev_info, _bt_main_connect_device(ugd, new_dev); } else { BT_DBG("Net profile exists"); + + if (TIZEN_COMMON) { + BT_DBG("Don't use NAP / PAN"); + return; + } + int connected = _bt_util_is_profile_connected( BT_NETWORK_SERVER_CONNECTED, new_dev->bd_addr); diff --git a/standard/bt-main-view.c b/standard/bt-main-view.c index a89d761..47e77e6 100644 --- a/standard/bt-main-view.c +++ b/standard/bt-main-view.c @@ -3726,12 +3726,23 @@ void _bt_main_connect_device(bt_ug_data *ugd, bt_dev_t *dev) BT_ERR("Fail to connect HID device"); } } - } else if (dev->service_list & BT_SC_NAP_SERVICE_MASK) { - void *net_profile; + } else if (TIZEN_FEATURE_BT_HOG && (dev->is_le_device) && (ugd->connect_req == FALSE)) { + if (bt_gatt_connect(dev->addr_str, false) == BT_ERROR_NONE) { + ugd->connect_req = TRUE; + dev->status = BT_CONNECTING; + } else { + BT_ERR("Fail to connect le device"); + } + } + + if (!TIZEN_COMMON) { + if (dev->service_list & BT_SC_NAP_SERVICE_MASK) { + void *net_profile; + if (dev->net_profile) { if (_bt_connect_net_profile(ugd->connection, - dev->net_profile, - dev) == BT_UG_ERROR_NONE) { + dev->net_profile, + dev) == BT_UG_ERROR_NONE) { ugd->connect_req = TRUE; dev->status = BT_CONNECTING; } else { @@ -3753,12 +3764,6 @@ void _bt_main_connect_device(bt_ug_data *ugd, bt_dev_t *dev) } } } - } else if (TIZEN_FEATURE_BT_HOG && (dev->is_le_device) && (ugd->connect_req == FALSE)) { - if (bt_gatt_connect(dev->addr_str, false) == BT_ERROR_NONE) { - ugd->connect_req = TRUE; - dev->status = BT_CONNECTING; - } else { - BT_ERR("Fail to connect le device"); } } @@ -3844,36 +3849,38 @@ void _bt_main_disconnect_device(bt_ug_data *ugd, bt_dev_t *dev) BT_ERR("Failed to disconnect gatt"); } } else { - void *net_profile; - gboolean connected = FALSE; + if (!TIZEN_COMMON) { + void *net_profile; + gboolean connected = FALSE; - connected = _bt_util_is_profile_connected(BT_NETWORK_CONNECTED, - dev->bd_addr); - if (connected) { - if (dev->net_profile) { - if (_bt_disconnect_net_profile(ugd->connection, - dev->net_profile, dev) == - BT_UG_ERROR_NONE) { - ugd->connect_req = true; - dev->status = BT_DISCONNECTING; - } else { - BT_ERR("Fail to disconnect the net profile"); - } - } else { - net_profile = - _bt_get_registered_net_profile( - ugd->connection, + connected = _bt_util_is_profile_connected(BT_NETWORK_CONNECTED, dev->bd_addr); - if (net_profile) { - if (_bt_disconnect_net_profile( - ugd->connection, - net_profile, dev) == + if (connected) { + if (dev->net_profile) { + if (_bt_disconnect_net_profile(ugd->connection, + dev->net_profile, dev) == BT_UG_ERROR_NONE) { ugd->connect_req = true; dev->status = BT_DISCONNECTING; } else { BT_ERR("Fail to disconnect the net profile"); } + } else { + net_profile = + _bt_get_registered_net_profile( + ugd->connection, + dev->bd_addr); + if (net_profile) { + if (_bt_disconnect_net_profile( + ugd->connection, + net_profile, dev) == + BT_UG_ERROR_NONE) { + ugd->connect_req = true; + dev->status = BT_DISCONNECTING; + } else { + BT_ERR("Fail to disconnect the net profile"); + } + } } } } diff --git a/standard/bt-profile-view.c b/standard/bt-profile-view.c index d902e7d..32717a1 100644 --- a/standard/bt-profile-view.c +++ b/standard/bt-profile-view.c @@ -1843,14 +1843,16 @@ static Evas_Object *__bt_profile_draw_genlist(bt_ug_data *ugd, bt_dev_t *dev_inf } #ifndef TIZEN_BT_A2DP_SINK_ENABLE - if (dev_info->service_list & BT_SC_NAP_SERVICE_MASK) { - /* NAP device */ - git = elm_genlist_item_append(genlist, vd->network_itc, - dev_info, NULL, - ELM_GENLIST_ITEM_NONE, - __bt_profile_nap_option_item_sel, - dev_info); - vd->network_item = git; + if (!TIZEN_COMMON) { + if (dev_info->service_list & BT_SC_NAP_SERVICE_MASK) { + /* NAP device */ + git = elm_genlist_item_append(genlist, vd->network_itc, + dev_info, NULL, + ELM_GENLIST_ITEM_NONE, + __bt_profile_nap_option_item_sel, + dev_info); + vd->network_item = git; + } } #endif FN_END; -- 2.7.4