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

Commit 35503f9d authored by Chris Manton's avatar Chris Manton
Browse files

Add common API to set hci handle

Towards readable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I77837cc51daaca9f89c8b5d83aa84996b2d9e38f
parent 0323bb56
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@ typedef struct t_l2c_linkcb {
                               uint16_t conn_timeout);
  friend void l2c_link_hci_conn_comp(uint8_t status, uint16_t handle,
                                     const RawAddress& p_bda);
  friend void l2cu_set_lcb_handle(struct t_l2c_linkcb& p_lcb, uint16_t handle);
  void SetHandle(uint16_t handle) { handle_ = handle; }

 public:
+9 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include "l2c_int.h"
#include "l2cdefs.h"
#include "osi/include/allocator.h"
#include "osi/include/log.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/acl_api.h"

@@ -94,6 +95,14 @@ tL2C_LCB* l2cu_allocate_lcb(const RawAddress& p_bd_addr, bool is_bonding,
  return (NULL);
}

void l2cu_set_lcb_handle(struct t_l2c_linkcb& p_lcb, uint16_t handle) {
  if (p_lcb.Handle() != HCI_INVALID_HANDLE) {
    LOG_WARN("Should not replace active handle:%hu with new handle:%hu",
             p_lcb.Handle(), handle);
  }
  p_lcb.SetHandle(handle);
}

/*******************************************************************************
 *
 * Function         l2cu_update_lcb_4_bonding