Remove usages of SDP_CLIENT_ENABLED
Test: Sanity test connecting to headset and carkit
Change-Id: I215743c9d07881b9fa8213c52853b9a389f8452d
diff --git a/system/bta/hl/bta_hl_sdp.cc b/system/bta/hl/bta_hl_sdp.cc
index 9aa6294..fe3da58 100644
--- a/system/bta/hl/bta_hl_sdp.cc
+++ b/system/bta/hl/bta_hl_sdp.cc
@@ -528,7 +528,6 @@
******************************************************************************/
tSDP_DISC_REC* bta_hl_find_sink_or_src_srv_class_in_db(
const tSDP_DISCOVERY_DB* p_db, const tSDP_DISC_REC* p_start_rec) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_REC* p_rec;
tSDP_DISC_ATTR *p_attr, *p_sattr;
@@ -564,7 +563,6 @@
p_rec = p_rec->p_next_rec;
}
-#endif
/* If here, no matching UUID found */
#if (BTA_HL_DEBUG == TRUE)
diff --git a/system/include/bt_target.h b/system/include/bt_target.h
index e0977c0..6782d8c 100644
--- a/system/include/bt_target.h
+++ b/system/include/bt_target.h
@@ -830,11 +830,6 @@
#define SDP_MAX_UUID_FILTERS 3
#endif
-/* This is set to enable SDP client functionality. */
-#ifndef SDP_CLIENT_ENABLED
-#define SDP_CLIENT_ENABLED TRUE
-#endif
-
/* The maximum number of record handles retrieved in a search. */
#ifndef SDP_MAX_DISC_SERVER_RECS
#define SDP_MAX_DISC_SERVER_RECS 21
diff --git a/system/stack/sdp/sdp_api.cc b/system/stack/sdp/sdp_api.cc
index f11d71a..b9cdb53 100644
--- a/system/stack/sdp/sdp_api.cc
+++ b/system/stack/sdp/sdp_api.cc
@@ -68,7 +68,6 @@
bool SDP_InitDiscoveryDb(tSDP_DISCOVERY_DB* p_db, uint32_t len,
uint16_t num_uuid, tSDP_UUID* p_uuid_list,
uint16_t num_attr, uint16_t* p_attr_list) {
-#if (SDP_CLIENT_ENABLED == TRUE)
uint16_t xx;
/* verify the parameters */
@@ -99,7 +98,6 @@
sdpu_sort_attr_list(num_attr, p_db);
p_db->num_attr_filters = num_attr;
-#endif
return (true);
}
@@ -114,13 +112,11 @@
*
******************************************************************************/
bool SDP_CancelServiceSearch(tSDP_DISCOVERY_DB* p_db) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tCONN_CB* p_ccb = sdpu_find_ccb_by_db(p_db);
if (!p_ccb) return (false);
sdp_disconnect(p_ccb, SDP_CANCEL);
p_ccb->disc_state = SDP_DISC_WAIT_CANCEL;
-#endif
return (true);
}
@@ -135,7 +131,6 @@
******************************************************************************/
bool SDP_ServiceSearchRequest(uint8_t* p_bd_addr, tSDP_DISCOVERY_DB* p_db,
tSDP_DISC_CMPL_CB* p_cb) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tCONN_CB* p_ccb;
/* Specific BD address */
@@ -148,9 +143,6 @@
p_ccb->p_cb = p_cb;
return (true);
-#else
- return (false);
-#endif
}
/*******************************************************************************
@@ -170,7 +162,6 @@
bool SDP_ServiceSearchAttributeRequest(uint8_t* p_bd_addr,
tSDP_DISCOVERY_DB* p_db,
tSDP_DISC_CMPL_CB* p_cb) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tCONN_CB* p_ccb;
/* Specific BD address */
@@ -185,9 +176,6 @@
p_ccb->is_attr_search = true;
return (true);
-#else
- return (false);
-#endif
}
/*******************************************************************************
*
@@ -207,7 +195,6 @@
tSDP_DISCOVERY_DB* p_db,
tSDP_DISC_CMPL_CB2* p_cb2,
void* user_data) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tCONN_CB* p_ccb;
/* Specific BD address */
@@ -223,15 +210,10 @@
p_ccb->user_data = user_data;
return (true);
-#else
- return (false);
-#endif
}
-#if (SDP_CLIENT_ENABLED == TRUE)
void SDP_SetIdleTimeout(UNUSED_ATTR BD_ADDR addr,
UNUSED_ATTR uint16_t timeout) {}
-#endif
/*******************************************************************************
*
@@ -247,7 +229,6 @@
******************************************************************************/
tSDP_DISC_REC* SDP_FindAttributeInDb(tSDP_DISCOVERY_DB* p_db, uint16_t attr_id,
tSDP_DISC_REC* p_start_rec) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_REC* p_rec;
tSDP_DISC_ATTR* p_attr;
@@ -269,7 +250,6 @@
p_rec = p_rec->p_next_rec;
}
-#endif
/* If here, no matching attribute found */
return (NULL);
}
@@ -285,7 +265,6 @@
*
******************************************************************************/
tSDP_DISC_ATTR* SDP_FindAttributeInRec(tSDP_DISC_REC* p_rec, uint16_t attr_id) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_ATTR* p_attr;
p_attr = p_rec->p_first_attr;
@@ -294,7 +273,7 @@
p_attr = p_attr->p_next_attr;
}
-#endif
+
/* If here, no matching attribute found */
return (NULL);
}
@@ -313,7 +292,6 @@
*
******************************************************************************/
bool SDP_FindServiceUUIDInRec(tSDP_DISC_REC* p_rec, tBT_UUID* p_uuid) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_ATTR *p_attr, *p_sattr, *p_extra_sattr;
p_attr = p_rec->p_first_attr;
@@ -377,7 +355,6 @@
p_attr = p_attr->p_next_attr;
}
return false;
-#endif
}
/*******************************************************************************
@@ -394,7 +371,6 @@
*
******************************************************************************/
bool SDP_FindServiceUUIDInRec_128bit(tSDP_DISC_REC* p_rec, tBT_UUID* p_uuid) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_ATTR* p_attr = p_rec->p_first_attr;
while (p_attr) {
if ((p_attr->attr_id == ATTR_ID_SERVICE_CLASS_ID_LIST) &&
@@ -429,7 +405,6 @@
p_attr = p_attr->p_next_attr;
}
return false;
-#endif
}
/*******************************************************************************
@@ -447,7 +422,6 @@
tSDP_DISC_REC* SDP_FindServiceInDb(tSDP_DISCOVERY_DB* p_db,
uint16_t service_uuid,
tSDP_DISC_REC* p_start_rec) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_REC* p_rec;
tSDP_DISC_ATTR *p_attr, *p_sattr, *p_extra_sattr;
@@ -529,7 +503,6 @@
p_rec = p_rec->p_next_rec;
}
-#endif
/* If here, no matching UUID found */
return (NULL);
}
@@ -551,7 +524,6 @@
******************************************************************************/
tSDP_DISC_REC* SDP_FindServiceInDb_128bit(tSDP_DISCOVERY_DB* p_db,
tSDP_DISC_REC* p_start_rec) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_REC* p_rec;
tSDP_DISC_ATTR *p_attr, *p_sattr;
@@ -588,7 +560,6 @@
p_rec = p_rec->p_next_rec;
}
-#endif
/* If here, no matching UUID found */
return (NULL);
}
@@ -612,7 +583,6 @@
tSDP_DISC_REC* SDP_FindServiceUUIDInDb(tSDP_DISCOVERY_DB* p_db,
tBT_UUID* p_uuid,
tSDP_DISC_REC* p_start_rec) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_REC* p_rec;
tSDP_DISC_ATTR *p_attr, *p_sattr;
@@ -648,12 +618,10 @@
p_rec = p_rec->p_next_rec;
}
-#endif /* CLIENT_ENABLED == TRUE */
/* If here, no matching UUID found */
return (NULL);
}
-#if (SDP_CLIENT_ENABLED == TRUE)
/*******************************************************************************
*
* Function sdp_fill_proto_elem
@@ -708,7 +676,6 @@
return (false);
}
-#endif /* CLIENT_ENABLED == TRUE */
/*******************************************************************************
*
@@ -723,7 +690,6 @@
******************************************************************************/
bool SDP_FindProtocolListElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
tSDP_PROTOCOL_ELEM* p_elem) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_ATTR* p_attr;
p_attr = p_rec->p_first_attr;
@@ -735,7 +701,6 @@
}
p_attr = p_attr->p_next_attr;
}
-#endif
/* If here, no match found */
return (false);
}
@@ -753,7 +718,6 @@
******************************************************************************/
bool SDP_FindAddProtoListsElemInRec(tSDP_DISC_REC* p_rec, uint16_t layer_uuid,
tSDP_PROTOCOL_ELEM* p_elem) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_ATTR *p_attr, *p_sattr;
bool ret = false;
@@ -775,7 +739,6 @@
}
p_attr = p_attr->p_next_attr;
}
-#endif
/* If here, no match found */
return (false);
}
@@ -796,7 +759,6 @@
******************************************************************************/
bool SDP_FindProfileVersionInRec(tSDP_DISC_REC* p_rec, uint16_t profile_uuid,
uint16_t* p_version) {
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISC_ATTR *p_attr, *p_sattr;
p_attr = p_rec->p_first_attr;
@@ -843,7 +805,6 @@
}
p_attr = p_attr->p_next_attr;
}
-#endif /* CLIENT_ENABLED == TRUE */
/* If here, no match found */
return (false);
@@ -864,7 +825,6 @@
******************************************************************************/
uint16_t SDP_DiDiscover(BD_ADDR remote_device, tSDP_DISCOVERY_DB* p_db,
uint32_t len, tSDP_DISC_CMPL_CB* p_cb) {
-#if (SDP_CLIENT_ENABLED == TRUE)
uint16_t result = SDP_DI_DISC_FAILED;
uint16_t num_uuids = 1;
uint16_t di_uuid = UUID_SERVCLASS_PNP_INFORMATION;
@@ -879,9 +839,6 @@
result = SDP_SUCCESS;
return result;
-#else
- return SDP_DI_DISC_FAILED;
-#endif
}
/*******************************************************************************
@@ -894,7 +851,6 @@
*
******************************************************************************/
uint8_t SDP_GetNumDiRecords(tSDP_DISCOVERY_DB* p_db) {
-#if (SDP_CLIENT_ENABLED == TRUE)
uint8_t num_records = 0;
tSDP_DISC_REC* p_curr_record = NULL;
@@ -905,9 +861,6 @@
} while (p_curr_record);
return num_records;
-#else
- return 0;
-#endif
}
/*******************************************************************************
@@ -948,7 +901,6 @@
uint16_t SDP_GetDiRecord(uint8_t get_record_index,
tSDP_DI_GET_RECORD* p_device_info,
tSDP_DISCOVERY_DB* p_db) {
-#if (SDP_CLIENT_ENABLED == TRUE)
uint16_t result = SDP_NO_DI_RECORD_FOUND;
uint8_t curr_record_index = 1;
@@ -1028,9 +980,6 @@
}
return result;
-#else /* SDP_CLIENT_ENABLED is FALSE */
- return SDP_NO_DI_RECORD_FOUND;
-#endif
}
/*******************************************************************************
diff --git a/system/stack/sdp/sdp_discovery.cc b/system/stack/sdp/sdp_discovery.cc
index e088809..ee70788 100644
--- a/system/stack/sdp/sdp_discovery.cc
+++ b/system/stack/sdp/sdp_discovery.cc
@@ -43,7 +43,6 @@
/******************************************************************************/
/* L O C A L F U N C T I O N P R O T O T Y P E S */
/******************************************************************************/
-#if (SDP_CLIENT_ENABLED == TRUE)
static void process_service_search_rsp(tCONN_CB* p_ccb, uint8_t* p_reply);
static void process_service_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply);
static void process_service_search_attr_rsp(tCONN_CB* p_ccb, uint8_t* p_reply);
@@ -971,5 +970,3 @@
return (p);
}
-
-#endif /* CLIENT_ENABLED == TRUE */
diff --git a/system/stack/sdp/sdp_main.cc b/system/stack/sdp/sdp_main.cc
index e2bf760..85112a1 100644
--- a/system/stack/sdp/sdp_main.cc
+++ b/system/stack/sdp/sdp_main.cc
@@ -59,13 +59,8 @@
static void sdp_disconnect_ind(uint16_t l2cap_cid, bool ack_needed);
static void sdp_data_ind(uint16_t l2cap_cid, BT_HDR* p_msg);
-#if (SDP_CLIENT_ENABLED == TRUE)
static void sdp_connect_cfm(uint16_t l2cap_cid, uint16_t result);
static void sdp_disconnect_cfm(uint16_t l2cap_cid, uint16_t result);
-#else
-#define sdp_connect_cfm NULL
-#define sdp_disconnect_cfm NULL
-#endif
/*******************************************************************************
*
@@ -98,14 +93,12 @@
}
#endif
-#if (SDP_CLIENT_ENABLED == TRUE)
/* Register with Security Manager for the specific security level */
if (!BTM_SetSecurityLevel(true, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER,
SDP_SECURITY_LEVEL, SDP_PSM, 0, 0)) {
SDP_TRACE_ERROR("Security Registration for Client failed");
return;
}
-#endif
#if defined(SDP_INITIAL_TRACE_LEVEL)
sdp_cb.trace_level = SDP_INITIAL_TRACE_LEVEL;
@@ -208,7 +201,6 @@
#endif
}
-#if (SDP_CLIENT_ENABLED == TRUE)
/*******************************************************************************
*
* Function sdp_connect_cfm
@@ -281,7 +273,6 @@
sdpu_release_ccb(p_ccb);
}
}
-#endif /* SDP_CLIENT_ENABLED == TRUE */
/*******************************************************************************
*
@@ -425,9 +416,7 @@
return;
}
-#if (SDP_CLIENT_ENABLED == TRUE)
sdp_disconnect(p_ccb, SDP_CFG_FAILED);
-#endif
}
}
@@ -454,7 +443,6 @@
if (ack_needed) L2CA_DisconnectRsp(l2cap_cid);
SDP_TRACE_EVENT("SDP - Rcvd L2CAP disc, CID: 0x%x", l2cap_cid);
-#if (SDP_CLIENT_ENABLED == TRUE)
/* Tell the user if he has a callback */
if (p_ccb->p_cb)
(*p_ccb->p_cb)((uint16_t)((p_ccb->con_state == SDP_STATE_CONNECTED)
@@ -466,7 +454,6 @@
: SDP_CONN_FAILED),
p_ccb->user_data);
-#endif
sdpu_release_ccb(p_ccb);
}
@@ -508,7 +495,6 @@
osi_free(p_msg);
}
-#if (SDP_CLIENT_ENABLED == TRUE)
/*******************************************************************************
*
* Function sdp_conn_originate
@@ -658,7 +644,6 @@
sdpu_release_ccb(p_ccb);
}
-#endif /* SDP_CLIENT_ENABLED == TRUE */
/*******************************************************************************
*
@@ -677,12 +662,10 @@
p_ccb->connection_id);
L2CA_DisconnectReq(p_ccb->connection_id);
-#if (SDP_CLIENT_ENABLED == TRUE)
/* Tell the user if he has a callback */
if (p_ccb->p_cb)
(*p_ccb->p_cb)(SDP_CONN_FAILED);
else if (p_ccb->p_cb2)
(*p_ccb->p_cb2)(SDP_CONN_FAILED, p_ccb->user_data);
-#endif
sdpu_release_ccb(p_ccb);
}
diff --git a/system/stack/sdp/sdp_utils.cc b/system/stack/sdp/sdp_utils.cc
index 6969c36..720c746 100644
--- a/system/stack/sdp/sdp_utils.cc
+++ b/system/stack/sdp/sdp_utils.cc
@@ -78,7 +78,6 @@
*
******************************************************************************/
tCONN_CB* sdpu_find_ccb_by_db(tSDP_DISCOVERY_DB* p_db) {
-#if (SDP_CLIENT_ENABLED == TRUE)
uint16_t xx;
tCONN_CB* p_ccb;
@@ -89,7 +88,6 @@
return (p_ccb);
}
}
-#endif
/* If here, not found */
return (NULL);
}
@@ -136,9 +134,7 @@
/* Drop any response pointer we may be holding */
p_ccb->con_state = SDP_STATE_IDLE;
-#if (SDP_CLIENT_ENABLED == TRUE)
p_ccb->is_attr_search = false;
-#endif
/* Free the response buffer */
if (p_ccb->rsp_list) SDP_TRACE_DEBUG("releasing SDP rsp_list");
diff --git a/system/stack/sdp/sdpint.h b/system/stack/sdp/sdpint.h
index 7eb7e80..5dfa082 100644
--- a/system/stack/sdp/sdpint.h
+++ b/system/stack/sdp/sdpint.h
@@ -176,7 +176,6 @@
uint16_t list_len; /* length of the response in the GKI buffer */
uint8_t* rsp_list; /* pointer to GKI buffer holding response */
-#if (SDP_CLIENT_ENABLED == TRUE)
tSDP_DISCOVERY_DB* p_db; /* Database to save info into */
tSDP_DISC_CMPL_CB* p_cb; /* Callback for discovery done */
tSDP_DISC_CMPL_CB2*
@@ -200,7 +199,6 @@
uint8_t disc_state;
uint8_t is_attr_search;
-#endif /* SDP_CLIENT_ENABLED == TRUE */
#if (SDP_SERVER_ENABLED == TRUE)
uint16_t cont_offset; /* Continuation state data in the server response */
@@ -305,13 +303,8 @@
/* Functions provided by sdp_discovery.cc
*/
-#if (SDP_CLIENT_ENABLED == TRUE)
extern void sdp_disc_connected(tCONN_CB* p_ccb);
extern void sdp_disc_server_rsp(tCONN_CB* p_ccb, BT_HDR* p_msg);
-#else
-#define sdp_disc_connected(p_ccb)
-#define sdp_disc_server_rsp(p_ccb, p_msg)
-#endif
#ifdef __cplusplus
}