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

Commit 1097c8c3 authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Andre Eisenbach
Browse files

Convert HID and Device Manager BTA code to C++

These are the only places that use BTA GATTC API. After this change it's
possible to change GATT API to use C++ types as arguments.

Bug: 28485365
Change-Id: Idf83396f4bc3a2cc8a9b41f69da5d033af1be678
parent 12a8475f
Loading
Loading
Loading
Loading
+13 −13
Original line number Diff line number Diff line
@@ -6,13 +6,13 @@ include $(CLEAR_VARS)
LOCAL_CPP_EXTENSION := .cc

LOCAL_SRC_FILES:= \
    ./dm/bta_dm_ci.c \
    ./dm/bta_dm_act.c \
    ./dm/bta_dm_pm.c \
    ./dm/bta_dm_main.c \
    ./dm/bta_dm_cfg.c \
    ./dm/bta_dm_api.c \
    ./dm/bta_dm_sco.c \
    ./dm/bta_dm_ci.cc \
    ./dm/bta_dm_act.cc \
    ./dm/bta_dm_pm.cc \
    ./dm/bta_dm_main.cc \
    ./dm/bta_dm_cfg.cc \
    ./dm/bta_dm_api.cc \
    ./dm/bta_dm_sco.cc \
    ./gatt/bta_gattc_api.cc \
    ./gatt/bta_gatts_act.cc \
    ./gatt/bta_gatts_main.cc \
@@ -40,12 +40,12 @@ LOCAL_SRC_FILES:= \
    ./hf_client/bta_hf_client_sdp.c \
    ./hf_client/bta_hf_client_sco.c \
    ./hf_client/bta_hf_client_cmd.c \
    ./hh/bta_hh_cfg.c \
    ./hh/bta_hh_act.c \
    ./hh/bta_hh_api.c \
    ./hh/bta_hh_le.c \
    ./hh/bta_hh_utils.c \
    ./hh/bta_hh_main.c \
    ./hh/bta_hh_cfg.cc \
    ./hh/bta_hh_act.cc \
    ./hh/bta_hh_api.cc \
    ./hh/bta_hh_le.cc \
    ./hh/bta_hh_utils.cc \
    ./hh/bta_hh_main.cc \
    ./pan/bta_pan_main.c \
    ./pan/bta_pan_ci.c \
    ./pan/bta_pan_act.c \
+13 −13
Original line number Diff line number Diff line
@@ -35,13 +35,13 @@ static_library("bta") {
    "av/bta_av_main.c",
    "av/bta_av_sbc.c",
    "av/bta_av_ssm.c",
    "dm/bta_dm_act.c",
    "dm/bta_dm_api.c",
    "dm/bta_dm_cfg.c",
    "dm/bta_dm_ci.c",
    "dm/bta_dm_main.c",
    "dm/bta_dm_pm.c",
    "dm/bta_dm_sco.c",
    "dm/bta_dm_act.cc",
    "dm/bta_dm_api.cc",
    "dm/bta_dm_cfg.cc",
    "dm/bta_dm_ci.cc",
    "dm/bta_dm_main.cc",
    "dm/bta_dm_pm.cc",
    "dm/bta_dm_sco.cc",
    "gatt/bta_gattc_act.cc",
    "gatt/bta_gattc_api.cc",
    "gatt/bta_gattc_cache.cc",
@@ -59,12 +59,12 @@ static_library("bta") {
    "hf_client/bta_hf_client_rfc.c",
    "hf_client/bta_hf_client_sdp.c",
    "hf_client/bta_hf_client_sco.c",
    "hh/bta_hh_act.c",
    "hh/bta_hh_api.c",
    "hh/bta_hh_cfg.c",
    "hh/bta_hh_le.c",
    "hh/bta_hh_main.c",
    "hh/bta_hh_utils.c",
    "hh/bta_hh_act.cc",
    "hh/bta_hh_api.cc",
    "hh/bta_hh_cfg.cc",
    "hh/bta_hh_le.cc",
    "hh/bta_hh_main.cc",
    "hh/bta_hh_utils.cc",
    "hl/bta_hl_act.c",
    "hl/bta_hl_api.c",
    "hl/bta_hl_ci.c",
+2 −1
Original line number Diff line number Diff line
@@ -30,9 +30,10 @@
#include "port_api.h"
#include "utl.h"
#include <string.h>
#include "bta_dm_int.h"
#include "l2c_api.h"

extern void bta_dm_pm_active(BD_ADDR peer_addr);

/*****************************************************************************
**  Constants
*****************************************************************************/
+3 −3
Original line number Diff line number Diff line
@@ -135,7 +135,7 @@ static void bta_dm_remove_sec_dev_entry(BD_ADDR remote_bd_addr);
static void bta_dm_observe_results_cb(tBTM_INQ_RESULTS *p_inq, UINT8 *p_eir);
static void bta_dm_observe_cmpl_cb(void * p_result);
static void bta_dm_delay_role_switch_cback(void *data);
extern void sdpu_uuid16_to_uuid128(UINT16 uuid16, UINT8* p_uuid128);
extern "C" void sdpu_uuid16_to_uuid128(UINT16 uuid16, UINT8* p_uuid128);
static void bta_dm_disable_timer_cback(void *data);


@@ -1762,7 +1762,7 @@ void bta_dm_sdp_result (tBTA_DM_MSG *p_data)
                                 bta_dm_search_cb.p_sdp_db->raw_data);

                p_msg->disc_result.result.disc_res.p_raw_data =
                    osi_malloc(bta_dm_search_cb.p_sdp_db->raw_used);
                    (uint8_t *) osi_malloc(bta_dm_search_cb.p_sdp_db->raw_used);
                memcpy(p_msg->disc_result.result.disc_res.p_raw_data,
                       bta_dm_search_cb.p_sdp_db->raw_data,
                       bta_dm_search_cb.p_sdp_db->raw_used);
@@ -5440,7 +5440,7 @@ static void bta_dm_gatt_disc_complete(UINT16 conn_id, tBTA_GATT_STATUS status)
        p_msg->disc_result.result.disc_res.device_type |= BT_DEVICE_TYPE_BLE;
        if (bta_dm_search_cb.ble_raw_used > 0) {
            p_msg->disc_result.result.disc_res.p_raw_data =
                osi_malloc(bta_dm_search_cb.ble_raw_used);
                (uint8_t*) osi_malloc(bta_dm_search_cb.ble_raw_used);

            memcpy(p_msg->disc_result.result.disc_res.p_raw_data,
                   bta_dm_search_cb.p_ble_rawdata,
+7 −6
Original line number Diff line number Diff line
@@ -924,7 +924,7 @@ void BTA_DmSetBleAdvParams (UINT16 adv_int_min, UINT16 adv_int_max,
void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_adv_cfg,
                            tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback)
{
  tBTA_DM_API_SET_ADV_CONFIG *p_msg = osi_calloc(sizeof(*p_msg));
  tBTA_DM_API_SET_ADV_CONFIG *p_msg = (tBTA_DM_API_SET_ADV_CONFIG*) osi_calloc(sizeof(*p_msg));

  p_msg->hdr.event = BTA_DM_API_BLE_SET_ADV_CONFIG_EVT;
  p_msg->data_mask = data_mask;
@@ -948,7 +948,7 @@ void BTA_DmBleSetAdvConfig (tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_adv
extern void BTA_DmBleSetScanRsp (tBTA_BLE_AD_MASK data_mask, tBTA_BLE_ADV_DATA *p_adv_cfg,
                                 tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback)
{
  tBTA_DM_API_SET_ADV_CONFIG *p_msg = osi_calloc(sizeof(*p_msg));
  tBTA_DM_API_SET_ADV_CONFIG *p_msg = (tBTA_DM_API_SET_ADV_CONFIG*) osi_calloc(sizeof(*p_msg));

  p_msg->hdr.event = BTA_DM_API_BLE_SET_SCAN_RSP_EVT;
  p_msg->data_mask = data_mask;
@@ -1398,9 +1398,9 @@ void BTA_BleEnableAdvInstance (tBTA_BLE_ADV_PARAMS *p_params,
    APPL_TRACE_API("%s", __func__);

    p_msg->hdr.event = BTA_DM_API_BLE_MULTI_ADV_ENB_EVT;
    p_msg->p_cback = (void *)p_cback;
    p_msg->p_cback = (tBTA_BLE_MULTI_ADV_CBACK *)p_cback;
    if (p_params != NULL) {
        p_msg->p_params = (void *)(p_msg + 1);
        p_msg->p_params = (tBTA_BLE_ADV_PARAMS *)(p_msg + 1);
        memcpy(p_msg->p_params, p_params, sizeof(tBTA_BLE_ADV_PARAMS));
    }
    p_msg->p_ref = p_ref;
@@ -1432,7 +1432,7 @@ void BTA_BleUpdateAdvInstParam (UINT8 inst_id, tBTA_BLE_ADV_PARAMS *p_params)

    p_msg->hdr.event = BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT;
    p_msg->inst_id = inst_id;
    p_msg->p_params = (void *)(p_msg + 1);
    p_msg->p_params = (tBTA_BLE_ADV_PARAMS *)(p_msg + 1);
    memcpy(p_msg->p_params, p_params, sizeof(tBTA_BLE_ADV_PARAMS));

    bta_sys_sendmsg(p_msg);
@@ -1459,7 +1459,8 @@ void BTA_BleCfgAdvInstData (UINT8 inst_id, BOOLEAN is_scan_rsp,
                            tBTA_BLE_AD_MASK data_mask,
                            tBTA_BLE_ADV_DATA *p_data)
{
  tBTA_DM_API_BLE_MULTI_ADV_DATA *p_msg = osi_calloc(sizeof(*p_msg));
  tBTA_DM_API_BLE_MULTI_ADV_DATA *p_msg =
    (tBTA_DM_API_BLE_MULTI_ADV_DATA*) osi_calloc(sizeof(*p_msg));

  p_msg->hdr.event = BTA_DM_API_BLE_MULTI_ADV_DATA_EVT;
  p_msg->inst_id = inst_id;
Loading