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

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

Merge "Bluetooth 5 feature check implementation (1/3)"

parents 9bdfffdc e7197e38
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@
#include "btif_util.h"
#include "btif_util.h"
#include "btu.h"
#include "device/include/controller.h"
#include "device/include/interop.h"
#include "include/stack_config.h"
#include "osi/include/allocator.h"
@@ -1887,6 +1888,16 @@ static void btif_dm_upstreams_evt(uint16_t event, char* p_param) {
      local_le_features.debug_logging_supported =
          cmn_vsc_cb.debug_logging_supported > 0;

      const controller_t* controller = controller_get_interface();

      local_le_features.le_2m_phy_supported = controller->supports_ble_2m_phy();
      local_le_features.le_coded_phy_supported =
          controller->supports_ble_coded_phy();
      local_le_features.le_extended_advertising_supported =
          controller->supports_ble_extended_advertising();
      local_le_features.le_periodic_advertising_supported =
          controller->supports_ble_periodic_advertising();

      memcpy(prop.val, &local_le_features, prop.len);
      HAL_CBACK(bt_hal_cbacks, adapter_properties_cb, BT_STATUS_SUCCESS, 1,
                &prop);
+2 −0
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ typedef struct controller_t {
  bool (*supports_ble_packet_extension)(void);
  bool (*supports_ble_connection_parameters_request)(void);
  bool (*supports_ble_privacy)(void);
  bool (*supports_ble_2m_phy)(void);
  bool (*supports_ble_coded_phy)(void);
  bool (*supports_ble_extended_advertising)(void);
  bool (*supports_ble_periodic_advertising)(void);

+14 −0
Original line number Diff line number Diff line
@@ -377,6 +377,18 @@ static bool supports_ble_connection_parameters_request(void) {
  return HCI_LE_CONN_PARAM_REQ_SUPPORTED(features_ble.as_array);
}

static bool supports_ble_2m_phy(void) {
  CHECK(readable);
  CHECK(ble_supported);
  return HCI_LE_2M_PHY_SUPPORTED(features_ble.as_array);
}

static bool supports_ble_coded_phy(void) {
  CHECK(readable);
  CHECK(ble_supported);
  return HCI_LE_CODED_PHY_SUPPORTED(features_ble.as_array);
}

static bool supports_ble_extended_advertising(void) {
  CHECK(readable);
  CHECK(ble_supported);
@@ -486,6 +498,8 @@ static const controller_t interface = {
    supports_ble_packet_extension,
    supports_ble_connection_parameters_request,
    supports_ble_privacy,
    supports_ble_2m_phy,
    supports_ble_coded_phy,
    supports_ble_extended_advertising,
    supports_ble_periodic_advertising,

+3 −0
Original line number Diff line number Diff line
@@ -3186,6 +3186,9 @@ typedef struct {
  ((x)[HCI_SUPP_COMMANDS_LE_RC_CONN_PARAM_UPD_NEG_RPY_OFF] & \
   HCI_SUPP_COMMANDS_RLE_RC_CONN_PARAM_UPD_NEG_RPY_MASK)

#define HCI_LE_2M_PHY_SUPPORTED(x) (((x)[1] & 0x01))     // BIT 8 SET
#define HCI_LE_CODED_PHY_SUPPORTED(x) (((x)[1] & 0x08))  // BIT 11 SET

/* LE Advertising Extension related Procedurs */
#define HCI_LE_EXTENDED_ADVERTISING_SUPPORTED(x) \
  (((x)[1] & 0x10))  // BIT 12 SET