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

Commit a233fcf2 authored by Chris Manton's avatar Chris Manton
Browse files

Move lmp_version_below() into acl api

Working towards encapsulation of tACL_CONN

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I2fa4cfc5f906387bd3fd4bb6859b015478cb4c23
parent 6110cf25
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -2441,3 +2441,14 @@ void btm_pm_sm_alloc(uint8_t ind) {
  BTM_TRACE_DEBUG("btm_pm_sm_alloc ind:%d st:%d", ind, p_db->state);
#endif  // BTM_PM_DEBUG
}

bool lmp_version_below(const RawAddress& bda, uint8_t version) {
  tACL_CONN* acl = btm_bda_to_acl(bda, BT_TRANSPORT_LE);
  if (acl == NULL || acl->lmp_version == 0) {
    BTM_TRACE_WARNING("%s cannot retrieve LMP version...", __func__);
    return false;
  }
  BTM_TRACE_WARNING("%s LMP version %d < %d", __func__, acl->lmp_version,
                    version);
  return acl->lmp_version < version;
}
+2 −0
Original line number Diff line number Diff line
@@ -245,3 +245,5 @@ void btm_acl_role_changed(uint8_t hci_status, const RawAddress* bd_addr,
void btm_set_packet_types_from_address(const RawAddress& bda,
                                       tBT_TRANSPORT transport,
                                       uint16_t pkt_types);

bool lmp_version_below(const RawAddress& bda, uint8_t version);
+2 −11
Original line number Diff line number Diff line
@@ -24,9 +24,11 @@
#include "device/include/interop.h"
#include "internal_include/bt_target.h"
#include "stack/btm/btm_int.h"
#include "stack/include/acl_api.h"
#include "stack/include/l2c_api.h"
#include "stack/smp/p_256_ecc_pp.h"
#include "stack/smp/smp_int.h"
#include "types/raw_address.h"
#include "utils/include/bt_utils.h"

#define SMP_KEY_DIST_TYPE_MAX 4
@@ -38,17 +40,6 @@ const tSMP_ACT smp_distribute_act[] = {
    smp_set_derive_link_key /* SMP_SEC_KEY_TYPE_LK - '1' bit index */
};

static bool lmp_version_below(const RawAddress& bda, uint8_t version) {
  tACL_CONN* acl = btm_bda_to_acl(bda, BT_TRANSPORT_LE);
  if (acl == NULL || acl->lmp_version == 0) {
    SMP_TRACE_WARNING("%s cannot retrieve LMP version...", __func__);
    return false;
  }
  SMP_TRACE_WARNING("%s LMP version %d < %d", __func__, acl->lmp_version,
                    version);
  return acl->lmp_version < version;
}

static bool pts_test_send_authentication_complete_failure(tSMP_CB* p_cb) {
  uint8_t reason = p_cb->cert_failure;
  if (reason == SMP_PAIR_AUTH_FAIL || reason == SMP_PAIR_FAIL_UNKNOWN ||