summaryrefslogtreecommitdiffstats
path: root/btif/src/btif_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'btif/src/btif_core.c')
-rw-r--r--[-rwxr-xr-x]btif/src/btif_core.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/btif/src/btif_core.c b/btif/src/btif_core.c
index b77cddb..f6f54f0 100755..100644
--- a/btif/src/btif_core.c
+++ b/btif/src/btif_core.c
@@ -55,6 +55,7 @@
***********************************************************************************/
#include <hardware/bluetooth.h>
+
#include <string.h>
#define LOG_TAG "BTIF_CORE"
@@ -65,9 +66,11 @@
#include "btu.h"
#include "bte.h"
#include "bd.h"
+#include "btif_av.h"
#include "btif_storage.h"
#include "btif_util.h"
#include "btif_sock.h"
+
/************************************************************************************
** Constants & Macros
************************************************************************************/
@@ -431,16 +434,25 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status, BD_ADDR local_bd)
{
/* store state */
btif_enabled = 1;
- //init rfcomm & l2cap api
+
+ /* check if we have a deferred av init */
+ btif_av_init();
+
+ /* init rfcomm & l2cap api */
btif_sock_init();
+
+ /* load did configuration */
bte_load_did_conf(BTE_DID_CONF_FILE);
+
HAL_CBACK(bt_hal_cbacks, adapter_state_changed_cb, BT_STATE_ON);
}
else
{
- //cleanup rfcomm & l2cap api
+ /* cleanup rfcomm & l2cap api */
btif_sock_cleanup();
+
btif_enabled = 0;
+
HAL_CBACK(bt_hal_cbacks, adapter_state_changed_cb, BT_STATE_OFF);
}
}
@@ -456,6 +468,7 @@ void btif_enable_bluetooth_evt(tBTA_STATUS status, BD_ADDR local_bd)
** Returns void
**
*******************************************************************************/
+
bt_status_t btif_disable_bluetooth(void)
{
tBTA_STATUS status;
@@ -467,8 +480,10 @@ bt_status_t btif_disable_bluetooth(void)
}
BTIF_TRACE_DEBUG1("%s", __FUNCTION__);
- //cleanup rfcomm & l2cap api
+
+ /* cleanup rfcomm & l2cap api */
btif_sock_cleanup();
+
status = BTA_DisableBluetooth();
if (status != BTA_SUCCESS)
@@ -1077,6 +1092,11 @@ tBTA_SERVICE_MASK btif_get_enabled_services_mask(void)
return btif_enabled_services;
}
+int btif_is_enabled(void)
+{
+ return btif_enabled;
+}
+
/*******************************************************************************
**
** Function btif_enable_service