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

Commit 734c9f2f authored by Hansong Zhang's avatar Hansong Zhang
Browse files

BTM: Remove dead code

Test: compile
Change-Id: I18b48347656a1b93ce8103fffde527a6f0e4e1d1
parent eae6653e
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -154,13 +154,6 @@ typedef struct {
   BTM_SEC_OUT_AUTHENTICATE) /* Authentication required. */
#define BTA_SEC_ENCRYPT \
  (BTM_SEC_IN_ENCRYPT | BTM_SEC_OUT_ENCRYPT) /* Encryption required. */
#define BTA_SEC_MODE4_LEVEL4                                               \
  (BTM_SEC_MODE4_LEVEL4) /* Mode 4 level 4 service, i.e. incoming/outgoing \
                            MITM and P-256 encryption */
#define BTA_SEC_MITM \
  (BTM_SEC_IN_MITM | BTM_SEC_OUT_MITM) /* Man-In-The_Middle protection */
#define BTA_SEC_IN_16_DIGITS \
  (BTM_SEC_IN_MIN_16_DIGIT_PIN) /* Min 16 digit for pin code */

typedef uint16_t tBTA_SEC;

+0 −44
Original line number Diff line number Diff line
@@ -385,44 +385,6 @@ tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms,
  return BTM_CMD_STARTED;
}

tBTM_STATUS bluetooth::shim::BTM_SetPeriodicInquiryMode(
    tBTM_INQ_PARMS* p_inqparms, uint16_t max_delay, uint16_t min_delay,
    tBTM_INQ_RESULTS_CB* p_results_cb) {
  CHECK(p_inqparms != nullptr);
  CHECK(p_results_cb != nullptr);

  if (p_inqparms->duration < BTM_MIN_INQUIRY_LEN ||
      p_inqparms->duration > BTM_MAX_INQUIRY_LENGTH ||
      min_delay <= p_inqparms->duration ||
      min_delay < BTM_PER_INQ_MIN_MIN_PERIOD ||
      min_delay > BTM_PER_INQ_MAX_MIN_PERIOD || max_delay <= min_delay ||
      max_delay < BTM_PER_INQ_MIN_MAX_PERIOD) {
    return (BTM_ILLEGAL_VALUE);
  }

  if (shim_btm.IsInquiryActive()) {
    return BTM_BUSY;
  }

  switch (p_inqparms->filter_cond_type) {
    case kClearInquiryFilter:
      shim_btm.ClearInquiryFilter();
      return BTM_SUCCESS;
      break;
    case kFilterOnDeviceClass:
      shim_btm.SetFilterInquiryOnDevice();
      return BTM_SUCCESS;
      break;
    case kFilterOnAddress:
      shim_btm.SetFilterInquiryOnAddress();
      return BTM_SUCCESS;
      break;
    default:
      return BTM_ILLEGAL_VALUE;
  }
  return BTM_MODE_UNSUPPORTED;
}

tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode,
                                                    uint16_t window,
                                                    uint16_t interval) {
@@ -758,12 +720,6 @@ tBTM_STATUS bluetooth::shim::BTM_ClearInqDb(const RawAddress* p_bda) {
  return BTM_NO_RESOURCES;
}

tBTM_STATUS bluetooth::shim::BTM_ReadInquiryRspTxPower(tBTM_CMPL_CB* p_cb) {
  LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
  CHECK(p_cb != nullptr);
  return BTM_NO_RESOURCES;
}

tBTM_STATUS bluetooth::shim::BTM_WriteEIR(BT_HDR* p_buff) {
  LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
  CHECK(p_buff != nullptr);
+0 −429

File changed.

Preview size limit exceeded, changes collapsed.

+0 −126
Original line number Diff line number Diff line
@@ -1747,65 +1747,6 @@ uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr) {
  return (p->peer_lmp_feature_pages[0]);
}

/*******************************************************************************
 *
 * Function         BTM_ReadRemoteExtendedFeatures
 *
 * Returns          pointer to the remote extended features mask (8 bytes)
 *                  or NULL if bad page
 *
 ******************************************************************************/
uint8_t* BTM_ReadRemoteExtendedFeatures(const RawAddress& addr,
                                        uint8_t page_number) {
  tACL_CONN* p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
  BTM_TRACE_DEBUG("BTM_ReadRemoteExtendedFeatures");
  if (p == NULL) {
    return (NULL);
  }

  if (page_number > HCI_EXT_FEATURES_PAGE_MAX) {
    BTM_TRACE_ERROR("Warning: BTM_ReadRemoteExtendedFeatures page %d unknown",
                    page_number);
    return NULL;
  }

  return (p->peer_lmp_feature_pages[page_number]);
}

/*******************************************************************************
 *
 * Function         BTM_ReadNumberRemoteFeaturesPages
 *
 * Returns          number of features pages read from the remote device.
 *
 ******************************************************************************/
uint8_t BTM_ReadNumberRemoteFeaturesPages(const RawAddress& addr) {
  tACL_CONN* p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
  BTM_TRACE_DEBUG("BTM_ReadNumberRemoteFeaturesPages");
  if (p == NULL) {
    return (0);
  }

  return (p->num_read_pages);
}

/*******************************************************************************
 *
 * Function         BTM_ReadAllRemoteFeatures
 *
 * Returns          pointer to all features of the remote (24 bytes).
 *
 ******************************************************************************/
uint8_t* BTM_ReadAllRemoteFeatures(const RawAddress& addr) {
  tACL_CONN* p = btm_bda_to_acl(addr, BT_TRANSPORT_BR_EDR);
  BTM_TRACE_DEBUG("BTM_ReadAllRemoteFeatures");
  if (p == NULL) {
    return (NULL);
  }

  return (p->peer_lmp_feature_pages[0]);
}

/*******************************************************************************
 *
 * Function         BTM_RegBusyLevelNotif
@@ -1833,40 +1774,6 @@ tBTM_STATUS BTM_RegBusyLevelNotif(tBTM_BL_CHANGE_CB* p_cb, uint8_t* p_level,
  return (BTM_SUCCESS);
}

/*******************************************************************************
 *
 * Function         BTM_SetQoS
 *
 * Description      This function is called to setup QoS
 *
 * Returns          status of the operation
 *
 ******************************************************************************/
tBTM_STATUS BTM_SetQoS(const RawAddress& bd, FLOW_SPEC* p_flow,
                       tBTM_CMPL_CB* p_cb) {
  tACL_CONN* p = &btm_cb.acl_db[0];

  VLOG(2) << __func__ << " BdAddr: " << bd;

  /* If someone already waiting on the version, do not allow another */
  if (btm_cb.devcb.p_qos_setup_cmpl_cb) return (BTM_BUSY);

  p = btm_bda_to_acl(bd, BT_TRANSPORT_BR_EDR);
  if (p != NULL) {
    btm_cb.devcb.p_qos_setup_cmpl_cb = p_cb;
    alarm_set_on_mloop(btm_cb.devcb.qos_setup_timer, BTM_DEV_REPLY_TIMEOUT_MS,
                       btm_qos_setup_timeout, NULL);

    btsnd_hcic_qos_setup(p->hci_handle, p_flow->qos_flags, p_flow->service_type,
                         p_flow->token_rate, p_flow->peak_bandwidth,
                         p_flow->latency, p_flow->delay_variation);
    return (BTM_CMD_STARTED);
  }

  /* If here, no BD Addr found */
  return (BTM_UNKNOWN_ADDR);
}

/*******************************************************************************
 *
 * Function         btm_qos_setup_timeout
@@ -2038,39 +1945,6 @@ tBTM_STATUS BTM_ReadAutomaticFlushTimeout(const RawAddress& remote_bda,
  return BTM_CMD_STARTED;
}

/*******************************************************************************
 *
 * Function         BTM_ReadLinkQuality
 *
 * Description      This function is called to read the link qulaity.
 *                  The value of the link quality is returned in the callback.
 *                  (tBTM_LINK_QUALITY_RESULT)
 *
 * Returns          BTM_CMD_STARTED if successfully initiated or error code
 *
 ******************************************************************************/
tBTM_STATUS BTM_ReadLinkQuality(const RawAddress& remote_bda,
                                tBTM_CMPL_CB* p_cb) {
  VLOG(2) << __func__ << ": RemBdAddr: " << remote_bda;

  /* If someone already waiting on the version, do not allow another */
  if (btm_cb.devcb.p_link_qual_cmpl_cb) return (BTM_BUSY);

  tACL_CONN* p = btm_bda_to_acl(remote_bda, BT_TRANSPORT_BR_EDR);
  if (p != (tACL_CONN*)NULL) {
    btm_cb.devcb.p_link_qual_cmpl_cb = p_cb;
    alarm_set_on_mloop(btm_cb.devcb.read_link_quality_timer,
                       BTM_DEV_REPLY_TIMEOUT_MS, btm_read_link_quality_timeout,
                       NULL);

    btsnd_hcic_get_link_quality(p->hci_handle);
    return (BTM_CMD_STARTED);
  }

  /* If here, no BD Addr found */
  return (BTM_UNKNOWN_ADDR);
}

/*******************************************************************************
 *
 * Function         BTM_ReadTxPower
+0 −147
Original line number Diff line number Diff line
@@ -386,126 +386,6 @@ uint16_t BTM_ReadDiscoverability(uint16_t* p_window, uint16_t* p_interval) {
  return (btm_cb.btm_inq_vars.discoverable_mode);
}

/*******************************************************************************
 *
 * Function         BTM_SetPeriodicInquiryMode
 *
 * Description      This function is called to set the device periodic inquiry
 *                  mode. If the duration is zero, the periodic inquiry mode is
 *                  cancelled.
 *
 *                  Note: We currently do not allow concurrent inquiry and
 *                  periodic inquiry.
 *
 * Parameters:      p_inqparms - pointer to the inquiry information
 *                      mode - GENERAL or LIMITED inquiry
 *                      duration - length in 1.28 sec intervals (If '0', the
 *                                 inquiry is CANCELLED)
 *                      max_resps - maximum amount of devices to search for
 *                                  before ending the inquiry
 *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
 *                                         BTM_FILTER_COND_DEVICE_CLASS, or
 *                                         BTM_FILTER_COND_BD_ADDR
 *                      filter_cond - value for the filter (based on
 *                                                          filter_cond_type)
 *
 *                  max_delay - maximum amount of time between successive
 *                              inquiries
 *                  min_delay - minimum amount of time between successive
 *                              inquiries
 *                  p_results_cb - callback returning pointer to results
 *                              (tBTM_INQ_RESULTS)
 *
 * Returns          BTM_CMD_STARTED if successfully started
 *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
 *                  BTM_NO_RESOURCES if could not allocate a message buffer
 *                  BTM_SUCCESS - if cancelling the periodic inquiry
 *                  BTM_BUSY - if an inquiry is already active
 *                  BTM_WRONG_MODE if the device is not up.
 *
 ******************************************************************************/
tBTM_STATUS BTM_SetPeriodicInquiryMode(tBTM_INQ_PARMS* p_inqparms,
                                       uint16_t max_delay, uint16_t min_delay,
                                       tBTM_INQ_RESULTS_CB* p_results_cb) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::BTM_SetPeriodicInquiryMode(p_inqparms, max_delay,
                                                       min_delay, p_results_cb);
  }

  tBTM_STATUS status;
  tBTM_INQUIRY_VAR_ST* p_inq = &btm_cb.btm_inq_vars;

  BTM_TRACE_API(
      "BTM_SetPeriodicInquiryMode: mode: %d, dur: %d, rsps: %d, flt: %d, min: "
      "%d, max: %d",
      p_inqparms->mode, p_inqparms->duration, p_inqparms->max_resps,
      p_inqparms->filter_cond_type, min_delay, max_delay);

  /*** Make sure the device is ready ***/
  if (!BTM_IsDeviceUp()) return (BTM_WRONG_MODE);

  /* Only one active inquiry is allowed in this implementation.
     Also do not allow an inquiry if the inquiry filter is being updated */
  if (p_inq->inq_active || p_inq->inqfilt_active) return (BTM_BUSY);

  /* If illegal parameters return false */
  if (p_inqparms->mode != BTM_GENERAL_INQUIRY &&
      p_inqparms->mode != BTM_LIMITED_INQUIRY)
    return (BTM_ILLEGAL_VALUE);

  /* Verify the parameters for this command */
  if (p_inqparms->duration < BTM_MIN_INQUIRY_LEN ||
      p_inqparms->duration > BTM_MAX_INQUIRY_LENGTH ||
      min_delay <= p_inqparms->duration ||
      min_delay < BTM_PER_INQ_MIN_MIN_PERIOD ||
      min_delay > BTM_PER_INQ_MAX_MIN_PERIOD || max_delay <= min_delay ||
      max_delay < BTM_PER_INQ_MIN_MAX_PERIOD)
  /*       max_delay > BTM_PER_INQ_MAX_MAX_PERIOD)*/
  /*  BTM_PER_INQ_MAX_MAX_PERIOD set to 1's in all bits. Condition resulting in
     false always*/
  {
    return (BTM_ILLEGAL_VALUE);
  }

  /* Save the inquiry parameters to be used upon the completion of
   * setting/clearing the inquiry filter */
  p_inq->inqparms = *p_inqparms;
  p_inq->per_min_delay = min_delay;
  p_inq->per_max_delay = max_delay;
  p_inq->inq_cmpl_info.num_resp = 0; /* Clear the results counter */
  p_inq->p_inq_results_cb = p_results_cb;

  p_inq->inq_active = (uint8_t)(
      (p_inqparms->mode == BTM_LIMITED_INQUIRY)
          ? (BTM_LIMITED_INQUIRY_ACTIVE | BTM_PERIODIC_INQUIRY_ACTIVE)
          : (BTM_GENERAL_INQUIRY_ACTIVE | BTM_PERIODIC_INQUIRY_ACTIVE));

  /* If a filter is specified, then save it for later and clear the current
     filter.
     The setting of the filter is done upon completion of clearing of the
     previous
     filter.
  */
  if (p_inqparms->filter_cond_type != BTM_CLR_INQUIRY_FILTER) {
    p_inq->state = BTM_INQ_CLR_FILT_STATE;
    p_inqparms->filter_cond_type = BTM_CLR_INQUIRY_FILTER;
  } else /* The filter is not being used so simply clear it; the inquiry can
            start after this operation */
    p_inq->state = BTM_INQ_SET_FILT_STATE;

  /* Before beginning the inquiry the current filter must be cleared, so
   * initiate the command */
  status = btm_set_inq_event_filter(p_inqparms->filter_cond_type,
                                    &p_inqparms->filter_cond);
  if (status != BTM_CMD_STARTED) {
    /* If set filter command is not succesful reset the state */
    p_inq->p_inq_results_cb = NULL;
    p_inq->state = BTM_INQ_INACTIVE_STATE;
  }

  return (status);
}

/*******************************************************************************
 *
 * Function         BTM_CancelPeriodicInquiry
@@ -1084,33 +964,6 @@ tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda) {
  return (BTM_SUCCESS);
}

/*******************************************************************************
 *
 * Function         BTM_ReadInquiryRspTxPower
 *
 * Description      This command will read the inquiry Transmit Power level used
 *                  to transmit the FHS and EIR data packets. This can be used
 *                  directly in the Tx Power Level EIR data type.
 *
 * Returns          BTM_SUCCESS if successful
 *
 ******************************************************************************/
tBTM_STATUS BTM_ReadInquiryRspTxPower(tBTM_CMPL_CB* p_cb) {
  if (bluetooth::shim::is_gd_shim_enabled()) {
    return bluetooth::shim::BTM_ReadInquiryRspTxPower(p_cb);
  }

  if (btm_cb.devcb.p_inq_tx_power_cmpl_cb) return (BTM_BUSY);

  btm_cb.devcb.p_inq_tx_power_cmpl_cb = p_cb;
  alarm_set_on_mloop(btm_cb.devcb.read_inq_tx_power_timer,
                     BTM_INQ_REPLY_TIMEOUT_MS, btm_read_inq_tx_power_timeout,
                     NULL);

  btsnd_hcic_read_inq_tx_power();
  return (BTM_CMD_STARTED);
}

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