if (adv_state == BT_ADAPTER_LE_ADVERTISING_STOPPED) {
LoggerD("Advertiser destroy");
int ret = bt_adapter_le_destroy_advertiser(advertiser);
+ /*
+ * Destruction of advertiser should not fail.
+ * If it does, we only log the info and set the pointer to nullptr
+ * anyway to let the user start new advertising in the future.
+ */
+ adapter->bt_advertiser_ = nullptr;
if (BT_ERROR_NONE != ret && BT_ERROR_NOT_IN_PROGRESS != ret) {
LogAndReportError(PlatformResult(ErrorCode::UNKNOWN_ERR, "Failed to destroy advertiser"),
data_obj, ("bt_adapter_le_destroy_advertiser() failed with: %d (%s)", ret,
get_error_message(ret)));
return;
}
+ LoggerD("bt_adapter_le_destroy_advertiser(): SUCCESS");
}
}