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

Commit 8c24eaed authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Andre Eisenbach
Browse files

Add handle range to BTA_GATTC_GetGattDb

Change-Id: Iaf0280853278a4f28dde5b952b646096cfb12d97
parent a6fe83c6
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -522,9 +522,10 @@ tBTA_GATT_STATUS BTA_GATTC_GetNextIncludedService(UINT16 conn_id,
**                  count: number of elements in database.
**
*******************************************************************************/
void  BTA_GATTC_GetGattDb(UINT16 conn_id, btgatt_db_element_t **db, int *count)
void  BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
                          btgatt_db_element_t **db, int *count)
{
    bta_gattc_get_gatt_db(conn_id, db, count);
    bta_gattc_get_gatt_db(conn_id, start_handle, end_handle, db, count);
}

/*******************************************************************************
+15 −2
Original line number Diff line number Diff line
@@ -1427,6 +1427,7 @@ void bta_gattc_fill_gatt_db_el(btgatt_db_element_t *p_attr,
**
*******************************************************************************/
static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
                                       UINT16 start_handle, UINT16 end_handle,
                                       btgatt_db_element_t **db,
                                       int *count)
{
@@ -1444,6 +1445,12 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
         sn != list_end(p_srvc_cb->p_srvc_cache); sn = list_next(sn)) {
        tBTA_GATTC_CACHE *p_cur_srvc = list_node(sn);

        if (p_cur_srvc->s_handle < start_handle)
            continue;

        if (p_cur_srvc->e_handle > end_handle)
            break;

        db_size++;
        if (p_cur_srvc->p_attr)
            db_size += list_length(p_cur_srvc->p_attr);
@@ -1456,6 +1463,12 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
         sn != list_end(p_srvc_cb->p_srvc_cache); sn = list_next(sn)) {
        tBTA_GATTC_CACHE *p_cur_srvc = list_node(sn);

        if (p_cur_srvc->s_handle < start_handle)
            continue;

        if (p_cur_srvc->e_handle > end_handle)
            break;

        bta_gattc_fill_gatt_db_el(curr_db_attr,
                                  p_cur_srvc->service_uuid.is_primary ?
                                      BTGATT_DB_PRIMARY_SERVICE :
@@ -1530,7 +1543,7 @@ static void bta_gattc_get_gatt_db_impl(tBTA_GATTC_SERV *p_srvc_cb,
** Returns          None.
**
*******************************************************************************/
void bta_gattc_get_gatt_db(UINT16 conn_id, btgatt_db_element_t **db, int *count)
void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count)
{
    tBTA_GATTC_CLCB *p_clcb = bta_gattc_find_clcb_by_conn_id(conn_id);

@@ -1551,7 +1564,7 @@ void bta_gattc_get_gatt_db(UINT16 conn_id, btgatt_db_element_t **db, int *count)
        APPL_TRACE_ERROR("No server cache available");
    }

    bta_gattc_get_gatt_db_impl(p_clcb->p_srcb, db, count);
    bta_gattc_get_gatt_db_impl(p_clcb->p_srcb, start_handle, end_handle, db, count);
}

/*******************************************************************************
+1 −1
Original line number Diff line number Diff line
@@ -536,7 +536,7 @@ extern void bta_gattc_search_service(tBTA_GATTC_CLCB *p_clcb, tBT_UUID *p_uuid);
extern tBTA_GATT_STATUS bta_gattc_query_cache(UINT16 conn_id, UINT8 query_type, tBTA_GATT_SRVC_ID *p_srvc_id,
                                              tBTA_GATT_ID *p_start_rec,tBT_UUID *p_uuid_cond,
                                              tBTA_GATT_ID *p_output, void *p_param);
extern void bta_gattc_get_gatt_db(UINT16 conn_id, btgatt_db_element_t **db, int *count);
extern void bta_gattc_get_gatt_db(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle, btgatt_db_element_t **db, int *count);
extern tBTA_GATT_STATUS bta_gattc_init_cache(tBTA_GATTC_SERV *p_srvc_cb);
extern void bta_gattc_rebuild_cache(tBTA_GATTC_SERV *p_srcv, UINT16 num_attr, tBTA_GATTC_NV_ATTR *p_attr, UINT16 attr_index);
extern BOOLEAN bta_gattc_cache_save(tBTA_GATTC_SERV *p_srvc_cb, UINT16 conn_id);
+2 −1
Original line number Diff line number Diff line
@@ -894,7 +894,8 @@ extern tBTA_GATT_STATUS BTA_GATTC_GetNextIncludedService(UINT16 conn_id,
**                  count: number of elements in db.
**
*******************************************************************************/
extern void BTA_GATTC_GetGattDb(UINT16 conn_id, btgatt_db_element_t **db, int *count);
extern void BTA_GATTC_GetGattDb(UINT16 conn_id, UINT16 start_handle, UINT16 end_handle,
                                btgatt_db_element_t **db, int *count);

/*******************************************************************************
**
+1 −1
Original line number Diff line number Diff line
@@ -1366,7 +1366,7 @@ static void btgattc_handle_event(uint16_t event, char* p_param)
        {
            btgatt_db_element_t *db = NULL;
            int count = 0;
            BTA_GATTC_GetGattDb(p_cb->conn_id, &db, &count);
            BTA_GATTC_GetGattDb(p_cb->conn_id, 0x0000, 0xFFFF, &db, &count);

            HAL_CBACK(bt_gatt_callbacks, client->get_gatt_db_cb,
                p_cb->conn_id, db, count);