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

Commit 48868156 authored by Chaojing Sun's avatar Chaojing Sun Committed by Andre Eisenbach
Browse files

Cache HOGP HID report map

HID reports from a bonded device can be missed when Bluetooth is
restarted HOGP report discovery is still active. Caching the
report information and loading it back when the stack resets
will ensure incoming HID reports can be processed immediately.

Bug: 17999991
Change-Id: I4608935f8749537d6b05625b894445a21f844ee0
parent aedf56c6
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1702,7 +1702,7 @@ void bta_gattc_ci_load(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
}
/*******************************************************************************
**
** Function         bta_gattc_ci_load
** Function         bta_gattc_ci_save
**
** Description      cache loading received.
**
+8 −11
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ typedef struct
                                           hi 4 for service instance ID, low 4 as charatceristic instance ID */
    tBTA_HH_RPT_TYPE        rpt_type;
    UINT16                  uuid;
    UINT16				    prop;
    UINT8                   prop;
    UINT8                   rpt_id;
    BOOLEAN                 client_cfg_exist;
    UINT16                  client_cfg_value;
@@ -218,10 +218,6 @@ typedef struct
    BOOLEAN                 expl_incl_srvc;
    UINT8                   incl_srvc_inst; /* assuming only one included service : battery service */
    UINT8                   cur_expl_char_idx; /* currently discovering service index */

#define BTA_HH_LE_REMOTE_WAKE   0x01
#define BTA_HH_LE_NORMAL_CONN   0x02
    UINT8                   flag;           /* HID Information flag */
    UINT8                   *rpt_map;
    UINT16                  ext_rpt_ref;
    tBTA_HH_DEV_DESCR       descriptor;
@@ -408,6 +404,7 @@ extern void bta_hh_start_security(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_security_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_le_update_scpp(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);
extern void bta_hh_le_notify_enc_cmpl(tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_data);
extern void bta_hh_ci_load_rpt (tBTA_HH_DEV_CB *p_cb, tBTA_HH_DATA *p_buf);

#if BTA_HH_DEBUG
extern void bta_hh_trace_dev_db(void);
+158 −23

File changed.

Preview size limit exceeded, changes collapsed.

system/bta/include/bta_hh_co.h

100644 → 100755
+62 −0
Original line number Diff line number Diff line
@@ -26,6 +26,14 @@

#include "bta_hh_api.h"

typedef struct
{
    UINT16              rpt_uuid;
    UINT8               rpt_id;
    tBTA_HH_RPT_TYPE    rpt_type;
    UINT8               inst_id;
    UINT8               prop;
}tBTA_HH_RPT_CACHE_ENTRY;

/*******************************************************************************
**
@@ -68,5 +76,59 @@ BTA_API extern void bta_hh_co_open(UINT8 dev_handle, UINT8 sub_class,
*******************************************************************************/
BTA_API extern void bta_hh_co_close(UINT8 dev_handle, UINT8 app_id);

#if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE)
/*******************************************************************************
**
** Function         bta_hh_le_co_rpt_info
**
** Description      This callout function is to convey the report information on
**                  a HOGP device to the application. Application can save this
**                  information in NV if device is bonded and load it back when
**                  stack reboot.
**
** Parameters       remote_bda  - remote device address
**                  p_entry     - report entry pointer
**                  app_id      - application id
**
** Returns          void.
**
*******************************************************************************/
BTA_API extern void bta_hh_le_co_rpt_info(BD_ADDR remote_bda,
                                          tBTA_HH_RPT_CACHE_ENTRY *p_entry,
                                          UINT8 app_id);

/*******************************************************************************
**
** Function         bta_hh_le_co_cache_load
**
** Description      This callout function is to request the application to load the
**                  cached HOGP report if there is any. When cache reading is completed,
**                  bta_hh_le_ci_cache_load() is called by the application.
**
** Parameters       remote_bda  - remote device address
**                  p_num_rpt: number of cached report
**                  app_id      - application id
**
** Returns          the acched report array
**
*******************************************************************************/
BTA_API extern tBTA_HH_RPT_CACHE_ENTRY *bta_hh_le_co_cache_load (BD_ADDR remote_bda,
                                                                 UINT8 *p_num_rpt,
                                                                 UINT8 app_id);

/*******************************************************************************
**
** Function         bta_hh_le_co_reset_rpt_cache
**
** Description      This callout function is to reset the HOGP device cache.
**
** Parameters       remote_bda  - remote device address
**
** Returns          none
**
*******************************************************************************/
BTA_API extern void bta_hh_le_co_reset_rpt_cache (BD_ADDR remote_bda, UINT8 app_id);

#endif /* #if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE) */
#endif /* BTA_HH_CO_H */
+120 −2

File changed.

Preview size limit exceeded, changes collapsed.

Loading