From 2ccbb5ff38951c333f98f3e791ee77573606c43b Mon Sep 17 00:00:00 2001 From: Zach Johnson Date: Fri, 28 Aug 2020 16:52:39 -0700 Subject: [PATCH] BTA_HH_LE_INCLUDED is always true stop corrupting the code formatting Bug: 159815595 Tag: #refactor Test: compile & verify basic functions working Change-Id: I0b5dd0a15c4ab73f2e4a9eb9c01cb3f94b02b2fd --- bta/gatt/bta_gattc_act.cc | 8 -------- bta/hh/bta_hh_act.cc | 28 ---------------------------- bta/hh/bta_hh_api.cc | 2 -- bta/hh/bta_hh_int.h | 27 ++++----------------------- bta/hh/bta_hh_le.cc | 4 ---- bta/hh/bta_hh_main.cc | 40 +++++++++------------------------------- bta/hh/bta_hh_utils.cc | 10 ---------- bta/include/bta_hh_api.h | 10 ---------- bta/include/bta_hh_co.h | 3 --- btif/co/bta_hh_co.cc | 5 ----- internal_include/bt_target.h | 4 ---- 11 files changed, 13 insertions(+), 128 deletions(-) diff --git a/bta/gatt/bta_gattc_act.cc b/bta/gatt/bta_gattc_act.cc index c0e129ba7..cf28a0da0 100644 --- a/bta/gatt/bta_gattc_act.cc +++ b/bta/gatt/bta_gattc_act.cc @@ -39,9 +39,7 @@ #include "stack/include/btu.h" #include "utl.h" -#if (BTA_HH_LE_INCLUDED == TRUE) #include "bta_hh_int.h" -#endif using base::StringPrintf; using bluetooth::Uuid; @@ -139,13 +137,9 @@ void bta_gattc_disable() { bta_gattc_cb.state = BTA_GATTC_STATE_DISABLING; /* don't deregister HH GATT IF */ /* HH GATT IF will be deregistered by bta_hh_le_deregister when disable HH */ -#if (BTA_HH_LE_INCLUDED == TRUE) if (!bta_hh_le_is_hh_gatt_if(bta_gattc_cb.cl_rcb[i].client_if)) { -#endif bta_gattc_deregister(&bta_gattc_cb.cl_rcb[i]); -#if (BTA_HH_LE_INCLUDED == TRUE) } -#endif } /* no registered apps, indicate disable completed */ @@ -1070,7 +1064,6 @@ static void bta_gattc_enc_cmpl_cback(tGATT_IF gattc_if, const RawAddress& bda) { if (p_clcb == NULL) return; -#if (BTA_HH_LE_INCLUDED == TRUE) /* filter this event just for BTA HH LE GATT client, * In the future, if we want to enable encryption complete event * for all GATT clients, we can remove this code @@ -1078,7 +1071,6 @@ static void bta_gattc_enc_cmpl_cback(tGATT_IF gattc_if, const RawAddress& bda) { if (!bta_hh_le_is_hh_gatt_if(gattc_if)) { return; } -#endif VLOG(1) << __func__ << ": cif:" << +gattc_if; diff --git a/bta/hh/bta_hh_act.cc b/bta/hh/bta_hh_act.cc index 48e5e95dc..0deff65ff 100644 --- a/bta/hh/bta_hh_act.cc +++ b/bta/hh/bta_hh_act.cc @@ -93,11 +93,9 @@ void bta_hh_api_enable(tBTA_HH_DATA* p_data) { bta_hh_cb.cb_index[xx] = BTA_HH_IDX_INVALID; } -#if (BTA_HH_LE_INCLUDED == TRUE) if (status == BTA_HH_OK) { bta_hh_le_enable(); } else -#endif { /* signal BTA call back event */ tBTA_HH bta_hh; @@ -151,10 +149,8 @@ void bta_hh_api_disable(void) { * ******************************************************************************/ void bta_hh_disc_cmpl(void) { -#if (BTA_HH_LE_INCLUDED == TRUE) HID_HostDeregister(); bta_hh_le_deregister(); -#else tBTA_HH_STATUS status = BTA_HH_OK; /* Deregister with lower layer */ @@ -313,12 +309,10 @@ void bta_hh_start_sdp(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { p_cb->mode = p_data->api_conn.mode; bta_hh_cb.p_cur = p_cb; -#if (BTA_HH_LE_INCLUDED == TRUE) if (bta_hh_is_le_device(p_cb, p_data->api_conn.bd_addr)) { bta_hh_le_open_conn(p_cb, p_data->api_conn.bd_addr); return; } -#endif /* if previously virtually cabled device, skip SDP */ if (p_cb->app_id) { @@ -484,11 +478,9 @@ void bta_hh_api_disc_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { tBTA_HH_CBDATA disc_dat; tHID_STATUS status; -#if (BTA_HH_LE_INCLUDED == TRUE) if (p_cb->is_le_device) bta_hh_le_api_disc_act(p_cb); else -#endif { /* found an active connection */ disc_dat.handle = @@ -532,22 +524,18 @@ void bta_hh_open_cmpl_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { bta_hh_co_open(p_cb->hid_handle, p_cb->sub_class, p_cb->attr_mask, p_cb->app_id); -#if (BTA_HH_LE_INCLUDED == TRUE) conn.status = p_cb->status; conn.le_hid = p_cb->is_le_device; conn.scps_supported = p_cb->scps_supported; if (!p_cb->is_le_device) -#endif { /* inform role manager */ bta_sys_conn_open(BTA_ID_HH, p_cb->app_id, p_cb->addr); } /* set protocol mode when not default report mode */ if (p_cb->mode != BTA_HH_PROTO_RPT_MODE -#if (BTA_HH_LE_INCLUDED == TRUE) && !p_cb->is_le_device -#endif ) { if ((HID_HostWriteDev(dev_handle, HID_TRANS_SET_PROTOCOL, HID_PAR_PROTOCOL_BOOT_MODE, 0, 0, NULL)) != @@ -909,11 +897,9 @@ void bta_hh_close_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { ******************************************************************************/ void bta_hh_get_dscp_act(tBTA_HH_DEV_CB* p_cb, UNUSED_ATTR tBTA_HH_DATA* p_data) { -#if (BTA_HH_LE_INCLUDED == TRUE) if (p_cb->is_le_device) { bta_hh_le_get_dscp_act(p_cb); } else -#endif (*bta_hh_cb.p_cback)(BTA_HH_GET_DSCP_EVT, (tBTA_HH*)&p_cb->dscp_info); } @@ -940,31 +926,22 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { dev_info.bda = p_dev_info->bda; /* initialize callback data */ if (p_cb->hid_handle == BTA_HH_INVALID_HANDLE) { -#if (BTA_HH_LE_INCLUDED == TRUE) if (bta_hh_is_le_device(p_cb, p_data->api_conn.bd_addr)) { dev_info.handle = bta_hh_le_add_device(p_cb, p_dev_info); if (dev_info.handle != BTA_HH_INVALID_HANDLE) dev_info.status = BTA_HH_OK; } else -#endif if (HID_HostAddDev(p_dev_info->bda, p_dev_info->attr_mask, &dev_handle) == HID_SUCCESS) { dev_info.handle = dev_handle; dev_info.status = BTA_HH_OK; -#if (BTA_HH_LE_INCLUDED == TRUE) /* update DI information */ bta_hh_update_di_info(p_cb, p_dev_info->dscp_info.vendor_id, p_dev_info->dscp_info.product_id, p_dev_info->dscp_info.version, p_dev_info->dscp_info.flag); -#else - bta_hh_update_di_info(p_cb, p_dev_info->dscp_info.vendor_id, - p_dev_info->dscp_info.product_id, - p_dev_info->dscp_info.version, 0); - -#endif /* add to BTA device list */ bta_hh_add_device_to_list( p_cb, dev_handle, p_dev_info->attr_mask, @@ -988,13 +965,11 @@ void bta_hh_maint_dev_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { dev_info.handle = (uint8_t)p_dev_info->hdr.layer_specific; dev_info.bda = p_cb->addr; -#if (BTA_HH_LE_INCLUDED == TRUE) if (p_cb->is_le_device) { bta_hh_le_remove_dev_bg_conn(p_cb); bta_hh_sm_execute(p_cb, BTA_HH_API_CLOSE_EVT, NULL); bta_hh_clean_up_kdev(p_cb); } else -#endif { if (HID_HostRemoveDev(dev_info.handle) == HID_SUCCESS) { dev_info.status = BTA_HH_OK; @@ -1026,11 +1001,9 @@ void bta_hh_write_dev_act(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data) { uint16_t event = (p_data->api_sndcmd.t_type - BTA_HH_FST_BTE_TRANS_EVT) + BTA_HH_FST_TRANS_CB_EVT; -#if (BTA_HH_LE_INCLUDED == TRUE) if (p_cb->is_le_device) bta_hh_le_write_dev_act(p_cb, p_data); else -#endif { cbdata.handle = p_cb->hid_handle; @@ -1247,4 +1220,3 @@ static const char* bta_hh_hid_event_name(uint16_t event) { } } #endif -#endif /* BTA_HH_INCLUDED */ diff --git a/bta/hh/bta_hh_api.cc b/bta/hh/bta_hh_api.cc index 88e32adc1..dd3be6bdf 100644 --- a/bta/hh/bta_hh_api.cc +++ b/bta/hh/bta_hh_api.cc @@ -276,14 +276,12 @@ void BTA_HhSendCtrl(uint8_t dev_handle, tBTA_HH_TRANS_CTRL_TYPE c_type) { ******************************************************************************/ void BTA_HhSendData(uint8_t dev_handle, UNUSED_ATTR const RawAddress& dev_bda, BT_HDR* p_data) { -#if (BTA_HH_LE_INCLUDED == TRUE) if (p_data->layer_specific != BTA_HH_RPTT_OUTPUT) { APPL_TRACE_ERROR( "ERROR! Wrong report type! Write Command only valid for output " "report!"); return; } -#endif bta_hh_snd_write_dev(dev_handle, HID_TRANS_DATA, (uint8_t)p_data->layer_specific, 0, 0, p_data); } diff --git a/bta/hh/bta_hh_int.h b/bta/hh/bta_hh_int.h index 406675715..50eda83a8 100644 --- a/bta/hh/bta_hh_int.h +++ b/bta/hh/bta_hh_int.h @@ -29,9 +29,7 @@ #include "bta_sys.h" #include "utl.h" -#if (BTA_HH_LE_INCLUDED == TRUE) #include "bta_gatt_api.h" -#endif /* can be moved to bta_api.h */ #define BTA_HH_MAX_RPT_CHARS 8 @@ -50,13 +48,11 @@ enum { BTA_HH_API_GET_DSCP_EVT, BTA_HH_API_MAINT_DEV_EVT, BTA_HH_OPEN_CMPL_EVT, -#if (BTA_HH_LE_INCLUDED == TRUE) BTA_HH_GATT_CLOSE_EVT, BTA_HH_GATT_OPEN_EVT, BTA_HH_START_ENC_EVT, BTA_HH_ENC_CMPL_EVT, BTA_HH_GATT_ENC_CMPL_EVT, -#endif /* not handled by execute state machine */ BTA_HH_API_ENABLE_EVT, @@ -80,14 +76,10 @@ enum { BTA_HH_NULL_ST, BTA_HH_IDLE_ST, BTA_HH_W4_CONN_ST, - BTA_HH_CONN_ST -#if (BTA_HH_LE_INCLUDED == TRUE) - , - BTA_HH_W4_SEC -#endif - , + BTA_HH_CONN_ST, + BTA_HH_W4_SEC, BTA_HH_INVALID_ST /* Used to check invalid states before executing SM function - */ + */ }; typedef uint8_t tBTA_HH_STATE; @@ -98,9 +90,7 @@ typedef struct { uint8_t t_type; uint8_t param; uint8_t rpt_id; -#if (BTA_HH_LE_INCLUDED == TRUE) uint8_t srvc_id; -#endif uint16_t data; BT_HDR* p_data; } tBTA_HH_CMD_DATA; @@ -136,7 +126,6 @@ typedef struct { tBTA_HH_DEV_DSCP_INFO dscp_info; } tBTA_HH_MAINT_DEV; -#if (BTA_HH_LE_INCLUDED == TRUE) typedef struct { BT_HDR hdr; uint16_t conn_id; @@ -150,7 +139,7 @@ typedef struct { uint16_t scan_int; uint16_t scan_win; } tBTA_HH_SCPP_UPDATE; -#endif + /* union of all event data types */ typedef union { BT_HDR hdr; @@ -160,15 +149,12 @@ typedef union { tBTA_HH_CBACK_DATA hid_cback; tBTA_HH_STATUS status; tBTA_HH_MAINT_DEV api_maintdev; -#if (BTA_HH_LE_INCLUDED == TRUE) tBTA_HH_LE_CLOSE le_close; tBTA_GATTC_OPEN le_open; tBTA_HH_SCPP_UPDATE le_scpp_update; tBTA_GATTC_ENC_CMPL_CB le_enc_cmpl; -#endif } tBTA_HH_DATA; -#if (BTA_HH_LE_INCLUDED == TRUE) typedef struct { uint8_t index; bool in_use; @@ -210,7 +196,6 @@ typedef struct { /* check to see if th edevice handle is a LE device handle */ #define BTA_HH_IS_LE_DEV_HDL(x) ((x)&0xf0) #define BTA_HH_IS_LE_DEV_HDL_VALID(x) (((x) >> 4) <= BTA_HH_LE_MAX_KNOWN) -#endif /* device control block */ typedef struct { @@ -233,7 +218,6 @@ typedef struct { tBTA_HH_PROTO_MODE mode; /* protocol mode */ tBTA_HH_STATE state; /* CB state */ -#if (BTA_HH_LE_INCLUDED == TRUE) #define BTA_HH_LE_DISC_NONE 0x00 #define BTA_HH_LE_DISC_HIDS 0x01 #define BTA_HH_LE_DISC_DIS 0x02 @@ -254,7 +238,6 @@ typedef struct { #define BTA_HH_LE_SCPS_NOTIFY_SPT 0x01 #define BTA_HH_LE_SCPS_NOTIFY_ENB 0x02 uint8_t scps_notify; /* scan refresh supported/notification enabled */ -#endif bool security_pending; } tBTA_HH_DEV_CB; @@ -280,11 +263,9 @@ typedef struct { block idx, used in sdp */ uint8_t cb_index[BTA_HH_MAX_KNOWN]; /* maintain a CB index map to dev handle */ -#if (BTA_HH_LE_INCLUDED == TRUE) uint8_t le_cb_index[BTA_HH_LE_MAX_KNOWN]; /* maintain a CB index map to LE dev handle */ tGATT_IF gatt_if; -#endif tBTA_HH_CBACK* p_cback; /* Application callbacks */ tSDP_DISCOVERY_DB* p_disc_db; uint8_t trace_level; /* tracing level */ diff --git a/bta/hh/bta_hh_le.cc b/bta/hh/bta_hh_le.cc index 15d21f9b7..be2f2ded5 100755 --- a/bta/hh/bta_hh_le.cc +++ b/bta/hh/bta_hh_le.cc @@ -22,8 +22,6 @@ #include "bta_hh_int.h" #include "osi/include/osi.h" -#if (BTA_HH_LE_INCLUDED == TRUE) - #include #include @@ -2127,5 +2125,3 @@ static void bta_hh_process_cache_rpt(tBTA_HH_DEV_CB* p_cb, } } } - -#endif diff --git a/bta/hh/bta_hh_main.cc b/bta/hh/bta_hh_main.cc index 2528391bb..5de1b8045 100644 --- a/bta/hh/bta_hh_main.cc +++ b/bta/hh/bta_hh_main.cc @@ -51,14 +51,12 @@ enum { BTA_HH_MAINT_DEV_ACT, BTA_HH_OPEN_CMPL_ACT, BTA_HH_OPEN_FAILURE, -#if (BTA_HH_LE_INCLUDED == TRUE) BTA_HH_GATT_CLOSE, BTA_HH_LE_OPEN_FAIL, BTA_HH_GATT_OPEN, BTA_HH_START_SEC, BTA_HH_SEC_CMPL, BTA_HH_GATT_ENC_CMPL, -#endif BTA_HH_NUM_ACTIONS }; @@ -69,16 +67,13 @@ typedef void (*tBTA_HH_ACTION)(tBTA_HH_DEV_CB* p_cb, tBTA_HH_DATA* p_data); /* action functions */ const tBTA_HH_ACTION bta_hh_action[] = { - bta_hh_api_disc_act, bta_hh_open_act, bta_hh_close_act, bta_hh_data_act, - bta_hh_ctrl_dat_act, bta_hh_handsk_act, bta_hh_start_sdp, bta_hh_sdp_cmpl, - bta_hh_write_dev_act, bta_hh_get_dscp_act, bta_hh_maint_dev_act, - bta_hh_open_cmpl_act, bta_hh_open_failure -#if (BTA_HH_LE_INCLUDED == TRUE) - , - bta_hh_gatt_close, bta_hh_le_open_fail, bta_hh_gatt_open, - bta_hh_start_security, bta_hh_security_cmpl, bta_hh_le_notify_enc_cmpl -#endif -}; + bta_hh_api_disc_act, bta_hh_open_act, bta_hh_close_act, + bta_hh_data_act, bta_hh_ctrl_dat_act, bta_hh_handsk_act, + bta_hh_start_sdp, bta_hh_sdp_cmpl, bta_hh_write_dev_act, + bta_hh_get_dscp_act, bta_hh_maint_dev_act, bta_hh_open_cmpl_act, + bta_hh_open_failure, bta_hh_gatt_close, bta_hh_le_open_fail, + bta_hh_gatt_open, bta_hh_start_security, bta_hh_security_cmpl, + bta_hh_le_notify_enc_cmpl}; /* state table information */ #define BTA_HH_ACTION 0 /* position of action */ @@ -100,7 +95,6 @@ const uint8_t bta_hh_st_idle[][BTA_HH_NUM_COLS] = { /* BTA_HH_API_GET_DSCP_EVT */ {BTA_HH_IGNORE, BTA_HH_IDLE_ST}, /* BTA_HH_API_MAINT_DEV_EVT */ {BTA_HH_MAINT_DEV_ACT, BTA_HH_IDLE_ST}, /* BTA_HH_OPEN_CMPL_EVT */ {BTA_HH_OPEN_CMPL_ACT, BTA_HH_CONN_ST} -#if (BTA_HH_LE_INCLUDED == TRUE) /* BTA_HH_GATT_CLOSE_EVT */, {BTA_HH_IGNORE, BTA_HH_IDLE_ST} /* BTA_HH_GATT_OPEN_EVT */, @@ -111,8 +105,6 @@ const uint8_t bta_hh_st_idle[][BTA_HH_NUM_COLS] = { {BTA_HH_IGNORE, BTA_HH_IDLE_ST} /* BTA_HH_GATT_ENC_CMPL_EVT */, {BTA_HH_IGNORE, BTA_HH_IDLE_ST} -#endif - }; const uint8_t bta_hh_st_w4_conn[][BTA_HH_NUM_COLS] = { @@ -129,7 +121,6 @@ const uint8_t bta_hh_st_w4_conn[][BTA_HH_NUM_COLS] = { /* BTA_HH_API_GET_DSCP_EVT */ {BTA_HH_IGNORE, BTA_HH_W4_CONN_ST}, /* BTA_HH_API_MAINT_DEV_EVT */ {BTA_HH_MAINT_DEV_ACT, BTA_HH_IDLE_ST}, /* BTA_HH_OPEN_CMPL_EVT */ {BTA_HH_OPEN_CMPL_ACT, BTA_HH_CONN_ST} -#if (BTA_HH_LE_INCLUDED == TRUE) /* BTA_HH_GATT_CLOSE_EVT */, {BTA_HH_LE_OPEN_FAIL, BTA_HH_IDLE_ST} /* BTA_HH_GATT_OPEN_EVT */, @@ -140,7 +131,6 @@ const uint8_t bta_hh_st_w4_conn[][BTA_HH_NUM_COLS] = { {BTA_HH_IGNORE, BTA_HH_W4_CONN_ST} /* BTA_HH_GATT_ENC_CMPL_EVT */, {BTA_HH_IGNORE, BTA_HH_W4_CONN_ST} -#endif }; const uint8_t bta_hh_st_connected[][BTA_HH_NUM_COLS] = { @@ -157,7 +147,6 @@ const uint8_t bta_hh_st_connected[][BTA_HH_NUM_COLS] = { /* BTA_HH_API_GET_DSCP_EVT */ {BTA_HH_GET_DSCP_ACT, BTA_HH_CONN_ST}, /* BTA_HH_API_MAINT_DEV_EVT */ {BTA_HH_MAINT_DEV_ACT, BTA_HH_CONN_ST}, /* BTA_HH_OPEN_CMPL_EVT */ {BTA_HH_IGNORE, BTA_HH_CONN_ST} -#if (BTA_HH_LE_INCLUDED == TRUE) /* BTA_HH_GATT_CLOSE_EVT */, {BTA_HH_GATT_CLOSE, BTA_HH_IDLE_ST} /* BTA_HH_GATT_OPEN_EVT */, @@ -168,9 +157,8 @@ const uint8_t bta_hh_st_connected[][BTA_HH_NUM_COLS] = { {BTA_HH_IGNORE, BTA_HH_CONN_ST} /* BTA_HH_GATT_ENC_CMPL_EVT */, {BTA_HH_IGNORE, BTA_HH_CONN_ST} -#endif }; -#if (BTA_HH_LE_INCLUDED == TRUE) + const uint8_t bta_hh_st_w4_sec[][BTA_HH_NUM_COLS] = { /* Event Action Next state */ /* BTA_HH_API_OPEN_EVT */ {BTA_HH_IGNORE, BTA_HH_W4_SEC}, @@ -190,19 +178,13 @@ const uint8_t bta_hh_st_w4_sec[][BTA_HH_NUM_COLS] = { /* BTA_HH_START_ENC_EVT */ {BTA_HH_IGNORE, BTA_HH_W4_SEC}, /* BTA_HH_ENC_CMPL_EVT */ {BTA_HH_SEC_CMPL, BTA_HH_W4_CONN_ST}, /* BTA_HH_GATT_ENC_CMPL_EVT */ {BTA_HH_GATT_ENC_CMPL, BTA_HH_W4_SEC}}; -#endif /* type for state table */ typedef const uint8_t (*tBTA_HH_ST_TBL)[BTA_HH_NUM_COLS]; /* state table */ const tBTA_HH_ST_TBL bta_hh_st_tbl[] = {bta_hh_st_idle, bta_hh_st_w4_conn, - bta_hh_st_connected -#if (BTA_HH_LE_INCLUDED == TRUE) - , - bta_hh_st_w4_sec -#endif -}; + bta_hh_st_connected, bta_hh_st_w4_sec}; /***************************************************************************** * Global data @@ -465,7 +447,6 @@ static const char* bta_hh_evt_code(tBTA_HH_INT_EVT evt_code) { return "BTA_HH_API_GET_DSCP_EVT"; case BTA_HH_OPEN_CMPL_EVT: return "BTA_HH_OPEN_CMPL_EVT"; -#if (BTA_HH_LE_INCLUDED == TRUE) case BTA_HH_GATT_CLOSE_EVT: return "BTA_HH_GATT_CLOSE_EVT"; case BTA_HH_GATT_OPEN_EVT: @@ -474,7 +455,6 @@ static const char* bta_hh_evt_code(tBTA_HH_INT_EVT evt_code) { return "BTA_HH_START_ENC_EVT"; case BTA_HH_ENC_CMPL_EVT: return "BTA_HH_ENC_CMPL_EVT"; -#endif default: return "unknown HID Host event code"; } @@ -499,10 +479,8 @@ static const char* bta_hh_state_code(tBTA_HH_STATE state_code) { return "BTA_HH_W4_CONN_ST"; case BTA_HH_CONN_ST: return "BTA_HH_CONN_ST"; -#if (BTA_HH_LE_INCLUDED == TRUE) case BTA_HH_W4_SEC: return "BTA_HH_W4_SEC"; -#endif default: return "unknown HID Host state"; } diff --git a/bta/hh/bta_hh_utils.cc b/bta/hh/bta_hh_utils.cc index 8931cafbe..eb4ac5a81 100644 --- a/bta/hh/bta_hh_utils.cc +++ b/bta/hh/bta_hh_utils.cc @@ -110,12 +110,10 @@ void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB* p_cb) { uint8_t index; if (p_cb->hid_handle != BTA_HH_INVALID_HANDLE) { -#if (BTA_HH_LE_INCLUDED == TRUE) if (p_cb->is_le_device) bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(p_cb->hid_handle)] = BTA_HH_IDX_INVALID; else -#endif bta_hh_cb.cb_index[p_cb->hid_handle] = BTA_HH_IDX_INVALID; } @@ -142,11 +140,7 @@ void bta_hh_clean_up_kdev(tBTA_HH_DEV_CB* p_cb) { ******************************************************************************/ void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id, uint16_t product_id, uint16_t version, -#if (BTA_HH_LE_INCLUDED == TRUE) uint8_t flag) -#else - UNUSED_ATTR uint8_t flag) -#endif { #if (BTA_HH_DEBUG == TRUE) APPL_TRACE_DEBUG("vendor_id = 0x%2x product_id = 0x%2x version = 0x%2x", @@ -155,9 +149,7 @@ void bta_hh_update_di_info(tBTA_HH_DEV_CB* p_cb, uint16_t vendor_id, p_cb->dscp_info.vendor_id = vendor_id; p_cb->dscp_info.product_id = product_id; p_cb->dscp_info.version = version; -#if (BTA_HH_LE_INCLUDED == TRUE) p_cb->dscp_info.flag = flag; -#endif } /******************************************************************************* * @@ -472,7 +464,6 @@ void bta_hh_cleanup_disable(tBTA_HH_STATUS status) { uint8_t bta_hh_dev_handle_to_cb_idx(uint8_t dev_handle) { uint8_t index = BTA_HH_IDX_INVALID; -#if (BTA_HH_LE_INCLUDED == TRUE) if (BTA_HH_IS_LE_DEV_HDL(dev_handle)) { if (BTA_HH_IS_LE_DEV_HDL_VALID(dev_handle)) index = bta_hh_cb.le_cb_index[BTA_HH_GET_LE_CB_IDX(dev_handle)]; @@ -481,7 +472,6 @@ uint8_t bta_hh_dev_handle_to_cb_idx(uint8_t dev_handle) { dev_handle, index); #endif } else -#endif /* regular HID device checking */ if (dev_handle < BTA_HH_MAX_KNOWN) index = bta_hh_cb.cb_index[dev_handle]; diff --git a/bta/include/bta_hh_api.h b/bta/include/bta_hh_api.h index f14dbdd96..198e9ce64 100644 --- a/bta/include/bta_hh_api.h +++ b/bta/include/bta_hh_api.h @@ -21,9 +21,7 @@ #include "bta_api.h" #include "hidh_api.h" -#if (BTA_HH_LE_INCLUDED == TRUE) #include "gatt_api.h" -#endif /***************************************************************************** * Constants and Type Definitions @@ -77,7 +75,6 @@ typedef uint16_t tBTA_HH_EVT; #define BTA_HH_IDX_INVALID 0xff #define BTA_HH_MAX_KNOWN HID_HOST_MAX_DEVICES -#if (BTA_HH_LE_INCLUDED == TRUE) /* GATT_MAX_PHY_CHANNEL can not exceed 14 for the design of BTA HH */ #if GATT_MAX_PHY_CHANNEL > 14 #define BTA_HH_LE_MAX_KNOWN 14 @@ -86,9 +83,6 @@ typedef uint16_t tBTA_HH_EVT; #endif #define BTA_HH_MAX_DEVICE (HID_HOST_MAX_DEVICES + BTA_HH_LE_MAX_KNOWN) -#else -#define BTA_HH_MAX_DEVICE HID_HOST_MAX_DEVICES -#endif /* invalid device handle */ #define BTA_HH_INVALID_HANDLE 0xff @@ -190,12 +184,10 @@ typedef struct { uint16_t ssr_min_tout; /* SSR min timeout, BTA_HH_SSR_PARAM_INVALID if unknown */ uint8_t ctry_code; /*Country Code.*/ -#if (BTA_HH_LE_INCLUDED == TRUE) #define BTA_HH_LE_REMOTE_WAKE 0x01 #define BTA_HH_LE_NORMAL_CONN 0x02 uint8_t flag; -#endif tBTA_HH_DEV_DESCR descriptor; } tBTA_HH_DEV_DSCP_INFO; @@ -204,10 +196,8 @@ typedef struct { RawAddress bda; /* HID device bd address */ tBTA_HH_STATUS status; /* operation status */ uint8_t handle; /* device handle */ -#if (BTA_HH_LE_INCLUDED == TRUE) bool le_hid; /* is LE devices? */ bool scps_supported; /* scan parameter service supported */ -#endif } tBTA_HH_CONN; diff --git a/bta/include/bta_hh_co.h b/bta/include/bta_hh_co.h index d3362ad01..54877e5f5 100644 --- a/bta/include/bta_hh_co.h +++ b/bta/include/bta_hh_co.h @@ -102,7 +102,6 @@ extern void bta_hh_co_set_rpt_rsp(uint8_t dev_handle, uint8_t status); extern void bta_hh_co_get_rpt_rsp(uint8_t dev_handle, uint8_t status, uint8_t* p_rpt, uint16_t len); -#if (BTA_HH_LE_INCLUDED == TRUE) /******************************************************************************* * * Function bta_hh_le_co_rpt_info @@ -156,6 +155,4 @@ extern tBTA_HH_RPT_CACHE_ENTRY* bta_hh_le_co_cache_load( extern void bta_hh_le_co_reset_rpt_cache(const RawAddress& remote_bda, uint8_t app_id); -#endif /* #if (BTA_HH_LE_INCLUDED == TRUE) */ - #endif /* BTA_HH_CO_H */ diff --git a/btif/co/bta_hh_co.cc b/btif/co/bta_hh_co.cc index cec3f6927..2c7232f15 100644 --- a/btif/co/bta_hh_co.cc +++ b/btif/co/bta_hh_co.cc @@ -37,11 +37,9 @@ const char* dev_path = "/dev/uhid"; -#if (BTA_HH_LE_INCLUDED == TRUE) #include "btif_config.h" #define BTA_HH_NV_LOAD_MAX 16 static tBTA_HH_RPT_CACHE_ENTRY sReportCache[BTA_HH_NV_LOAD_MAX]; -#endif #define GET_RPT_RSP_OFFSET 9 #define THREAD_NORMAL_PRIORITY 0 #define BT_HH_THREAD "bt_hh_thread" @@ -614,7 +612,6 @@ void bta_hh_co_get_rpt_rsp(uint8_t dev_handle, uint8_t status, uint8_t* p_rpt, } } -#if (BTA_HH_LE_INCLUDED == TRUE) /******************************************************************************* * * Function bta_hh_le_co_rpt_info @@ -709,5 +706,3 @@ void bta_hh_le_co_reset_rpt_cache(const RawAddress& remote_bda, BTIF_TRACE_DEBUG("%s() - Reset cache for bda %s", __func__, bdstr); } - -#endif // (BTA_HH_LE_INCLUDED == TRUE) diff --git a/internal_include/bt_target.h b/internal_include/bt_target.h index 92e894a5b..6c86f7dbe 100644 --- a/internal_include/bt_target.h +++ b/internal_include/bt_target.h @@ -67,10 +67,6 @@ #define BTA_HH_ROLE BTA_MASTER_ROLE_PREF #endif -#ifndef BTA_HH_LE_INCLUDED -#define BTA_HH_LE_INCLUDED TRUE -#endif - #ifndef BTA_AV_SINK_INCLUDED #define BTA_AV_SINK_INCLUDED FALSE #endif -- 2.11.0