summaryrefslogtreecommitdiffstats
path: root/btif/src/btif_pan.c
diff options
context:
space:
mode:
Diffstat (limited to 'btif/src/btif_pan.c')
-rw-r--r--btif/src/btif_pan.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/btif/src/btif_pan.c b/btif/src/btif_pan.c
index 4a1f000..1aa882b 100644
--- a/btif/src/btif_pan.c
+++ b/btif/src/btif_pan.c
@@ -268,6 +268,31 @@ static bt_status_t btpan_connect(const bt_bdaddr_t *bd_addr, int local_role, int
BTA_PanOpen((UINT8*)bd_addr->address, bta_local_role, bta_remote_role);
return BT_STATUS_SUCCESS;
}
+static void btif_in_pan_generic_evt(UINT16 event, char *p_param)
+{
+ BTIF_TRACE_EVENT2("%s: event=%d", __FUNCTION__, event);
+ switch (event) {
+ case BTIF_PAN_CB_DISCONNECTING:
+ {
+ bt_bdaddr_t *bd_addr = (bt_bdaddr_t*)p_param;
+ btpan_conn_t* conn = btpan_find_conn_addr(bd_addr->address);
+ int btpan_conn_local_role;
+ int btpan_remote_role;
+ asrt(conn != NULL);
+ if (conn) {
+ btpan_conn_local_role = bta_role_to_btpan(conn->local_role);
+ btpan_remote_role = bta_role_to_btpan(conn->remote_role);
+ callback.connection_state_cb(BTPAN_STATE_DISCONNECTING, BT_STATUS_SUCCESS,
+ (const bt_bdaddr_t*)conn->peer, btpan_conn_local_role, btpan_remote_role);
+ }
+ } break;
+ default:
+ {
+ BTIF_TRACE_WARNING2("%s : Unknown event 0x%x", __FUNCTION__, event);
+ }
+ break;
+ }
+}
static bt_status_t btpan_disconnect(const bt_bdaddr_t *bd_addr)
{
debug("in");
@@ -275,6 +300,9 @@ static bt_status_t btpan_disconnect(const bt_bdaddr_t *bd_addr)
if(conn && conn->handle >= 0)
{
BTA_PanClose(conn->handle);
+ /* Inform the application that the disconnect has been initiated successfully */
+ btif_transfer_context(btif_in_pan_generic_evt, BTIF_PAN_CB_DISCONNECTING,
+ (char *)bd_addr, sizeof(bt_bdaddr_t), NULL);
return BT_STATUS_SUCCESS;
}
return BT_STATUS_FAIL;