Component/bt: add gatts send service change indication API

This commit is contained in:
zhiweijian
2018-09-18 16:20:13 +08:00
committed by bot
parent 96cd3b75cd
commit 9fb188a1d9
16 changed files with 288 additions and 40 deletions

View File

@@ -1022,35 +1022,36 @@ void gatt_add_a_bonded_dev_for_srv_chg (BD_ADDR bda)
**
** Function gatt_send_srv_chg_ind
**
** Description This function is called to send a service chnaged indication to
** Description This function is called to send a service changed indication to
** the specified bd address
**
** Returns void
** Returns GATT_SUCCESS if sucessfully sent; otherwise error code
**
*******************************************************************************/
#if (GATTS_INCLUDED == TRUE)
void gatt_send_srv_chg_ind (BD_ADDR peer_bda)
tGATT_STATUS gatt_send_srv_chg_ind (BD_ADDR peer_bda)
{
UINT8 handle_range[GATT_SIZE_OF_SRV_CHG_HNDL_RANGE];
UINT8 *p = handle_range;
UINT16 conn_id;
tGATT_STATUS status = GATT_ERROR;
GATT_TRACE_DEBUG("gatt_send_srv_chg_ind");
if (gatt_cb.handle_of_h_r) {
if ((conn_id = gatt_profile_find_conn_id_by_bd_addr(peer_bda)) != GATT_INVALID_CONN_ID) {
UINT16_TO_STREAM (p, 1);
UINT16_TO_STREAM (p, 0xFFFF);
GATTS_HandleValueIndication (conn_id,
status = GATTS_HandleValueIndication (conn_id,
gatt_cb.handle_of_h_r,
GATT_SIZE_OF_SRV_CHG_HNDL_RANGE,
handle_range);
} else {
GATT_TRACE_ERROR("Unable to find conn_id for %08x%04x ",
(peer_bda[0] << 24) + (peer_bda[1] << 16) + (peer_bda[2] << 8) + peer_bda[3],
(peer_bda[4] << 8) + peer_bda[5] );
status = GATT_NOT_FOUND;
GATT_TRACE_ERROR("Unable to find conn_id for %02x%02x%02x%02x%02x%02x ",
peer_bda[0], peer_bda[1], peer_bda[2], peer_bda[3], peer_bda[4], peer_bda[5]);
}
}
return status;
}
@@ -1058,7 +1059,7 @@ void gatt_send_srv_chg_ind (BD_ADDR peer_bda)
**
** Function gatt_chk_srv_chg
**
** Description Check sending service chnaged Indication is required or not
** Description Check sending service changed Indication is required or not
** if required then send the Indication
**
** Returns void
@@ -1142,7 +1143,7 @@ void gatt_proc_srv_chg (void)
gatt_set_srv_chg();
start_idx = 0;
while (gatt_find_the_connected_bda(start_idx, bda, &found_idx, &transport)) {
p_tcb = &gatt_cb.tcb[found_idx];;
p_tcb = &gatt_cb.tcb[found_idx];
srv_chg_ind_pending = gatt_is_srv_chg_ind_pending(p_tcb);
if (!srv_chg_ind_pending) {