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

Commit b733365b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes I1ed2b456,I0014c4a0,Ieb8596b1,I1d3d9c0f

* changes:
  Simplfy SetInquiryScanType & SetPageScanType
  Remove BTM_DEFAULT_SCAN_TYPE from BT target
  Implement shim for get_acl_buffer_count_ble
  Implement GetLeSuggestedDefaultDataLength
parents 2b505837 8b704a07
Loading
Loading
Loading
Loading
+18 −0
Original line number Original line Diff line number Diff line
@@ -85,6 +85,11 @@ struct Controller::impl {
      le_maximum_data_length_.supported_max_tx_octets_ = 0;
      le_maximum_data_length_.supported_max_tx_octets_ = 0;
      le_maximum_data_length_.supported_max_tx_time_ = 0;
      le_maximum_data_length_.supported_max_tx_time_ = 0;
    }
    }
    if (is_supported(OpCode::LE_READ_SUGGESTED_DEFAULT_DATA_LENGTH)) {
      hci_->EnqueueCommand(
          LeReadSuggestedDefaultDataLengthBuilder::Create(),
          handler->BindOnceOn(this, &Controller::impl::le_read_suggested_default_data_length_handler));
    }
    if (is_supported(OpCode::LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH)) {
    if (is_supported(OpCode::LE_READ_MAXIMUM_ADVERTISING_DATA_LENGTH)) {
      hci_->EnqueueCommand(
      hci_->EnqueueCommand(
          LeReadMaximumAdvertisingDataLengthBuilder::Create(),
          LeReadMaximumAdvertisingDataLengthBuilder::Create(),
@@ -268,6 +273,14 @@ struct Controller::impl {
    le_maximum_data_length_ = complete_view.GetLeMaximumDataLength();
    le_maximum_data_length_ = complete_view.GetLeMaximumDataLength();
  }
  }


  void le_read_suggested_default_data_length_handler(CommandCompleteView view) {
    auto complete_view = LeReadSuggestedDefaultDataLengthCompleteView::Create(view);
    ASSERT(complete_view.IsValid());
    ErrorCode status = complete_view.GetStatus();
    ASSERT_LOG(status == ErrorCode::SUCCESS, "Status 0x%02hhx, %s", status, ErrorCodeText(status).c_str());
    le_suggested_default_data_length_ = complete_view.GetTxOctets();
  }

  void le_read_maximum_advertising_data_length_handler(CommandCompleteView view) {
  void le_read_maximum_advertising_data_length_handler(CommandCompleteView view) {
    auto complete_view = LeReadMaximumAdvertisingDataLengthCompleteView::Create(view);
    auto complete_view = LeReadMaximumAdvertisingDataLengthCompleteView::Create(view);
    ASSERT(complete_view.IsValid());
    ASSERT(complete_view.IsValid());
@@ -739,6 +752,7 @@ struct Controller::impl {
  uint8_t le_resolving_list_size_;
  uint8_t le_resolving_list_size_;
  LeMaximumDataLength le_maximum_data_length_;
  LeMaximumDataLength le_maximum_data_length_;
  uint16_t le_maximum_advertising_data_length_;
  uint16_t le_maximum_advertising_data_length_;
  uint16_t le_suggested_default_data_length_;
  uint8_t le_number_supported_advertising_sets_;
  uint8_t le_number_supported_advertising_sets_;
  VendorCapabilities vendor_capabilities_;
  VendorCapabilities vendor_capabilities_;
};  // namespace hci
};  // namespace hci
@@ -944,6 +958,10 @@ uint16_t Controller::GetLeMaximumAdvertisingDataLength() const {
  return impl_->le_maximum_advertising_data_length_;
  return impl_->le_maximum_advertising_data_length_;
}
}


uint16_t Controller::GetLeSuggestedDefaultDataLength() const {
  return impl_->le_suggested_default_data_length_;
}

uint8_t Controller::GetLeNumberOfSupportedAdverisingSets() const {
uint8_t Controller::GetLeNumberOfSupportedAdverisingSets() const {
  return impl_->le_number_supported_advertising_sets_;
  return impl_->le_number_supported_advertising_sets_;
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -133,6 +133,8 @@ class Controller : public Module {


  virtual uint16_t GetLeMaximumAdvertisingDataLength() const;
  virtual uint16_t GetLeMaximumAdvertisingDataLength() const;


  virtual uint16_t GetLeSuggestedDefaultDataLength() const;

  virtual uint8_t GetLeNumberOfSupportedAdverisingSets() const;
  virtual uint8_t GetLeNumberOfSupportedAdverisingSets() const;


  virtual VendorCapabilities GetVendorCapabilities() const;
  virtual VendorCapabilities GetVendorCapabilities() const;
+0 −5
Original line number Original line Diff line number Diff line
@@ -299,11 +299,6 @@
#define BTM_INQ_DB_SIZE 40
#define BTM_INQ_DB_SIZE 40
#endif
#endif


/* The default scan mode */
#ifndef BTM_DEFAULT_SCAN_TYPE
#define BTM_DEFAULT_SCAN_TYPE BTM_SCAN_TYPE_INTERLACED
#endif

/* Should connections to unknown devices be allowed when not discoverable? */
/* Should connections to unknown devices be allowed when not discoverable? */
#ifndef BTM_ALLOW_CONN_IF_NONDISCOVER
#ifndef BTM_ALLOW_CONN_IF_NONDISCOVER
#define BTM_ALLOW_CONN_IF_NONDISCOVER TRUE
#define BTM_ALLOW_CONN_IF_NONDISCOVER TRUE
+5 −32
Original line number Original line Diff line number Diff line
@@ -406,20 +406,8 @@ tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode,
  return BTM_SUCCESS;
  return BTM_SUCCESS;
}
}


tBTM_STATUS bluetooth::shim::BTM_SetInquiryScanType(uint16_t scan_type) {
void bluetooth::shim::BTM_EnableInterlacedInquiryScan() {
  switch (scan_type) {
    case kInterlacedScanType:
  Stack::GetInstance()->GetBtm()->SetInterlacedInquiryScan();
  Stack::GetInstance()->GetBtm()->SetInterlacedInquiryScan();
      return BTM_SUCCESS;
      break;
    case kStandardScanType:
      Stack::GetInstance()->GetBtm()->SetStandardInquiryScan();
      return BTM_SUCCESS;
      break;
    default:
      return BTM_ILLEGAL_VALUE;
  }
  return BTM_WRONG_MODE;
}
}


tBTM_STATUS bluetooth::shim::BTM_BleObserve(bool start, uint8_t duration_sec,
tBTM_STATUS bluetooth::shim::BTM_BleObserve(bool start, uint8_t duration_sec,
@@ -501,23 +489,8 @@ tBTM_STATUS bluetooth::shim::BTM_BleObserve(bool start, uint8_t duration_sec,
  return BTM_CMD_STARTED;
  return BTM_CMD_STARTED;
}
}


tBTM_STATUS bluetooth::shim::BTM_SetPageScanType(uint16_t scan_type) {
void bluetooth::shim::BTM_EnableInterlacedPageScan() {
  switch (scan_type) {
    case kInterlacedScanType:
      if (!Stack::GetInstance()->GetBtm()->IsInterlacedScanSupported()) {
        return BTM_MODE_UNSUPPORTED;
      }
  Stack::GetInstance()->GetBtm()->SetInterlacedPageScan();
  Stack::GetInstance()->GetBtm()->SetInterlacedPageScan();
      return BTM_SUCCESS;
      break;
    case kStandardScanType:
      Stack::GetInstance()->GetBtm()->SetStandardPageScan();
      return BTM_SUCCESS;
      break;
    default:
      return BTM_ILLEGAL_VALUE;
  }
  return BTM_WRONG_MODE;
}
}


tBTM_STATUS bluetooth::shim::BTM_SetInquiryMode(uint8_t inquiry_mode) {
tBTM_STATUS bluetooth::shim::BTM_SetInquiryMode(uint8_t inquiry_mode) {
+3 −31
Original line number Original line Diff line number Diff line
@@ -81,22 +81,6 @@ tBTM_STATUS BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms,
tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode, uint16_t window,
tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode, uint16_t window,
                                   uint16_t interval);
                                   uint16_t interval);


/*******************************************************************************
 *
 * Function         BTM_SetInquiryScanType
 *
 * Description      This function is called to set the iquiry scan-type to
 *                  standard or interlaced.
 *
 * Input Params:    BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED
 *
 * Returns          BTM_SUCCESS if successful
 *                  BTM_MODE_UNSUPPORTED if not a 1.2 device
 *                  BTM_WRONG_MODE if the device is not up.
 *
 ******************************************************************************/
tBTM_STATUS BTM_SetInquiryScanType(uint16_t scan_type);

/*******************************************************************************
/*******************************************************************************
 *
 *
 * Function         BTM_BleObserve
 * Function         BTM_BleObserve
@@ -113,21 +97,9 @@ tBTM_STATUS BTM_BleObserve(bool start, uint8_t duration,
                           tBTM_INQ_RESULTS_CB* p_results_cb,
                           tBTM_INQ_RESULTS_CB* p_results_cb,
                           tBTM_CMPL_CB* p_cmpl_cb);
                           tBTM_CMPL_CB* p_cmpl_cb);


/*******************************************************************************
void BTM_EnableInterlacedInquiryScan();
 *

 * Function         BTM_SetPageScanType
void BTM_EnableInterlacedPageScan();
 *
 * Description      This function is called to set the page scan-type to
 *                  standard or interlaced.
 *
 * Input Params:    BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED
 *
 * Returns          BTM_SUCCESS if successful
 *                  BTM_MODE_UNSUPPORTED if not a 1.2 device
 *                  BTM_WRONG_MODE if the device is not up.
 *
 ******************************************************************************/
tBTM_STATUS BTM_SetPageScanType(uint16_t scan_type);


/*******************************************************************************
/*******************************************************************************
 *
 *
Loading