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

Commit dbebad04 authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Gerrit Code Review
Browse files

Merge changes Ia7ea581e,If22dda80 into main

* changes:
  Memory safe events in bta_dm_disc
  Make bta_dm_disc separate from BTA layer
parents b69c1a2b d263280c
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -49,11 +49,7 @@ using bluetooth::Uuid;
 *  Constants
 ****************************************************************************/

static const tBTA_SYS_REG bta_dm_search_reg = {bta_dm_search_sm_execute,
                                               bta_dm_search_sm_disable};

void BTA_dm_init() {
  bta_sys_register(BTA_ID_DM_SEARCH, &bta_dm_search_reg);
  /* if UUID list is not provided as static data */
  bta_sys_eir_register(bta_dm_eir_update_uuid);
  bta_sys_cust_eir_register(bta_dm_eir_update_cust_uuid);
+204 −207

File changed.

Preview size limit exceeded, changes collapsed.

+0 −2
Original line number Diff line number Diff line
@@ -35,8 +35,6 @@ void bta_dm_disc_start_service_discovery(service_discovery_callbacks cbacks,
                                         tBT_TRANSPORT transport);

// Bta subsystem entrypoint and lifecycle
bool bta_dm_search_sm_execute(const BT_HDR_RIGID* p_msg);
void bta_dm_search_sm_disable();
void bta_dm_disc_disable_search_and_disc();
// Indication that an acl has gone down and to examine the current
// service discovery procedure, if any.
+5 −28
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@
/* DM search events */
typedef enum : uint16_t {
  /* DM search API events */
  BTA_DM_API_SEARCH_EVT = BTA_SYS_EVT_START(BTA_ID_DM_SEARCH),
  BTA_DM_API_SEARCH_EVT,
  BTA_DM_API_SEARCH_CANCEL_EVT,
  BTA_DM_API_DISCOVER_EVT,
  BTA_DM_INQUIRY_CMPL_EVT,
@@ -65,25 +65,21 @@ inline std::string bta_dm_event_text(const tBTA_DM_EVT& event) {

/* data type for BTA_DM_API_SEARCH_EVT */
typedef struct {
  BT_HDR_RIGID hdr;
  tBTA_SERVICE_MASK services;
  tBTA_DM_SEARCH_CBACK* p_cback;
} tBTA_DM_API_SEARCH;

/* data type for BTA_DM_API_DISCOVER_EVT */
typedef struct {
  BT_HDR_RIGID hdr;
  RawAddress bd_addr;
  service_discovery_callbacks cbacks;
  tBT_TRANSPORT transport;
} tBTA_DM_API_DISCOVER;

typedef struct {
  BT_HDR_RIGID hdr;
} tBTA_DM_API_DISCOVERY_CANCEL;

typedef struct {
  BT_HDR_RIGID hdr;
  RawAddress bd_addr;
  BD_NAME bd_name; /* Name of peer device. */
  tHCI_STATUS hci_status;
@@ -91,45 +87,26 @@ typedef struct {

/* data type for tBTA_DM_DISC_RESULT */
typedef struct {
  BT_HDR_RIGID hdr;
  tBTA_DM_SEARCH result;
} tBTA_DM_DISC_RESULT;

/* data type for BTA_DM_INQUIRY_CMPL_EVT */
typedef struct {
  BT_HDR_RIGID hdr;
  uint8_t num;
} tBTA_DM_INQUIRY_CMPL;

/* data type for BTA_DM_SDP_RESULT_EVT */
typedef struct {
  BT_HDR_RIGID hdr;
  tSDP_RESULT sdp_result;
} tBTA_DM_SDP_RESULT;

typedef struct {
  BT_HDR_RIGID hdr;
  bool enable;
} tBTA_DM_API_BLE_FEATURE;

/* union of all data types */
typedef union {
  /* GKI event buffer header */
  BT_HDR_RIGID hdr;

  tBTA_DM_API_SEARCH search;

  tBTA_DM_API_DISCOVER discover;

  tBTA_DM_REMOTE_NAME remote_name_msg;

  tBTA_DM_DISC_RESULT disc_result;

  tBTA_DM_INQUIRY_CMPL inq_cmpl;

  tBTA_DM_SDP_RESULT sdp_event;

} tBTA_DM_MSG;
using tBTA_DM_MSG =
    std::variant<tBTA_DM_API_SEARCH, tBTA_DM_API_DISCOVER, tBTA_DM_REMOTE_NAME,
                 tBTA_DM_DISC_RESULT, tBTA_DM_INQUIRY_CMPL, tBTA_DM_SDP_RESULT>;

/* DM search state */
typedef enum {
@@ -167,7 +144,7 @@ typedef struct {
  BD_NAME peer_name;
  alarm_t* search_timer;
  uint8_t service_index;
  tBTA_DM_MSG* p_pending_search;
  std::unique_ptr<tBTA_DM_MSG> p_pending_search;
  fixed_queue_t* pending_discovery_queue;
  bool wait_disc;
  bool sdp_results;
+33 −35
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@ typedef enum : uint8_t {
  /* SW sub-systems */
  BTA_ID_SYS = 0,    /* system manager */
                     /* BLUETOOTH PART - from = 0, to BTA_ID_BLUETOOTH_MAX */
  BTA_ID_DM_SEARCH = 2, /* device manager search */
  BTA_ID_DM_SEC = 3, /* device manager security */
  BTA_ID_DG = 4,     /* data gateway */
  BTA_ID_AG = 5,     /* audio gateway */
@@ -109,7 +108,6 @@ typedef enum : uint8_t {
inline std::string BtaIdSysText(const tBTA_SYS_ID& sys_id) {
  switch (sys_id) {
    CASE_RETURN_TEXT(BTA_ID_SYS);
    CASE_RETURN_TEXT(BTA_ID_DM_SEARCH);
    CASE_RETURN_TEXT(BTA_ID_DM_SEC);
    CASE_RETURN_TEXT(BTA_ID_DG);
    CASE_RETURN_TEXT(BTA_ID_AG);
Loading