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

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

Merge changes Ia3f3c5d7,If3aaeccc,I74915b3a,I49b167a3,Iab536745

* changes:
  Include rfcdefs and add btm_client_interface
  Add tBTM_DEVCB::Init/Free
  Add tSCO_CB::Init
  Remove useless global level of indirection
  Add and Use stack//btm_acl::internal::set_default_packet_types_supported
parents fa4ce329 6ecb085d
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -388,7 +388,6 @@ struct sACL_CB {
  friend uint16_t acl_get_supported_packet_types();
  friend uint8_t btm_handle_to_acl_index(uint16_t hci_handle);
  friend void BTM_SetDefaultLinkSuperTout(uint16_t timeout);
  friend void BTM_acl_after_controller_started(const controller_t* controller);
  friend void BTM_default_block_role_switch();
  friend void BTM_default_unblock_role_switch();
  friend void acl_initialize_power_mode(const tACL_CONN& p_acl);
@@ -398,7 +397,6 @@ struct sACL_CB {
  friend void btm_acl_device_down(void);
  friend void btm_acl_encrypt_change(uint16_t handle, uint8_t status,
                                     uint8_t encr_enable);
  friend void btm_acl_init(void);
  friend void btm_pm_proc_cmd_status(tHCI_STATUS status);
  friend void btm_pm_proc_mode_change(tHCI_STATUS hci_status,
                                      uint16_t hci_handle, tHCI_MODE mode,
+6 −14
Original line number Diff line number Diff line
@@ -69,6 +69,8 @@ void gatt_find_in_device_record(const RawAddress& bd_addr,
void l2c_link_hci_conn_comp(uint8_t status, uint16_t handle,
                            const RawAddress& p_bda);

extern tBTM_CB btm_cb;

struct StackAclBtmAcl {
  tACL_CONN* acl_allocate_connection();
  tACL_CONN* acl_get_connection_from_handle(uint16_t handle);
@@ -80,6 +82,9 @@ struct StackAclBtmAcl {
  void btm_acl_role_changed(tHCI_STATUS hci_status, const RawAddress& bd_addr,
                            uint8_t new_role);
  void hci_start_role_switch_to_central(tACL_CONN& p_acl);
  void set_default_packet_types_supported(uint16_t packet_types_supported) {
    btm_cb.acl_cb_.btm_acl_pkt_types_supported = packet_types_supported;
  }
};

namespace {
@@ -117,8 +122,6 @@ inline bool IsEprAvailable(const tACL_CONN& p_acl) {
         controller_get_interface()->supports_encryption_pause();
}

extern tBTM_CB btm_cb;

static bool acl_is_role_central(const RawAddress& bda, tBT_TRANSPORT transport);
static void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p,
                                              uint16_t* p_pkt_type);
@@ -206,17 +209,6 @@ void hci_btm_set_link_supervision_timeout(tACL_CONN& link, uint16_t timeout) {
/* 3 seconds timeout waiting for responses */
#define BTM_DEV_REPLY_TIMEOUT_MS (3 * 1000)

/*******************************************************************************
 *
 * Function         btm_acl_init
 *
 * Description      This function is called at BTM startup to initialize
 *
 * Returns          void
 *
 ******************************************************************************/
void btm_acl_init(void) { btm_cb.acl_cb_.Init(); }

void BTM_acl_after_controller_started(const controller_t* controller) {
  internal_.btm_set_default_link_policy(
      HCI_ENABLE_CENTRAL_PERIPHERAL_SWITCH | HCI_ENABLE_HOLD_MODE |
@@ -258,7 +250,7 @@ void BTM_acl_after_controller_started(const controller_t* controller) {
      btm_acl_pkt_types_supported |=
          (HCI_PKT_TYPES_MASK_NO_2_DH5 + HCI_PKT_TYPES_MASK_NO_3_DH5);
  }
  btm_cb.acl_cb_.btm_acl_pkt_types_supported = btm_acl_pkt_types_supported;
  internal_.set_default_packet_types_supported(btm_acl_pkt_types_supported);
}

/*******************************************************************************
+0 −1
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ extern bool btm_inq_find_bdaddr(const RawAddress& p_bda);
/* Internal functions provided by btm_acl.cc
 *******************************************
*/
extern void btm_acl_init(void);
extern void btm_acl_device_down(void);
extern void btm_acl_set_paging(bool value);
extern void btm_acl_update_inquiry_status(uint8_t state);
+20 −0
Original line number Diff line number Diff line
@@ -190,6 +190,26 @@ typedef struct {

  tBTM_IO_CAP loc_io_caps;    /* IO capability of the local device */
  tBTM_AUTH_REQ loc_auth_req; /* the auth_req flag  */

  void Init() {
    read_local_name_timer = alarm_new("btm.read_local_name_timer");
    read_rssi_timer = alarm_new("btm.read_rssi_timer");
    read_failed_contact_counter_timer =
        alarm_new("btm.read_failed_contact_counter_timer");
    read_automatic_flush_timeout_timer =
        alarm_new("btm.read_automatic_flush_timeout_timer");
    read_link_quality_timer = alarm_new("btm.read_link_quality_timer");
    read_tx_power_timer = alarm_new("btm.read_tx_power_timer");
  }

  void Free() {
    alarm_free(read_local_name_timer);
    alarm_free(read_rssi_timer);
    alarm_free(read_failed_contact_counter_timer);
    alarm_free(read_automatic_flush_timeout_timer);
    alarm_free(read_link_quality_timer);
    alarm_free(read_tx_power_timer);
  }
} tBTM_DEVCB;

typedef struct {
+1 −2
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@
*/
tBTM_CB btm_cb;

extern void btm_acl_init(void);
extern void btm_dev_init(void);
extern void btm_dev_free(void);
extern void btm_inq_db_init(void);
@@ -62,7 +61,7 @@ void btm_init(void) {

  /* Initialize BTM component structures */
  btm_inq_db_init(); /* Inquiry Database and Structures */
  btm_acl_init();    /* ACL Database and Structures */
  btm_cb.acl_cb_.Init(); /* ACL Database and Structures */
  btm_sco_init(); /* SCO Database and Structures (If included) */

  btm_dev_init(); /* Device Manager Structures & HCI_Reset */
Loading