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

Commit df1a78a6 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Add Api stack/acl/btm_acl::acl_write_automatic_flush_timeout am: fe735ddd

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1406658

Change-Id: I6ed527ebc7671f93885bdd7a2c634f94bf2b88db
parents 67901b7d fe735ddd
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ typedef struct {
  bool link_up_issued;
  tBT_TRANSPORT transport;
  uint16_t clock_offset;
  uint16_t flush_timeout_in_ticks;
  uint16_t hci_handle;
  uint16_t link_policy;
  uint16_t link_super_tout;
+27 −0
Original line number Diff line number Diff line
@@ -2865,3 +2865,30 @@ void acl_disconnect(const RawAddress& bd_addr, tBT_TRANSPORT transport,
void acl_send_data_packet(BT_HDR* p_buf, uint16_t flags) {
  bte_main_hci_send(p_buf, flags);
}

void acl_write_automatic_flush_timeout(const RawAddress& bd_addr,
                                       uint16_t flush_timeout_in_ticks) {
  tACL_CONN* p_acl = internal_.btm_bda_to_acl(bd_addr, BT_TRANSPORT_BR_EDR);
  if (p_acl == nullptr) {
    LOG_ERROR("%s Unknown peer ACL", __func__);
    return;
  }
  if (p_acl->flush_timeout_in_ticks == flush_timeout_in_ticks) {
    LOG_INFO(
        "%s Ignoring since cached value is same as requested flush_timeout:%hd",
        __func__, flush_timeout_in_ticks);
    return;
  }
  flush_timeout_in_ticks &= HCI_MAX_AUTOMATIC_FLUSH_TIMEOUT;
  p_acl->flush_timeout_in_ticks = flush_timeout_in_ticks;
  btsnd_hcic_write_auto_flush_tout(p_acl->hci_handle, flush_timeout_in_ticks);
}

uint16_t acl_read_cached_automatic_flush_timeout(const RawAddress& bd_addr) {
  tACL_CONN* p_acl = internal_.btm_bda_to_acl(bd_addr, BT_TRANSPORT_BR_EDR);
  if (p_acl == nullptr) {
    LOG_ERROR("%s Unknown peer ACL", __func__);
    return HCI_DEFAULT_AUTOMATIC_FLUSH_TIMEOUT;
  }
  return p_acl->flush_timeout_in_ticks;
}
+4 −1
Original line number Diff line number Diff line
@@ -21,13 +21,16 @@
#include "types/raw_address.h"

// This header contains functions for L2cap-ACL to invoke

//
uint16_t acl_read_cached_automatic_flush_timeout(const RawAddress& bd_addr);
void acl_accept_connection_request(const RawAddress& bd_addr, uint8_t role);
void acl_create_classic_connection(const RawAddress& bd_addr,
                                   bool there_are_high_priority_channels,
                                   bool is_bonding);
void acl_reject_connection_request(const RawAddress& bd_addr, uint8_t reason);
void acl_send_data_packet(BT_HDR* p_buf, uint16_t flags);
void acl_write_automatic_flush_timeout(const RawAddress& bd_addr,
                                       uint16_t flush_timeout);

// ACL data received from HCI-ACL
extern void l2c_rcv_acl_data(BT_HDR* p_msg);