diff options
author | Deokhyun Kim <dukan.kim@samsung.com> | 2020-08-25 15:44:37 +0900 |
---|---|---|
committer | Wootak Jung <wootak.jung@samsung.com> | 2020-09-02 09:03:19 +0900 |
commit | 86636c65896526206351e5a36e514ae9fca527d1 (patch) | |
tree | c6e52179c24a4c8d75a7cc061d3e1a532f828edd /src | |
parent | 37177d2f7337f89b87a6a2c8431c5ff63a0b19bf (diff) | |
download | bluez-86636c65896526206351e5a36e514ae9fca527d1.tar.gz bluez-86636c65896526206351e5a36e514ae9fca527d1.tar.bz2 bluez-86636c65896526206351e5a36e514ae9fca527d1.zip |
set_advertising returns in_progress error even if the restart is scheduled by le connection.submit/tizen/20200902.223427accepted/tizen/unified/20200904.035416
le_discovering should be set before remove_watch is called
[Model] 5.5
[BinType] AP
[Customer] OPEN
[Issue#] P200824-01952
[Request] PLM
[Occurrence Version] R825USQE1BTH8
[Problem] set_advertising fails
[Cause & Measure] advertising is already stopped by le connection.
And the restart is scheduled with 300ms delay.
set_advertising returns in_progress error even if the restart is scheduled
by le connection.
[Checking Method] Try to stop advertising right after le is connected.
[Team] Bluetooth
[Developer] Deokhyun Kim
[Solution company] Samsung
[Change Type] Specification change
Change-Id: I7fef2e0b5fba1219dfe8f02b223d870450ccb651
Signed-off-by: Deokhyun Kim <dukan.kim@samsung.com>
Signed-off-by: Wootak Jung <wootak.jung@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/adapter.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/adapter.c b/src/adapter.c index 6dcf2886..a57dccda 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -321,6 +321,7 @@ struct btd_adapter { bool advertising; /* Advertising active */ gchar *version; /* Bluetooth Version */ uint8_t adv_tx_power; + guint adv_restart_timeout; bool le_discovering; /* LE Discovery active */ GSList *le_discovery_list; /* list of LE discovery clients */ #endif @@ -2440,8 +2441,8 @@ static void discovering_callback(uint16_t index, uint16_t length, if (adapter->le_discovering == true) { struct watch_client *client; client = adapter->le_discovery_list->data; - g_dbus_remove_watch(dbus_conn, client->watch); adapter->le_discovering = false; + g_dbus_remove_watch(dbus_conn, client->watch); } } else { hci_set_bit(BDADDR_LE_PUBLIC, &adapter->discovery_type); @@ -4406,8 +4407,8 @@ static DBusMessage *adapter_stop_le_discovery(DBusConnection *conn, DBG("cp.type %d", cp.type); DBG("adapter->discovery_enable %d", adapter->discovery_enable); if (adapter->discovery_enable == 0x00) { - g_dbus_remove_watch(dbus_conn, client->watch); adapter->le_discovering = false; + g_dbus_remove_watch(dbus_conn, client->watch); g_dbus_emit_property_changed(dbus_conn, adapter->path, ADAPTER_INTERFACE, "LEDiscovering"); @@ -4442,6 +4443,9 @@ static DBusMessage *adapter_set_advertising(DBusConnection *conn, DBUS_TYPE_INVALID)) return btd_error_invalid_args(msg); + if (adapter->adv_restart_timeout > 0) + return btd_error_in_progress(msg); + DBG("%s advertising slot_id %d", enable ? "Enable" : "Disable", slot_id); if (adapter_le_is_supported_multi_advertising() && slot_id > 0) @@ -12416,6 +12420,8 @@ static gboolean multi_adv_start_timeout_cb(gpointer user_data) struct btd_adapter *adapter = data->adapter; dbus_bool_t err; + adapter->adv_restart_timeout = 0; + err = adapter_le_enable_multi_adv(adapter, TRUE, data->slot_id); if (!err) advertising_state_changed(adapter, data->slot_id, FALSE); @@ -12447,7 +12453,8 @@ static void multi_adv_state_change_callback(uint16_t index, uint16_t length, data->adapter = adapter; data->slot_id = ev->adv_instance; - g_timeout_add(300, multi_adv_start_timeout_cb, data); + adapter->adv_restart_timeout = + g_timeout_add(300, multi_adv_start_timeout_cb, data); } } |