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

Commit f35d43b7 authored by Henri Chataing's avatar Henri Chataing Committed by Automerger Merge Worker
Browse files

Merge "RootCanal: Rename LeCreateConnection and LeExtendedCreateConnection...

Merge "RootCanal: Rename LeCreateConnection and LeExtendedCreateConnection fields" into main am: 0a15df7c

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/2268186



Change-Id: I61492982aec69a0cdd7054ca7d86594b21297eae
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 1093dc8c 0a15df7c
Loading
Loading
Loading
Loading
+23 −10
Original line number Diff line number Diff line
@@ -2061,10 +2061,10 @@ void DualModeController::LeCreateConnection(CommandView command) {
          command_view.GetPeerAddress(),
          command_view.GetPeerAddressType(),
      },
      command_view.GetOwnAddressType(), command_view.GetConnIntervalMin(),
      command_view.GetConnIntervalMax(), command_view.GetConnLatency(),
      command_view.GetSupervisionTimeout(), command_view.GetMinimumCeLength(),
      command_view.GetMaximumCeLength());
      command_view.GetOwnAddressType(), command_view.GetConnectionIntervalMin(),
      command_view.GetConnectionIntervalMax(), command_view.GetMaxLatency(),
      command_view.GetSupervisionTimeout(), command_view.GetMinCeLength(),
      command_view.GetMaxCeLength());
  send_event_(bluetooth::hci::LeCreateConnectionStatusBuilder::Create(
      status, kNumCommandPackets));
}
@@ -2089,8 +2089,9 @@ void DualModeController::LeConnectionUpdate(CommandView command) {
  DEBUG(id_, "   connection_handle=0x{:x}", command_view.GetConnectionHandle());

  ErrorCode status = link_layer_controller_.LeConnectionUpdate(
      command_view.GetConnectionHandle(), command_view.GetConnIntervalMin(),
      command_view.GetConnIntervalMax(), command_view.GetConnLatency(),
      command_view.GetConnectionHandle(),
      command_view.GetConnectionIntervalMin(),
      command_view.GetConnectionIntervalMax(), command_view.GetMaxLatency(),
      command_view.GetSupervisionTimeout());

  send_event_(bluetooth::hci::LeConnectionUpdateStatusBuilder::Create(
@@ -2608,7 +2609,7 @@ void DualModeController::LeSetExtendedScanParameters(CommandView command) {

  ErrorCode status = link_layer_controller_.LeSetExtendedScanParameters(
      command_view.GetOwnAddressType(), command_view.GetScanningFilterPolicy(),
      command_view.GetScanningPhys(), command_view.GetParameters());
      command_view.GetScanningPhys(), command_view.GetScanningPhyParameters());
  send_event_(
      bluetooth::hci::LeSetExtendedScanParametersCompleteBuilder::Create(
          kNumCommandPackets, status));
@@ -2639,18 +2640,30 @@ void DualModeController::LeExtendedCreateConnection(CommandView command) {
  DEBUG(id_, "<< LE Extended Create Connection");
  DEBUG(id_, "   peer_address={}", command_view.GetPeerAddress());
  DEBUG(id_, "   peer_address_type={}",
        bluetooth::hci::AddressTypeText(command_view.GetPeerAddressType()));
        bluetooth::hci::PeerAddressTypeText(command_view.GetPeerAddressType()));
  DEBUG(id_, "   initiator_filter_policy={}",
        bluetooth::hci::InitiatorFilterPolicyText(
            command_view.GetInitiatorFilterPolicy()));

  AddressType peer_address_type;
  switch (command_view.GetPeerAddressType()) {
    case PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS:
    default:
      peer_address_type = AddressType::PUBLIC_DEVICE_ADDRESS;
      break;
    case PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS:
      peer_address_type = AddressType::RANDOM_DEVICE_ADDRESS;
      break;
  }

  ErrorCode status = link_layer_controller_.LeExtendedCreateConnection(
      command_view.GetInitiatorFilterPolicy(), command_view.GetOwnAddressType(),
      AddressWithType{
          command_view.GetPeerAddress(),
          command_view.GetPeerAddressType(),
          peer_address_type,
      },
      command_view.GetInitiatingPhys(), command_view.GetPhyScanParameters());
      command_view.GetInitiatingPhys(),
      command_view.GetInitiatingPhyParameters());
  send_event_(bluetooth::hci::LeExtendedCreateConnectionStatusBuilder::Create(
      status, kNumCommandPackets));
}
+26 −22
Original line number Diff line number Diff line
@@ -1281,7 +1281,8 @@ ErrorCode LinkLayerController::LeSetExtendedScanParameters(
    bluetooth::hci::OwnAddressType own_address_type,
    bluetooth::hci::LeScanningFilterPolicy scanning_filter_policy,
    uint8_t scanning_phys,
    std::vector<bluetooth::hci::PhyScanParameters> scanning_phy_parameters) {
    std::vector<bluetooth::hci::ScanningPhyParameters>
        scanning_phy_parameters) {
  uint8_t supported_phys = properties_.LeSupportedPhys();

  // Extended advertising commands are disallowed when legacy advertising
@@ -1676,7 +1677,7 @@ ErrorCode LinkLayerController::LeExtendedCreateConnection(
    bluetooth::hci::InitiatorFilterPolicy initiator_filter_policy,
    bluetooth::hci::OwnAddressType own_address_type,
    AddressWithType peer_address, uint8_t initiating_phys,
    std::vector<bluetooth::hci::LeCreateConnPhyScanParameters>
    std::vector<bluetooth::hci::InitiatingPhyParameters>
        initiating_phy_parameters) {
  // Extended advertising commands are disallowed when legacy advertising
  // commands were used since the last reset.
@@ -1751,36 +1752,39 @@ ErrorCode LinkLayerController::LeExtendedCreateConnection(
    // Note: no explicit error code stated for invalid connection interval
    // values but assuming Unsupported Feature or Parameter Value (0x11)
    // error code based on similar advertising command.
    if (parameter.conn_interval_min_ < 0x6 ||
        parameter.conn_interval_min_ > 0x0c80 ||
        parameter.conn_interval_max_ < 0x6 ||
        parameter.conn_interval_max_ > 0x0c80) {
    if (parameter.connection_interval_min_ < 0x6 ||
        parameter.connection_interval_min_ > 0x0c80 ||
        parameter.connection_interval_max_ < 0x6 ||
        parameter.connection_interval_max_ > 0x0c80) {
      INFO(id_,
           "connection_interval_min (0x{:04x}) and/or "
           "connection_interval_max (0x{:04x}) are outside the range"
           " of supported values (0x6 - 0x0c80)",
           parameter.conn_interval_min_, parameter.conn_interval_max_);
           parameter.connection_interval_min_,
           parameter.connection_interval_max_);
      return ErrorCode::UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
    }

    // The Connection_Interval_Min parameter shall not be greater than the
    // Connection_Interval_Max parameter.
    if (parameter.conn_interval_max_ < parameter.conn_interval_min_) {
    if (parameter.connection_interval_max_ <
        parameter.connection_interval_min_) {
      INFO(id_,
           "connection_interval_min (0x{:04x}) is larger than"
           " connection_interval_max (0x{:04x})",
           parameter.conn_interval_min_, parameter.conn_interval_max_);
           parameter.connection_interval_min_,
           parameter.connection_interval_max_);
      return ErrorCode::INVALID_HCI_COMMAND_PARAMETERS;
    }

    // Note: no explicit error code stated for invalid max_latency
    // values but assuming Unsupported Feature or Parameter Value (0x11)
    // error code based on similar advertising command.
    if (parameter.conn_latency_ > 0x01f3) {
    if (parameter.max_latency_ > 0x01f3) {
      INFO(id_,
           "max_latency (0x{:04x}) is outside the range"
           " of supported values (0x0 - 0x01f3)",
           parameter.conn_latency_);
           parameter.max_latency_);
      return ErrorCode::UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
    }

@@ -1800,8 +1804,8 @@ ErrorCode LinkLayerController::LeExtendedCreateConnection(
    // (1 + Max_Latency) * Connection_Interval_Max * 2, where
    // Connection_Interval_Max is given in milliseconds.
    milliseconds min_supervision_timeout = duration_cast<milliseconds>(
        (1 + parameter.conn_latency_) *
        slots(2 * parameter.conn_interval_max_) * 2);
        (1 + parameter.max_latency_) *
        slots(2 * parameter.connection_interval_max_) * 2);
    if (parameter.supervision_timeout_ * 10ms < min_supervision_timeout) {
      INFO(
          id_,
@@ -1862,10 +1866,10 @@ ErrorCode LinkLayerController::LeExtendedCreateConnection(
        .scan_interval = initiating_phy_parameters[offset].scan_interval_,
        .scan_window = initiating_phy_parameters[offset].scan_window_,
        .connection_interval_min =
            initiating_phy_parameters[offset].conn_interval_min_,
            initiating_phy_parameters[offset].connection_interval_min_,
        .connection_interval_max =
            initiating_phy_parameters[offset].conn_interval_max_,
        .max_latency = initiating_phy_parameters[offset].conn_latency_,
            initiating_phy_parameters[offset].connection_interval_max_,
        .max_latency = initiating_phy_parameters[offset].max_latency_,
        .supervision_timeout =
            initiating_phy_parameters[offset].supervision_timeout_,
        .min_ce_length = initiating_phy_parameters[offset].min_ce_length_,
@@ -1880,10 +1884,10 @@ ErrorCode LinkLayerController::LeExtendedCreateConnection(
        .scan_interval = initiating_phy_parameters[offset].scan_interval_,
        .scan_window = initiating_phy_parameters[offset].scan_window_,
        .connection_interval_min =
            initiating_phy_parameters[offset].conn_interval_min_,
            initiating_phy_parameters[offset].connection_interval_min_,
        .connection_interval_max =
            initiating_phy_parameters[offset].conn_interval_max_,
        .max_latency = initiating_phy_parameters[offset].conn_latency_,
            initiating_phy_parameters[offset].connection_interval_max_,
        .max_latency = initiating_phy_parameters[offset].max_latency_,
        .supervision_timeout =
            initiating_phy_parameters[offset].supervision_timeout_,
        .min_ce_length = initiating_phy_parameters[offset].min_ce_length_,
@@ -1898,10 +1902,10 @@ ErrorCode LinkLayerController::LeExtendedCreateConnection(
        .scan_interval = initiating_phy_parameters[offset].scan_interval_,
        .scan_window = initiating_phy_parameters[offset].scan_window_,
        .connection_interval_min =
            initiating_phy_parameters[offset].conn_interval_min_,
            initiating_phy_parameters[offset].connection_interval_min_,
        .connection_interval_max =
            initiating_phy_parameters[offset].conn_interval_max_,
        .max_latency = initiating_phy_parameters[offset].conn_latency_,
            initiating_phy_parameters[offset].connection_interval_max_,
        .max_latency = initiating_phy_parameters[offset].max_latency_,
        .supervision_timeout =
            initiating_phy_parameters[offset].supervision_timeout_,
        .min_ce_length = initiating_phy_parameters[offset].min_ce_length_,
+3 −2
Original line number Diff line number Diff line
@@ -480,7 +480,8 @@ class LinkLayerController {
      bluetooth::hci::OwnAddressType own_address_type,
      bluetooth::hci::LeScanningFilterPolicy scanning_filter_policy,
      uint8_t scanning_phys,
      std::vector<bluetooth::hci::PhyScanParameters> scanning_phy_parameters);
      std::vector<bluetooth::hci::ScanningPhyParameters>
          scanning_phy_parameters);

  // HCI command LE_Set_Extended_Scan_Enable (Vol 4, Part E § 7.8.65).
  ErrorCode LeSetExtendedScanEnable(
@@ -509,7 +510,7 @@ class LinkLayerController {
      bluetooth::hci::InitiatorFilterPolicy initiator_filter_policy,
      bluetooth::hci::OwnAddressType own_address_type,
      AddressWithType peer_address, uint8_t initiating_phys,
      std::vector<bluetooth::hci::LeCreateConnPhyScanParameters>
      std::vector<bluetooth::hci::InitiatingPhyParameters>
          initiating_phy_parameters);

  // Periodic Advertising
+24 −24
Original line number Diff line number Diff line
@@ -3279,12 +3279,12 @@ packet LeCreateConnection : Command (op_code = LE_CREATE_CONNECTION) {
  peer_address_type : AddressType,
  peer_address : Address,
  own_address_type : OwnAddressType,
  conn_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  conn_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  conn_latency : 16, // 0x0006-0x01F3
  connection_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  connection_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  max_latency : 16, // 0x0006-0x01F3
  supervision_timeout : 16, // 0x00A to 0x0C80 (100ms to 32s)
  minimum_ce_length : 16, // 0.625ms
  maximum_ce_length : 16, // 0.625ms
  min_ce_length : 16, // 0.625ms
  max_ce_length : 16, // 0.625ms
}

packet LeCreateConnectionStatus : CommandStatus (command_op_code = LE_CREATE_CONNECTION) {
@@ -3347,12 +3347,12 @@ packet LeRemoveDeviceFromFilterAcceptListComplete : CommandComplete (command_op_
packet LeConnectionUpdate : Command (op_code = LE_CONNECTION_UPDATE) {
  connection_handle : 12,
  _reserved_ : 4,
  conn_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  conn_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  conn_latency : 16, // 0x0006-0x01F3
  connection_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  connection_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  max_latency : 16, // 0x0006-0x01F3
  supervision_timeout : 16, // 0x00A to 0x0C80 (100ms to 32s)
  minimum_ce_length : 16, // 0.625ms
  maximum_ce_length : 16, // 0.625ms
  min_ce_length : 16, // 0.625ms
  max_ce_length : 16, // 0.625ms
}

packet LeConnectionUpdateStatus : CommandStatus (command_op_code = LE_CONNECTION_UPDATE) {
@@ -3988,7 +3988,7 @@ packet LeSetPeriodicAdvertisingEnableComplete : CommandComplete (command_op_code
  status : ErrorCode,
}

struct PhyScanParameters {
struct ScanningPhyParameters {
  le_scan_type : LeScanType,
  le_scan_interval : 16, // 0x0004-0xFFFF Default 0x10 (10ms)
  le_scan_window : 16, // 0x004-0xFFFF Default 0x10 (10ms)
@@ -3998,7 +3998,7 @@ packet LeSetExtendedScanParameters : Command (op_code = LE_SET_EXTENDED_SCAN_PAR
  own_address_type : OwnAddressType,
  scanning_filter_policy : LeScanningFilterPolicy,
  scanning_phys : 8,
  parameters : PhyScanParameters[],
  scanning_phy_parameters : ScanningPhyParameters[],
}

test LeSetExtendedScanParameters {
@@ -4040,12 +4040,12 @@ test LeSetExtendedScanEnableComplete {
  "\x0e\x04\x01\x42\x20\x00",
}

struct LeCreateConnPhyScanParameters {
struct InitiatingPhyParameters {
  scan_interval : 16, // 0x0004-0xFFFF
  scan_window : 16, // < = LeScanInterval
  conn_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  conn_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  conn_latency : 16, // 0x0006-0x01F3
  connection_interval_min : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  connection_interval_max : 16, // 0x0006-0x0C80 (7.5ms to 4s)
  max_latency : 16, // 0x0006-0x01F3
  supervision_timeout : 16, // 0x00A to 0x0C80 (100ms to 32s)
  min_ce_length : 16, // 0.625ms
  max_ce_length : 16, // 0.625ms
@@ -4054,10 +4054,10 @@ struct LeCreateConnPhyScanParameters {
packet LeExtendedCreateConnection : Command (op_code = LE_EXTENDED_CREATE_CONNECTION) {
  initiator_filter_policy : InitiatorFilterPolicy,
  own_address_type : OwnAddressType,
  peer_address_type : AddressType,
  peer_address_type : PeerAddressType,
  peer_address : Address,
  initiating_phys : 8,
  phy_scan_parameters : LeCreateConnPhyScanParameters[],
  initiating_phy_parameters : InitiatingPhyParameters[],
}

test LeExtendedCreateConnection {
@@ -5625,8 +5625,8 @@ packet LeConnectionComplete : LeMetaEvent (subevent_code = CONNECTION_COMPLETE)
  role : Role,
  peer_address_type : AddressType,
  peer_address : Address,
  conn_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms)
  conn_latency : 16,  // Number of connection events
  connection_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms)
  peripheral_latency : 16,
  supervision_timeout : 16,  // 0x000A to 0x0C80 (100ms to 32s)
  central_clock_accuracy : ClockAccuracy,
}
@@ -5657,8 +5657,8 @@ packet LeConnectionUpdateComplete : LeMetaEvent (subevent_code = CONNECTION_UPDA
  status : ErrorCode,
  connection_handle : 12,
  _reserved_ : 4,
  conn_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms)
  conn_latency : 16,  // Number of connection events
  connection_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms)
  peripheral_latency : 16,  // Number of connection events
  supervision_timeout : 16,  // 0x000A to 0x0C80 (100ms to 32s)
}

@@ -5713,8 +5713,8 @@ packet LeEnhancedConnectionComplete : LeMetaEvent (subevent_code = ENHANCED_CONN
  peer_address : Address,
  local_resolvable_private_address : Address,
  peer_resolvable_private_address : Address,
  conn_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms)
  conn_latency : 16,  // Number of connection events
  connection_interval : 16, // 0x006 - 0x0C80 (7.5ms - 4000ms)
  peripheral_latency : 16,
  supervision_timeout : 16,  // 0x000A to 0x0C80 (100ms to 32s)
  central_clock_accuracy : ClockAccuracy,
}
+9 −9
Original line number Diff line number Diff line
@@ -373,13 +373,13 @@ class ControllerTest(unittest.IsolatedAsyncioTestCase):
                                           peer_address_type=hci.AddressType.PUBLIC_DEVICE_ADDRESS,
                                           peer_address=peer_address,
                                           initiating_phys=0x1,
                                           phy_scan_parameters=[
                                               hci.LeCreateConnPhyScanParameters(
                                           initiating_phy_parameters=[
                                               hci.InitiatingPhyParameters(
                                                   scan_interval=0x200,
                                                   scan_window=0x100,
                                                   conn_interval_min=0x200,
                                                   conn_interval_max=0x200,
                                                   conn_latency=0x6,
                                                   connection_interval_min=0x200,
                                                   connection_interval_max=0x200,
                                                   max_latency=0x6,
                                                   supervision_timeout=0xc80,
                                                   min_ce_length=0,
                                                   max_ce_length=0,
@@ -418,8 +418,8 @@ class ControllerTest(unittest.IsolatedAsyncioTestCase):
                                             role=hci.Role.CENTRAL,
                                             peer_address_type=hci.AddressType.PUBLIC_DEVICE_ADDRESS,
                                             peer_address=peer_address,
                                             conn_interval=0x200,
                                             conn_latency=0x6,
                                             connection_interval=0x200,
                                             peripheral_latency=0x6,
                                             supervision_timeout=0xc80,
                                             central_clock_accuracy=hci.ClockAccuracy.PPM_500))

@@ -470,8 +470,8 @@ class ControllerTest(unittest.IsolatedAsyncioTestCase):
                                             role=hci.Role.PERIPHERAL,
                                             peer_address_type=hci.AddressType.PUBLIC_DEVICE_ADDRESS,
                                             peer_address=peer_address,
                                             conn_interval=0x200,
                                             conn_latency=0x200,
                                             connection_interval=0x200,
                                             peripheral_latency=0x200,
                                             supervision_timeout=0x200,
                                             central_clock_accuracy=hci.ClockAccuracy.PPM_500))

Loading