DBUS_TYPE_INVALID))
return btd_error_invalid_args(msg);
- if (adapter->adv_restart_timeout > 0)
- return btd_error_in_progress(msg);
+ if (adapter->adv_restart_timeout) {
+ if (enable) {
+ return btd_error_in_progress(msg);
+ } else {
+ DBG("Advertising stop received. No need to restart advertising");
+ g_source_remove(adapter->adv_restart_timeout);
+ adapter->adv_restart_timeout = 0;
+ }
+ }
DBG("%s advertising slot_id %d", enable ? "Enable" : "Disable", slot_id);
const struct mgmt_ev_vendor_specific_multi_adv_state_changed *ev = param;
struct btd_adapter *adapter = user_data;
struct multi_adv_data *data;
+ struct adv_info *adv;
if (length < sizeof(*ev)) {
error("Too small adv state change event");
DBG("adv id %d, state change reason %d, connection_handle %x",
ev->adv_instance, ev->state_change_reason, ev->connection_handle);
+ adv = find_advertiser(adapter, ev->adv_instance);
+ DBG("current advertising status %d", adv->status);
+
if ((ev->adv_instance > 0 && ev->adv_instance < adapter_le_get_max_adv_instance()) &&
- ev->state_change_reason == 0) {
+ ev->state_change_reason == 0 && adv->status) {
/* advertising is stopped by controller, it should be enabled again.
* If fails, state should be changed to FALSE */
data = g_new0(struct multi_adv_data, 1);