LE: Add is_connected() function (2/3)
Change-Id: I73c4ea7f13982bf9c208996f9c749d2dfbe698be
diff --git a/bta/dm/bta_dm_api.c b/bta/dm/bta_dm_api.c
index 92af9c7..798ef96 100644
--- a/bta/dm/bta_dm_api.c
+++ b/bta/dm/bta_dm_api.c
@@ -1092,6 +1092,22 @@
}
/*******************************************************************************
+**
+** Function BTA_DmGetConnectionState
+**
+** Description Returns whether the remote device is currently connected.
+**
+** Returns 0 if the device is NOT connected.
+**
+*******************************************************************************/
+UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr )
+{
+ tBTA_DM_PEER_DEVICE * p_dev = bta_dm_find_peer_device(bd_addr);
+ return (p_dev && p_dev->conn_state == BTA_DM_CONNECTED);
+}
+
+
+/*******************************************************************************
** Device Identification (DI) Server Functions
*******************************************************************************/
/*******************************************************************************
diff --git a/bta/include/bta_api.h b/bta/include/bta_api.h
index 0b7d960..1035bac 100644
--- a/bta/include/bta_api.h
+++ b/bta/include/bta_api.h
@@ -1724,6 +1724,17 @@
*******************************************************************************/
BTA_API extern BOOLEAN BTA_DmUseSsr( BD_ADDR bd_addr );
+/*******************************************************************************
+**
+** Function BTA_DmGetConnectionState
+**
+** Description Returns whether the remote device is currently connected.
+**
+** Returns 0 if the device is NOT connected.
+**
+*******************************************************************************/
+BTA_API extern UINT16 BTA_DmGetConnectionState( BD_ADDR bd_addr );
+
/*******************************************************************************
**