summaryrefslogtreecommitdiffstats
path: root/btif
diff options
context:
space:
mode:
authorfredc <fredc@broadcom.com>2012-05-13 15:02:13 -0700
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:20 -0700
commit019bddb4812851b93321b721fbdea83426fe1277 (patch)
tree4afa1af50db9132dabb92fe6cbae4e0c5aa683a4 /btif
parentc75ac3733bf900da032e6eb9a3c379b103755bac (diff)
downloadexternal_bluetooth_bluedroid-019bddb4812851b93321b721fbdea83426fe1277.zip
external_bluetooth_bluedroid-019bddb4812851b93321b721fbdea83426fe1277.tar.gz
external_bluetooth_bluedroid-019bddb4812851b93321b721fbdea83426fe1277.tar.bz2
Added support to disable HFP via compile time variable in bdroid_<target>.txt
Change-Id: If9b043e96a1eb66c8ca244787de8f8bcb52311bb
Diffstat (limited to 'btif')
-rwxr-xr-xbtif/src/btif_hf.c30
-rw-r--r--btif/src/btif_pan.c48
2 files changed, 47 insertions, 31 deletions
diff --git a/btif/src/btif_hf.c b/btif/src/btif_hf.c
index f191138..7881936 100755
--- a/btif/src/btif_hf.c
+++ b/btif/src/btif_hf.c
@@ -68,9 +68,27 @@
/************************************************************************************
** Constants & Macros
************************************************************************************/
-/* TODO: Should these be moved to a conf file? */
-#define BTIF_HF_SERVICES (BTA_HSP_SERVICE_MASK | BTA_HFP_SERVICE_MASK)
+#ifndef BTIF_HSAG_SERVICE_NAME
+#define BTIF_HSAG_SERVICE_NAME ("Headset Gateway")
+#endif
+
+#ifndef BTIF_HFAG_SERVICE_NAME
+#define BTIF_HFAG_SERVICE_NAME ("Handsfree Gateway")
+#endif
+
+#ifndef BTIF_HF_SERVICES
+#define BTIF_HF_SERVICES (BTA_HSP_SERVICE_MASK | BTA_HFP_SERVICE_MASK )
+#endif
+
+#ifndef BTIF_HF_SERVICE_NAMES
+#define BTIF_HF_SERVICE_NAMES {BTIF_HSAG_SERVICE_NAME , BTIF_HFAG_SERVICE_NAME}
+#endif
+
+#ifndef BTIF_HF_SECURITY
#define BTIF_HF_SECURITY (BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT)
+#endif
+
+#ifndef BTIF_HF_FEATURES
#define BTIF_HF_FEATURES ( BTA_AG_FEAT_3WAY | \
BTA_AG_FEAT_ECNR | \
BTA_AG_FEAT_REJECT | \
@@ -79,8 +97,7 @@
BTA_AG_FEAT_BTRH | \
BTA_AG_FEAT_VREC | \
BTA_AG_FEAT_UNAT)
-#define BTIF_HSAG_SERVICE_NAME ("Headset Gateway")
-#define BTIF_HFAG_SERVICE_NAME ("Handsfree Gateway")
+#endif
#define BTIF_HF_ID_1 0
@@ -483,8 +500,7 @@ static bt_status_t connect( bt_bdaddr_t *bd_addr )
bdcpy(btif_hf_cb.connected_bda.address, bd_addr->address);
BTA_AgOpen(btif_hf_cb.handle, btif_hf_cb.connected_bda.address,
- BTIF_HF_SECURITY, BTA_HSP_SERVICE_MASK | BTA_HFP_SERVICE_MASK);
-
+ BTIF_HF_SECURITY, BTIF_HF_SERVICES);
return BT_STATUS_SUCCESS;
}
@@ -1092,7 +1108,7 @@ static const bthf_interface_t bthfInterface = {
*******************************************************************************/
bt_status_t btif_hf_execute_service(BOOLEAN b_enable)
{
- char * p_service_names[] = {BTIF_HSAG_SERVICE_NAME, BTIF_HFAG_SERVICE_NAME};
+ char * p_service_names[] = BTIF_HF_SERVICE_NAMES;
if (b_enable)
{
/* Enable and register with BTA-AG */
diff --git a/btif/src/btif_pan.c b/btif/src/btif_pan.c
index fe71195..76faf27 100644
--- a/btif/src/btif_pan.c
+++ b/btif/src/btif_pan.c
@@ -100,7 +100,7 @@
btpan_cb_t btpan_cb;
BD_ADDR local_addr;
-
+static int btpan_initialized;
static bt_status_t btpan_init(const btpan_callbacks_t* callbacks);
static void btpan_cleanup();
static bt_status_t btpan_connect(const bt_bdaddr_t *bd_addr, int local_role, int remote_role);
@@ -135,56 +135,52 @@ btpan_interface_t *btif_pan_get_interface()
}
void btif_pan_init()
{
- debug("btpan_cb.enabled:%d", btpan_cb.enabled);
- //btif_enable_service(BTA_PANU_SERVICE_ID);
- //btif_enable_service(BTA_NAP_SERVICE_ID);
- if (!btpan_cb.enabled)
+ debug("btpan_initialized = %d, btpan_cb.enabled:%d", btpan_initialized, btpan_cb.enabled);
+ if (btpan_initialized && !btpan_cb.enabled)
{
- //btui_cfg.pan_security = PAN_SECURITY;
- //strncpy(btui_cfg.pannap_service_name, PAN_NAP_SERVICE_NAME, sizeof(btui_cfg.pannap_service_name) - 1);
- //btui_cfg.pannap_service_name[sizeof(btui_cfg.pannap_service_name) - 1] = 0;
- //btui_cfg.p_sc_menu = NULL;
+ debug("Enabling PAN....");
memset(&btpan_cb, 0, sizeof(btpan_cb));
btpan_cb.tap_fd = -1;
int i;
for(i = 0; i < MAX_PAN_CONNS; i++)
btpan_cleanup_conn(&btpan_cb.conns[i]);
-
BTA_PanEnable(bta_pan_callback);
btpan_cb.enabled = 1;
btpan_enable(BTPAN_ROLE_PANU | BTPAN_ROLE_PANNAP);
- //debug("set to BTPAN_ROLE_PANNAP for testing");
- //btpan_enable(BTPAN_ROLE_PANNAP);
}
debug("leaving");
-
}
+
void btif_pan_cleanup()
{
- debug("");
- //bt is shuting down, invalid all bta pan handles
- int i;
- for(i = 0; i < MAX_PAN_CONNS; i++)
+ debug("btpan_initialized = %d, btpan_cb.enabled:%d", btpan_initialized, btpan_cb.enabled);
+ if (btpan_initialized)
{
- btpan_cleanup_conn(&btpan_cb.conns[i]);
+ //bt is shuting down, invalid all bta pan handles
+ int i;
+ for(i = 0; i < MAX_PAN_CONNS; i++)
+ {
+ btpan_cleanup_conn(&btpan_cb.conns[i]);
+ }
+ btpan_cleanup();
+ debug("leaving");
}
- debug("calling btpan_cleanup");
- btpan_cleanup();
- debug("done calling btpan_cleanup");
-
}
+
static btpan_callbacks_t callback;
static bt_status_t btpan_init(const btpan_callbacks_t* callbacks)
{
- debug(" btpan_cb.enabled:%d", btpan_cb.enabled);
+ btpan_initialized=1;
+ debug("btpan_initialized = %d, btpan_cb.enabled:%d", btpan_initialized, btpan_cb.enabled);
static volatile int binit;
callback = *callbacks;
debug(" leaving");
return BT_STATUS_SUCCESS;
}
+
static void btpan_cleanup()
{
- debug("btpan_cb.enabled:%d", btpan_cb.enabled);
+ debug("btpan_initialized =%d, btpan_cb.enabled:%d", btpan_initialized, btpan_cb.enabled);
if (btpan_cb.enabled)
{
btpan_cb.enabled = 0;
@@ -196,6 +192,10 @@ static void btpan_cleanup()
btpan_cb.tap_fd = -1;
}
}
+ if (btpan_initialized)
+ {
+ btpan_initialized=0;
+ }
debug("leaving");
}
static inline int bta_role_to_btpan(int bta_pan_role)