Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29405007 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Automerger Merge Worker
Browse files

Use unique SID when advertising am: 516e6cf3 am: 92950a82

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1352844

Change-Id: Idb3ba878fbca4502bdb007cd1c7e956f751528a7
parents 3bd5790a 92950a82
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -248,6 +248,11 @@ struct LeAdvertisingManager::impl : public bluetooth::hci::LeAddressManagerCallb
      case (AdvertisingApiType::LE_5_0): {
        ExtendedAdvertisingConfig new_config = config;
        new_config.legacy_pdus = true;

        // sid must be in range 0x00 to 0x0F. Since no controller supports more than
        // 16 advertisers, it's safe to make sid equal to id.
        new_config.sid = id % 0x0F;

        create_extended_advertiser(id, new_config, scan_callback, set_terminated_callback, handler);
      } break;
    }
+1 −0
Original line number Diff line number Diff line
@@ -451,6 +451,7 @@ TEST_F(LeExtendedAdvertisingManagerTest, create_advertiser_test) {
  advertising_config.advertisement = gap_data;
  advertising_config.scan_response = gap_data;
  advertising_config.channel_map = 1;
  advertising_config.sid = 0x01;

  auto last_command_future = test_hci_layer_->GetCommandFuture(OpCode::LE_SET_EXTENDED_ADVERTISING_ENABLE);
  auto id = le_advertising_manager_->ExtendedCreateAdvertiser(advertising_config, scan_callback,
+5 −1
Original line number Diff line number Diff line
@@ -693,13 +693,17 @@ class BleAdvertisingManagerImpl
    p_inst->advertising_interval = p_params->adv_int_min;
    const RawAddress& peer_address = RawAddress::kEmpty;

    // sid must be in range 0x00 to 0x0F. Since no controller supports more than
    // 16 advertisers, it's safe to make sid equal to inst_id.
    uint8_t sid = p_inst->inst_id % 0x0F;

    GetHciInterface()->SetParameters(
        p_inst->inst_id, p_params->advertising_event_properties,
        p_params->adv_int_min, p_params->adv_int_max, p_params->channel_map,
        p_inst->own_address_type, p_inst->own_address, 0x00, peer_address,
        p_params->adv_filter_policy, p_inst->tx_power,
        p_params->primary_advertising_phy, 0x00,
        p_params->secondary_advertising_phy, 0x01 /* TODO: proper SID */,
        p_params->secondary_advertising_phy, sid,
        p_params->scan_request_notification_enable, cb);

    // TODO: re-enable only if it was enabled, properly call