Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a13191e authored by Andre Eisenbach's avatar Andre Eisenbach
Browse files

LE: Add is_connected() function (2/3)

Change-Id: I73c4ea7f13982bf9c208996f9c749d2dfbe698be
parent f5e7138c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1091,6 +1091,22 @@ BOOLEAN BTA_DmUseSsr( BD_ADDR bd_addr )
    return use_ssr;
}

/*******************************************************************************
**
** 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
*******************************************************************************/
+11 −0
Original line number Diff line number Diff line
@@ -1634,6 +1634,17 @@ BTA_API extern void BTA_GetEirService( UINT8 *p_eir, tBTA_SERVICE_MASK *p_servic
*******************************************************************************/
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 );


/*******************************************************************************
**
+11 −0
Original line number Diff line number Diff line
@@ -230,6 +230,17 @@ bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr);
*******************************************************************************/
bt_status_t btif_dm_remove_bond(const bt_bdaddr_t *bd_addr);

/*******************************************************************************
**
** Function         btif_dm_get_connection_state
**
** Description      Returns whether the remote device is currently connected
**
** Returns          0 if not connected
**
*******************************************************************************/
uint16_t btif_dm_get_connection_state(const bt_bdaddr_t *bd_addr);

/*******************************************************************************
**
** Function         btif_dm_pin_reply
+10 −0
Original line number Diff line number Diff line
@@ -289,6 +289,15 @@ static int remove_bond(const bt_bdaddr_t *bd_addr)
    return btif_dm_remove_bond(bd_addr);
}

static int get_connection_state(const bt_bdaddr_t *bd_addr)
{
    /* sanity check */
    if (interface_ready() == FALSE)
        return 0;

    return btif_dm_get_connection_state(bd_addr);
}

static int pin_reply(const bt_bdaddr_t *bd_addr, uint8_t accept,
                 uint8_t pin_len, bt_pin_code_t *pin_code)
{
@@ -426,6 +435,7 @@ static const bt_interface_t bluetoothInterface = {
    create_bond,
    remove_bond,
    cancel_bond,
    get_connection_state,
    pin_reply,
    ssp_reply,
    get_profile_interface,
+14 −0
Original line number Diff line number Diff line
@@ -552,6 +552,20 @@ void btif_dm_cb_remove_bond(bt_bdaddr_t *bd_addr)
    }
}

/*******************************************************************************
**
** Function         btif_dm_get_connection_state
**
** Description      Returns whether the remote device is currently connected
**
** Returns          0 if not connected
**
*******************************************************************************/
uint16_t btif_dm_get_connection_state(const bt_bdaddr_t *bd_addr)
{
    return BTA_DmGetConnectionState((UINT8 *)bd_addr->address);
}

/*******************************************************************************
**
** Function         search_devices_copy_cb