summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavi Nagarajan <nravi@broadcom.com>2012-03-09 02:38:37 +0530
committerMatthew Xie <mattx@google.com>2012-07-14 11:19:13 -0700
commit7f88788bf1b416370812113febc10484f90c1aab (patch)
tree89ec2192aea8e41c88b117cec0aceaa513dedfa3
parent837acf40a4968449f044cfd3cd15f7f120617eb5 (diff)
downloadexternal_bluetooth_bluedroid-7f88788bf1b416370812113febc10484f90c1aab.zip
external_bluetooth_bluedroid-7f88788bf1b416370812113febc10484f90c1aab.tar.gz
external_bluetooth_bluedroid-7f88788bf1b416370812113febc10484f90c1aab.tar.bz2
Notify the app of SLC connection, clear phone states on disconnect and rfcomm connect
(cherry picked from commit 984f9fcc5d36c640a4b0d01ab550dcd0252e4538) Change-Id: Idf9b8a4dc9258a818b6bb51294bb7334ef158a69
-rw-r--r--btif/src/btif_hf.c20
-rw-r--r--btif/src/btif_util.c14
2 files changed, 19 insertions, 15 deletions
diff --git a/btif/src/btif_hf.c b/btif/src/btif_hf.c
index 866655b..a9c4561 100644
--- a/btif/src/btif_hf.c
+++ b/btif/src/btif_hf.c
@@ -142,7 +142,7 @@ static btif_hf_cb_t btif_hf_cb;
*******************************************************************************/
static BOOLEAN is_connected(bt_bdaddr_t *bd_addr)
{
- if ((btif_hf_cb.state == BTHF_CONNECTION_STATE_CONNECTED) &&
+ if (((btif_hf_cb.state == BTHF_CONNECTION_STATE_CONNECTED) || (btif_hf_cb.state == BTHF_CONNECTION_STATE_SLC_CONNECTED))&&
((bd_addr == NULL) || (bdcmp(bd_addr->address, btif_hf_cb.connected_bda.address) == 0)))
return TRUE;
else
@@ -214,6 +214,13 @@ static void send_indicator_update (UINT16 indicator, UINT16 value)
BTA_AgResult(BTA_AG_HANDLE_ALL, BTA_AG_IND_RES, &ag_res);
}
+void clear_phone_state()
+{
+ btif_hf_cb.call_setup_state = BTHF_CALL_STATE_IDLE;
+ btif_hf_cb.num_active = btif_hf_cb.num_held = 0;
+}
+
+
/*****************************************************************************
** Section name (Group of functions)
*****************************************************************************/
@@ -257,6 +264,7 @@ static void btif_hf_upstreams_evt(UINT16 event, char* p_param)
bdcpy(btif_hf_cb.connected_bda.address, p_data->open.bd_addr);
btif_hf_cb.state = BTHF_CONNECTION_STATE_CONNECTED;
btif_hf_cb.peer_feat = 0;
+ clear_phone_state();
}
else if (btif_hf_cb.state == BTHF_CONNECTION_STATE_CONNECTING)
{
@@ -271,19 +279,27 @@ static void btif_hf_upstreams_evt(UINT16 event, char* p_param)
CHECK_CALL_CBACK(bt_hf_callbacks, connection_state_cb, btif_hf_cb.state, &btif_hf_cb.connected_bda);
- if (p_data->open.status != BTA_AG_SUCCESS)
+ if (btif_hf_cb.state == BTHF_CONNECTION_STATE_DISCONNECTED)
bdsetany(btif_hf_cb.connected_bda.address);
break;
case BTA_AG_CLOSE_EVT:
btif_hf_cb.state = BTHF_CONNECTION_STATE_DISCONNECTED;
CHECK_CALL_CBACK(bt_hf_callbacks, connection_state_cb, btif_hf_cb.state, &btif_hf_cb.connected_bda);
+
bdsetany(btif_hf_cb.connected_bda.address);
btif_hf_cb.peer_feat = 0;
+ clear_phone_state();
+
break;
case BTA_AG_CONN_EVT:
btif_hf_cb.peer_feat = p_data->conn.peer_feat;
+ btif_hf_cb.state = BTHF_CONNECTION_STATE_SLC_CONNECTED;
+
+ CHECK_CALL_CBACK(bt_hf_callbacks, connection_state_cb, btif_hf_cb.state,
+ &btif_hf_cb.connected_bda);
+
break;
case BTA_AG_AUDIO_OPEN_EVT:
diff --git a/btif/src/btif_util.c b/btif/src/btif_util.c
index 6ce6657..453d470 100644
--- a/btif/src/btif_util.c
+++ b/btif/src/btif_util.c
@@ -56,7 +56,6 @@
#include <hardware/bluetooth.h>
#include <hardware/bt_hf.h>
-#include <hardware/bt_av.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
@@ -277,6 +276,7 @@ const char* dump_hf_conn_state(UINT16 event)
CASE_RETURN_STR(BTHF_CONNECTION_STATE_DISCONNECTED)
CASE_RETURN_STR(BTHF_CONNECTION_STATE_CONNECTING)
CASE_RETURN_STR(BTHF_CONNECTION_STATE_CONNECTED)
+ CASE_RETURN_STR(BTHF_CONNECTION_STATE_SLC_CONNECTED)
CASE_RETURN_STR(BTHF_CONNECTION_STATE_DISCONNECTING)
default:
return "UNKNOWN MSG ID";
@@ -326,18 +326,6 @@ const char* dump_hf_audio_state(UINT16 event)
}
}
-const char* dump_av_conn_state(UINT16 event)
-{
- switch(event)
- {
- CASE_RETURN_STR(BTAV_CONNECTION_STATE_DISCONNECTED)
- CASE_RETURN_STR(BTAV_CONNECTION_STATE_CONNECTING)
- CASE_RETURN_STR(BTAV_CONNECTION_STATE_CONNECTED)
- CASE_RETURN_STR(BTAV_CONNECTION_STATE_DISCONNECTING)
- default:
- return "UNKNOWN MSG ID";
- }
-}
const char* dump_adapter_scan_mode(bt_scan_mode_t mode)
{