OSDN Git Service

Pairing with dissapeard HID decive never times out (in UI)
authorKim Schulz <k.schulz@samsung.com>
Mon, 30 Sep 2013 08:55:52 +0000 (10:55 +0200)
committerZhihai Xu <zhihaixu@google.com>
Tue, 3 Dec 2013 23:18:48 +0000 (15:18 -0800)
- added function to notify the UI about failed HID pairing

patch set2:
- added function header

patch set3:
- break long line

Bug: 10998578
Change-Id: I7314bf07da7ebac7252c6902d987fbca20da2abc

btif/src/btif_dm.c
btif/src/btif_hh.c

index b2e80d3..3baee2b 100644 (file)
@@ -1936,6 +1936,25 @@ bt_status_t btif_dm_cancel_bond(const bt_bdaddr_t *bd_addr)
 
 /*******************************************************************************
 **
+** Function         btif_dm_hh_open_failed
+**
+** Description      informs the upper layers if the HH have failed during bonding
+**
+** Returns          none
+**
+*******************************************************************************/
+
+void btif_dm_hh_open_failed(bt_bdaddr_t *bdaddr)
+{
+    if (pairing_cb.state == BT_BOND_STATE_BONDING &&
+            bdcmp(bdaddr->address, pairing_cb.bd_addr) == 0)
+    {
+        bond_state_changed(BT_STATUS_FAIL, bdaddr, BT_BOND_STATE_NONE);
+    }
+}
+
+/*******************************************************************************
+**
 ** Function         btif_dm_remove_bond
 **
 ** Description      Removes bonding with the specified device
index 1c64e3e..ee7277d 100644 (file)
@@ -159,6 +159,7 @@ extern BOOLEAN check_cod(const bt_bdaddr_t *remote_bdaddr, uint32_t cod);
 extern void btif_dm_cb_remove_bond(bt_bdaddr_t *bd_addr);
 extern BOOLEAN check_cod_hid(const bt_bdaddr_t *remote_bdaddr, uint32_t cod);
 extern int  scru_ascii_2_hex(char *p_ascii, int len, UINT8 *p_hex);
+extern void btif_dm_hh_open_failed(bt_bdaddr_t *bdaddr);
 
 /*****************************************************************************
 **  Local Function prototypes
@@ -842,6 +843,7 @@ static void btif_hh_upstreams_evt(UINT16 event, char* p_param)
             }
             else {
                 bt_bdaddr_t *bdaddr = (bt_bdaddr_t*)p_data->conn.bda;
+                btif_dm_hh_open_failed(bdaddr);
                 HAL_CBACK(bt_hh_callbacks, connection_state_cb, (bt_bdaddr_t*) &p_data->conn.bda,BTHH_CONN_STATE_DISCONNECTED);
                 btif_hh_cb.status = BTIF_HH_DEV_DISCONNECTED;
             }