diff options
| author | jacqueline <me@jacqueline.id.au> | 2025-07-25 13:33:07 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2025-07-25 13:33:07 +1000 |
| commit | c8e79a926620e48830778714cfe4b2ea2453fcaf (patch) | |
| tree | 8c756e08e01b8e147cf72bec128026f46bd854c5 /lib/bt/host/bluedroid/stack/gatt | |
| parent | 237136f3e93cb6b5be24670d7520adb17cc0fa36 (diff) | |
| download | tangara-fw-c8e79a926620e48830778714cfe4b2ea2453fcaf.tar.gz | |
Update forked idf components
Diffstat (limited to 'lib/bt/host/bluedroid/stack/gatt')
| -rw-r--r-- | lib/bt/host/bluedroid/stack/gatt/gatt_api.c | 28 | ||||
| -rw-r--r-- | lib/bt/host/bluedroid/stack/gatt/gatt_db.c | 44 | ||||
| -rw-r--r-- | lib/bt/host/bluedroid/stack/gatt/gatt_main.c | 12 | ||||
| -rw-r--r-- | lib/bt/host/bluedroid/stack/gatt/gatt_sr.c | 25 | ||||
| -rw-r--r-- | lib/bt/host/bluedroid/stack/gatt/gatt_sr_hash.c | 1 | ||||
| -rw-r--r-- | lib/bt/host/bluedroid/stack/gatt/gatt_utils.c | 42 | ||||
| -rw-r--r-- | lib/bt/host/bluedroid/stack/gatt/include/gatt_int.h | 9 |
7 files changed, 92 insertions, 69 deletions
diff --git a/lib/bt/host/bluedroid/stack/gatt/gatt_api.c b/lib/bt/host/bluedroid/stack/gatt/gatt_api.c index 8d8056f6..51e46e22 100644 --- a/lib/bt/host/bluedroid/stack/gatt/gatt_api.c +++ b/lib/bt/host/bluedroid/stack/gatt/gatt_api.c @@ -75,7 +75,7 @@ UINT8 GATT_SetTraceLevel (UINT8 new_level) ** ** Function GATTS_AddHandleRange ** -** Description This function add the allocated handles range for the specifed +** Description This function add the allocated handles range for the specified ** application UUID, service UUID and service instance ** ** Parameter p_hndl_range: pointer to allocated handles information @@ -105,7 +105,7 @@ BOOLEAN GATTS_AddHandleRange(tGATTS_HNDL_RANGE *p_hndl_range) ** NV save callback function. There can be one and only one ** NV save callback function. ** -** Parameter p_cb_info : callback informaiton +** Parameter p_cb_info : callback information ** ** Returns TRUE if registered OK, else FALSE ** @@ -151,7 +151,7 @@ static void gatt_update_for_database_change(void) ** num_handles : number of handles needed by the service. ** is_pri : is a primary service or not. ** -** Returns service handle if sucessful, otherwise 0. +** Returns service handle if successful, otherwise 0. ** *******************************************************************************/ UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, @@ -170,7 +170,7 @@ UINT16 GATTS_CreateService (tGATT_IF gatt_if, tBT_UUID *p_svc_uuid, GATT_TRACE_API ("GATTS_CreateService\n" ); if (p_reg == NULL) { - GATT_TRACE_ERROR ("Inavlid gatt_if=%d\n", gatt_if); + GATT_TRACE_ERROR ("Invalid gatt_if=%d\n", gatt_if); return (0); } @@ -491,7 +491,7 @@ tGATT_STATUS GATTS_StartService (tGATT_IF gatt_if, UINT16 service_handle, return GATT_SERVICE_STARTED; } - /*this is a new application servoce start */ + /*this is a new application service start */ if ((i_sreg = gatt_sr_alloc_rcb(p_list)) == GATT_MAX_SR_PROFILES) { GATT_TRACE_ERROR ("GATTS_StartService: no free server registration block"); return GATT_NO_RESOURCES; @@ -1388,8 +1388,9 @@ void GATT_Deregister (tGATT_IF gatt_if) } } } - +#if (tGATT_BG_CONN_DEV == TRUE) gatt_deregister_bgdev_list(gatt_if); +#endif // #if (tGATT_BG_CONN_DEV == TRUE) /* update the listen mode */ #if (defined(BLE_PERIPHERAL_MODE_SUPPORT) && (BLE_PERIPHERAL_MODE_SUPPORT == TRUE)) GATT_Listen(gatt_if, FALSE, NULL); @@ -1468,9 +1469,12 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_ if (is_direct) { status = gatt_act_connect (p_reg, bd_addr, bd_addr_type, transport, is_aux); } else { +#if (tGATT_BG_CONN_DEV == TRUE) if (transport == BT_TRANSPORT_LE) { status = gatt_update_auto_connect_dev(gatt_if, TRUE, bd_addr, TRUE); - } else { + } else +#endif // #if (tGATT_BG_CONN_DEV == TRUE) + { GATT_TRACE_ERROR("Unsupported transport for background connection"); } } @@ -1483,7 +1487,7 @@ BOOLEAN GATT_Connect (tGATT_IF gatt_if, BD_ADDR bd_addr, tBLE_ADDR_TYPE bd_addr_ ** ** Function GATT_CancelConnect ** -** Description This function terminate the connection initaition to a remote +** Description This function terminate the connection initiation to a remote ** device on GATT channel. ** ** Parameters gatt_if: client interface. If 0 used as unconditionally disconnect, @@ -1527,6 +1531,7 @@ BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct status = gatt_cancel_open(gatt_if, bd_addr); } } else { +#if (tGATT_BG_CONN_DEV == TRUE) if (!gatt_if) { if (gatt_get_num_apps_for_bg_dev(bd_addr)) { while (gatt_find_app_for_bg_dev(bd_addr, &temp_gatt_if)) { @@ -1539,6 +1544,7 @@ BOOLEAN GATT_CancelConnect (tGATT_IF gatt_if, BD_ADDR bd_addr, BOOLEAN is_direct } else { status = gatt_remove_bg_dev_for_app(gatt_if, bd_addr); } +#endif // #if (tGATT_BG_CONN_DEV == TRUE) } return status; @@ -1628,7 +1634,7 @@ tGATT_STATUS GATT_SendServiceChangeIndication (BD_ADDR bd_addr) ** ** Function GATT_GetConnectionInfor ** -** Description This function use conn_id to find its associated BD address and applciation +** Description This function use conn_id to find its associated BD address and application ** interface ** ** Parameters conn_id: connection id (input) @@ -1665,7 +1671,7 @@ BOOLEAN GATT_GetConnectionInfor(UINT16 conn_id, tGATT_IF *p_gatt_if, BD_ADDR bd_ ** Function GATT_GetConnIdIfConnected ** ** Description This function find the conn_id if the logical link for BD address -** and applciation interface is connected +** and application interface is connected ** ** Parameters gatt_if: application interface (input) ** bd_addr: peer device address. (input) @@ -1720,7 +1726,9 @@ BOOLEAN GATT_Listen (tGATT_IF gatt_if, BOOLEAN start, BD_ADDR_PTR bd_addr) } if (bd_addr != NULL) { +#if (tGATT_BG_CONN_DEV == TRUE) gatt_update_auto_connect_dev(gatt_if, start, bd_addr, FALSE); +#endif // #if (tGATT_BG_CONN_DEV == TRUE) } else { p_reg->listening = start ? GATT_LISTEN_TO_ALL : GATT_LISTEN_TO_NONE; } diff --git a/lib/bt/host/bluedroid/stack/gatt/gatt_db.c b/lib/bt/host/bluedroid/stack/gatt/gatt_db.c index efae6413..8844ef5d 100644 --- a/lib/bt/host/bluedroid/stack/gatt/gatt_db.c +++ b/lib/bt/host/bluedroid/stack/gatt/gatt_db.c @@ -60,7 +60,7 @@ static BOOLEAN gatts_add_char_desc_value_check (tGATT_ATTR_VAL *attr_val, tGATTS ** Parameter p_db: database pointer. ** len: size of the memory space. ** -** Returns Status of te operation. +** Returns Status of the operation. ** *******************************************************************************/ BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN is_pri, @@ -94,7 +94,7 @@ BOOLEAN gatts_init_service_db (tGATT_SVC_DB *p_db, tBT_UUID *p_service, BOOLEAN ** Parameter p_db: database pointer. ** len: size of the memory space. ** -** Returns Status of te operation. +** Returns Status of the operation. ** *******************************************************************************/ tBT_UUID *gatts_get_service_uuid (tGATT_SVC_DB *p_db) @@ -497,14 +497,14 @@ UINT16 gatts_add_included_service (tGATT_SVC_DB *p_db, UINT16 s_handle, UINT16 e ** Function gatts_add_characteristic ** ** Description This function add a characteristics and its descriptor into -** a servce identified by the service database pointer. +** a service identified by the service database pointer. ** ** Parameter p_db: database pointer. ** perm: permission (authentication and key size requirements) ** property: property of the characteristic. ** p_char: characteristic value information. ** -** Returns Status of te operation. +** Returns Status of the operation. ** *******************************************************************************/ UINT16 gatts_add_characteristic (tGATT_SVC_DB *p_db, tGATT_PERM perm, @@ -1173,40 +1173,40 @@ tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, UINT8 op_code, if ((op_code == GATT_SIGN_CMD_WRITE) && !(perm & GATT_WRITE_SIGNED_PERM)) { status = GATT_WRITE_NOT_PERMIT; - GATT_TRACE_DEBUG( "gatts_write_attr_perm_check - sign cmd write not allowed,handle:0x%04x",handle); + GATT_TRACE_DEBUG( "gatts_write_attr_perm_check - sign cmd write not allowed,handle %04x,perm %04x", handle, perm); } if ((op_code == GATT_SIGN_CMD_WRITE) && (sec_flag & GATT_SEC_FLAG_ENCRYPTED)) { status = GATT_INVALID_PDU; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - Error!! sign cmd write sent on a encypted link,handle:0x%04x",handle); + GATT_TRACE_ERROR( "gatts_write_attr_perm_check - Error!! sign cmd write sent on a encrypted link,handle %04x,perm %04x", handle, perm); } else if (!(perm & GATT_WRITE_ALLOWED)) { status = GATT_WRITE_NOT_PERMIT; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_WRITE_NOT_PERMIT,handle:0x%04x",handle); + GATT_TRACE_ERROR("gatts_write_attr_perm_check - GATT_WRITE_NOT_PERMIT,handle %04x, perm %04x", handle, perm); } /* require authentication, but not been authenticated */ else if ((perm & GATT_WRITE_AUTH_REQUIRED ) && !(sec_flag & GATT_SEC_FLAG_LKEY_UNAUTHED)) { status = GATT_INSUF_AUTHENTICATION; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_AUTHENTICATION,handle:0x%04x",handle); + GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_AUTHENTICATION,handle %04x, perm %04x", handle, perm); } else if ((perm & GATT_WRITE_MITM_REQUIRED ) && !(sec_flag & GATT_SEC_FLAG_LKEY_AUTHED)) { status = GATT_INSUF_AUTHENTICATION; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_AUTHENTICATION: MITM required,handle:0x%04x",handle); + GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_AUTHENTICATION: MITM required,handle %04x,perm %04x", handle, perm); } else if ((perm & GATT_WRITE_ENCRYPTED_PERM ) && !(sec_flag & GATT_SEC_FLAG_ENCRYPTED)) { status = GATT_INSUF_ENCRYPTION; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_ENCRYPTION,handle:0x%04x",handle); + GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_ENCRYPTION,handle:0x%04x, perm:0x%04x", handle, perm); } else if ((perm & GATT_WRITE_ENCRYPTED_PERM ) && (sec_flag & GATT_SEC_FLAG_ENCRYPTED) && (key_size < min_key_size)) { status = GATT_INSUF_KEY_SIZE; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_KEY_SIZE,handle:0x%04x",handle); + GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_KEY_SIZE,handle %04x,perm %04x", handle, perm); } /* LE Authorization check*/ else if ((perm & GATT_WRITE_AUTHORIZATION) && (!(sec_flag & GATT_SEC_FLAG_LKEY_AUTHED) || !(sec_flag & GATT_SEC_FLAG_AUTHORIZATION))){ status = GATT_INSUF_AUTHORIZATION; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_AUTHORIZATION,handle:0x%04x",handle); + GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_AUTHORIZATION,handle %04x,perm %04x", handle, perm); } /* LE security mode 2 attribute */ else if (perm & GATT_WRITE_SIGNED_PERM && op_code != GATT_SIGN_CMD_WRITE && !(sec_flag & GATT_SEC_FLAG_ENCRYPTED) && (perm & GATT_WRITE_ALLOWED) == 0) { status = GATT_INSUF_AUTHENTICATION; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_AUTHENTICATION: LE security mode 2 required,handle:0x%04x",handle); - } else { /* writable: must be char value declaration or char descritpors */ + GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INSUF_AUTHENTICATION: LE security mode 2 required,handle %04x,perm %04x", handle, perm); + } else { /* writable: must be char value declaration or char descriptors */ if (p_attr->uuid_type == GATT_ATTR_UUID_TYPE_16) { switch (p_attr->uuid) { case GATT_UUID_CHAR_PRESENT_FORMAT:/* should be readable only */ @@ -1215,13 +1215,19 @@ tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, UINT8 op_code, case GATT_UUID_CHAR_VALID_RANGE: status = GATT_WRITE_NOT_PERMIT; break; - + case GATT_UUID_GAP_ICON:/* The Appearance characteristic value shall be 2 octets in length */ case GATT_UUID_CHAR_CLIENT_CONFIG: /* coverity[MISSING_BREAK] */ /* intnended fall through, ignored */ /* fall through */ case GATT_UUID_CHAR_SRVR_CONFIG: max_size = 2; + status = GATT_SUCCESS; + break; + case GATT_UUID_CLIENT_SUP_FEAT: + max_size = 1; + status = GATT_SUCCESS; + break; case GATT_UUID_CHAR_DESCRIPTION: default: /* any other must be character value declaration */ status = GATT_SUCCESS; @@ -1242,17 +1248,17 @@ tGATT_STATUS gatts_write_attr_perm_check (tGATT_SVC_DB *p_db, UINT8 op_code, else if ( (p_attr->uuid_type == GATT_ATTR_UUID_TYPE_16) && (p_attr->uuid == GATT_UUID_CHAR_CLIENT_CONFIG || p_attr->uuid == GATT_UUID_CHAR_SRVR_CONFIG || - p_attr->uuid == GATT_UUID_CLIENT_SUP_FEAT || + p_attr->uuid == GATT_UUID_CLIENT_SUP_FEAT || p_attr->uuid == GATT_UUID_GAP_ICON ) ) // btla-specific -- { if (op_code == GATT_REQ_PREPARE_WRITE) { /* does not allow write blob */ status = GATT_REQ_NOT_SUPPORTED; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_REQ_NOT_SUPPORTED,handle:0x%04x",handle); + GATT_TRACE_ERROR("gatts_write_attr_perm_check - GATT_REQ_NOT_SUPPORTED,handle %04x,opcode %4x", handle, op_code); } else if (len != max_size) { /* data does not match the required format */ status = GATT_INVALID_ATTR_LEN; - GATT_TRACE_ERROR( "gatts_write_attr_perm_check - GATT_INVALID_ATTR_LEN,handle:0x%04x",handle); + GATT_TRACE_ERROR("gatts_write_attr_perm_check - GATT_INVALID_ATTR_LEN,handle %04x,op_code %04x,len %d,max_size %d", handle, op_code, len, max_size); } else { status = GATT_SUCCESS; } @@ -1554,7 +1560,7 @@ static BOOLEAN gatts_db_add_service_declaration(tGATT_SVC_DB *p_db, tBT_UUID *p_ uuid.uu.uuid16 = GATT_UUID_SEC_SERVICE; } - /* add service declration record */ + /* add service declaration record */ if ((p_attr = (tGATT_ATTR16 *)(allocate_attr_in_db(p_db, &uuid, GATT_PERM_READ))) != NULL) { if (copy_extra_byte_in_db (p_db, (void **)&p_attr->p_value, sizeof(tBT_UUID))) { if (p_service->len == LEN_UUID_16) { diff --git a/lib/bt/host/bluedroid/stack/gatt/gatt_main.c b/lib/bt/host/bluedroid/stack/gatt/gatt_main.c index d76aefe9..53d9be74 100644 --- a/lib/bt/host/bluedroid/stack/gatt/gatt_main.c +++ b/lib/bt/host/bluedroid/stack/gatt/gatt_main.c @@ -502,7 +502,7 @@ static void gatt_le_connect_cback (UINT16 chan, BD_ADDR bd_addr, BOOLEAN connect #endif ///GATTS_INCLUDED == TRUE } } else { - GATT_TRACE_ERROR("CCB max out, no rsources"); + GATT_TRACE_ERROR("CCB max out, no resources"); } } } else { @@ -929,18 +929,23 @@ static void gatt_send_conn_cback(tGATT_TCB *p_tcb) { UINT8 i; tGATT_REG *p_reg; +#if (tGATT_BG_CONN_DEV == TRUE) tGATT_BG_CONN_DEV *p_bg_dev = NULL; +#endif // #if (tGATT_BG_CONN_DEV == TRUE) UINT16 conn_id; +#if (tGATT_BG_CONN_DEV == TRUE) p_bg_dev = gatt_find_bg_dev(p_tcb->peer_bda); +#endif // #if (tGATT_BG_CONN_DEV == TRUE) /* notifying all applications for the connection up event */ for (i = 0, p_reg = gatt_cb.cl_rcb ; i < GATT_MAX_APPS; i++, p_reg++) { if (p_reg->in_use) { +#if (tGATT_BG_CONN_DEV == TRUE) if (p_bg_dev && gatt_is_bg_dev_for_app(p_bg_dev, p_reg->gatt_if)) { gatt_update_app_use_link_flag(p_reg->gatt_if, p_tcb, TRUE, TRUE); } - +#endif // #if (tGATT_BG_CONN_DEV == TRUE) if (p_reg->app_cb.p_conn_cb) { conn_id = GATT_CREATE_CONN_ID(p_tcb->tcb_idx, p_reg->gatt_if); (*p_reg->app_cb.p_conn_cb)(p_reg->gatt_if, p_tcb->peer_bda, conn_id, @@ -1239,7 +1244,8 @@ uint8_t gatt_tcb_active_count(void) for(p_node = list_begin(gatt_cb.p_tcb_list); p_node; p_node = list_next(p_node)) { p_tcb = list_node(p_node); - if (p_tcb && p_tcb->in_use && (p_tcb->ch_state != GATT_CH_CLOSE)) { + if (p_tcb && p_tcb->in_use && (p_tcb->transport == BT_TRANSPORT_LE) && + (p_tcb->ch_state != GATT_CH_CLOSE)) { count++; } } diff --git a/lib/bt/host/bluedroid/stack/gatt/gatt_sr.c b/lib/bt/host/bluedroid/stack/gatt/gatt_sr.c index 79e161c1..5947239c 100644 --- a/lib/bt/host/bluedroid/stack/gatt/gatt_sr.c +++ b/lib/bt/host/bluedroid/stack/gatt/gatt_sr.c @@ -200,7 +200,7 @@ static BOOLEAN process_read_multi_rsp (tGATT_SR_CMD *p_cmd, tGATT_STATUS status, *p++ = GATT_RSP_READ_MULTI; p_buf->len = 1; - /* Now walk through the buffers puting the data into the response in order */ + /* Now walk through the buffers putting the data into the response in order */ list_t *list = NULL; const list_node_t *node = NULL; if (! fixed_queue_is_empty(p_cmd->multi_rsp_q)) { @@ -321,7 +321,7 @@ static BOOLEAN process_read_multi_var_rsp (tGATT_SR_CMD *p_cmd, tGATT_STATUS sta *p++ = GATT_RSP_READ_MULTI_VAR; p_buf->len = 1; - /* Now walk through the buffers puting the data into the response in order */ + /* Now walk through the buffers putting the data into the response in order */ list_t *list = NULL; const list_node_t *node = NULL; if (! fixed_queue_is_empty(p_cmd->multi_rsp_q)) { @@ -735,7 +735,7 @@ static tGATT_STATUS gatt_build_primary_service_rsp (BT_HDR *p_msg, tGATT_TCB *p_ handle_len = 4 + p_uuid->len; } - /* get the length byte in the repsonse */ + /* get the length byte in the response */ if (p_msg->offset == 0) { *p ++ = op_code + 1; p_msg->len ++; @@ -788,7 +788,7 @@ static tGATT_STATUS gatt_build_primary_service_rsp (BT_HDR *p_msg, tGATT_TCB *p_ ** buffer. ** ** Returns TRUE: if data filled successfully. -** FALSE: packet full, or format mismatch. +** FALSE: packet full. ** *******************************************************************************/ static tGATT_STATUS gatt_build_find_info_rsp(tGATT_SR_REG *p_rcb, BT_HDR *p_msg, UINT16 *p_len, @@ -831,10 +831,9 @@ static tGATT_STATUS gatt_build_find_info_rsp(tGATT_SR_REG *p_rcb, BT_HDR *p_msg, gatt_convert_uuid32_to_uuid128(p, ((tGATT_ATTR32 *) p_attr)->uuid); p += LEN_UUID_128; } else { - GATT_TRACE_ERROR("format mismatch"); - status = GATT_NO_RESOURCES; + // UUID format mismatch in sequential attributes + // A new request will be sent with the starting handle of the next attribute break; - /* format mismatch */ } p_msg->len += info_pair_len[p_msg->offset - 1]; len -= info_pair_len[p_msg->offset - 1]; @@ -889,7 +888,7 @@ static tGATT_STATUS gatts_validate_packet_format(UINT8 op_code, UINT16 *p_len, /* parse uuid now */ if (gatt_parse_uuid_from_cmd (p_uuid_filter, uuid_len, &p) == FALSE || p_uuid_filter->len == 0) { - GATT_TRACE_DEBUG("UUID filter does not exsit"); + GATT_TRACE_DEBUG("UUID filter does not exist"); reason = GATT_INVALID_PDU; } else { len -= p_uuid_filter->len; @@ -1042,7 +1041,7 @@ static void gatts_process_find_info(tGATT_TCB *p_tcb, UINT8 op_code, UINT16 len, ** ** Function gatts_process_mtu_req ** -** Description This function is called to process excahnge MTU request. +** Description This function is called to process exchange MTU request. ** Only used on LE. ** ** Returns void @@ -1055,7 +1054,7 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data) BT_HDR *p_buf; UINT16 conn_id; - /* BR/EDR conenction, send error response */ + /* BR/EDR connection, send error response */ if (p_tcb->att_lcid != L2CAP_ATT_CID) { gatt_send_error_rsp (p_tcb, GATT_REQ_NOT_SUPPORTED, GATT_REQ_MTU, 0, FALSE); } else if (len < GATT_MTU_REQ_MIN_LEN) { @@ -1081,7 +1080,7 @@ static void gatts_process_mtu_req (tGATT_TCB *p_tcb, UINT16 len, UINT8 *p_data) attp_send_sr_msg (p_tcb, p_buf); /* Notify all registered application with new MTU size. Us a transaction ID */ - /* of 0, as no response is allowed from applcations */ + /* of 0, as no response is allowed from applications */ for (i = 0; i < GATT_MAX_APPS; i ++) { if (gatt_cb.cl_rcb[i].in_use ) { @@ -1448,7 +1447,7 @@ void gatt_attr_process_prepare_write (tGATT_TCB *p_tcb, UINT8 i_rcb, UINT16 hand } if ((prepare_record->error_code_app == GATT_SUCCESS) - // update prepare write status for excute write request + // update prepare write status for execute write request && (status == GATT_INVALID_OFFSET || status == GATT_INVALID_ATTR_LEN || status == GATT_REQ_NOT_SUPPORTED)) { prepare_record->error_code_app = status; } @@ -1855,7 +1854,7 @@ void gatt_server_handle_client_req (tGATT_TCB *p_tcb, UINT8 op_code, gatts_process_primary_service_req (p_tcb, op_code, len, p_data); break; - case GATT_REQ_FIND_INFO: /* discover char descrptor */ + case GATT_REQ_FIND_INFO: /* discover char descriptor */ gatts_process_find_info(p_tcb, op_code, len, p_data); break; diff --git a/lib/bt/host/bluedroid/stack/gatt/gatt_sr_hash.c b/lib/bt/host/bluedroid/stack/gatt/gatt_sr_hash.c index 79d09d7a..d5a4b3a5 100644 --- a/lib/bt/host/bluedroid/stack/gatt/gatt_sr_hash.c +++ b/lib/bt/host/bluedroid/stack/gatt/gatt_sr_hash.c @@ -189,7 +189,6 @@ tGATT_STATUS gatts_calculate_datebase_hash(BT_OCTET16 hash) #if SMP_INCLUDED == TRUE BT_OCTET16 key = {0}; aes_cipher_msg_auth_code(key, data_buf, len, 16, hash); - //ESP_LOG_BUFFER_HEX("db hash", hash, BT_OCTET16_LEN); #endif osi_free(data_buf); diff --git a/lib/bt/host/bluedroid/stack/gatt/gatt_utils.c b/lib/bt/host/bluedroid/stack/gatt/gatt_utils.c index 621b2468..0644ab70 100644 --- a/lib/bt/host/bluedroid/stack/gatt/gatt_utils.c +++ b/lib/bt/host/bluedroid/stack/gatt/gatt_utils.c @@ -108,7 +108,7 @@ void gatt_free_pending_ind(tGATT_TCB *p_tcb) ** ** Function gatt_free_pending_enc_queue ** -** Description Free all buffers in pending encyption queue +** Description Free all buffers in pending encryption queue ** ** Returns None ** @@ -222,7 +222,7 @@ void gatt_set_srv_chg(void) ** ** Description Find the app id in on the new service changed list ** -** Returns Pointer to the found new service changed item othwerwise NULL +** Returns Pointer to the found new service changed item otherwise NULL ** *******************************************************************************/ tGATTS_PENDING_NEW_SRV_START *gatt_sr_is_new_srv_chg(tBT_UUID *p_app_uuid128, tBT_UUID *p_svc_uuid, UINT16 svc_inst) @@ -299,7 +299,7 @@ tGATTS_PENDING_NEW_SRV_START *gatt_add_pending_new_srv_start(tGATTS_HNDL_RANGE * ** ** Function gatt_add_srv_chg_clt ** -** Description Add a service chnage client to the service change client queue +** Description Add a service change client to the service change client queue ** ** Returns Pointer to the service change client buffer; Null no buffer available ** @@ -682,7 +682,7 @@ BOOLEAN gatt_remove_a_srv_from_list(tGATT_SRV_LIST_INFO *p_list, tGATT_SRV_LIST_ ** ** Function gatt_add_an_item_to_list ** -** Description add an service handle range to the list in decending +** Description add an service handle range to the list in descending ** order of the start handle ** ** Returns BOOLEAN TRUE-if add is successful @@ -808,7 +808,7 @@ BOOLEAN gatt_find_the_connected_bda(UINT8 start_idx, BD_ADDR bda, UINT8 *p_found ** ** Function gatt_is_srv_chg_ind_pending ** -** Description Check whether a service chnaged is in the indication pending queue +** Description Check whether a service changed is in the indication pending queue ** or waiting for an Ack already ** ** Returns BOOLEAN @@ -846,9 +846,9 @@ BOOLEAN gatt_is_srv_chg_ind_pending (tGATT_TCB *p_tcb) ** ** Function gatt_is_bda_in_the_srv_chg_clt_list ** -** Description This function check the specified bda is in the srv chg clinet list or not +** Description This function check the specified bda is in the srv chg client list or not ** -** Returns pointer to the found elemenet otherwise NULL +** Returns pointer to the found element otherwise NULL ** *******************************************************************************/ tGATTS_SRV_CHG *gatt_is_bda_in_the_srv_chg_clt_list (BD_ADDR bda) @@ -1205,7 +1205,7 @@ UINT8 gatt_build_uuid_to_stream(UINT8 **p_dst, tBT_UUID uuid) if (uuid.len == LEN_UUID_16) { UINT16_TO_STREAM (p, uuid.uu.uuid16); len = LEN_UUID_16; - } else if (uuid.len == LEN_UUID_32) { /* always convert 32 bits into 128 bits as alwats */ + } else if (uuid.len == LEN_UUID_32) { /* always convert 32 bits into 128 bits as always */ gatt_convert_uuid32_to_uuid128(p, uuid.uu.uuid32); p += LEN_UUID_128; len = LEN_UUID_128; @@ -1465,7 +1465,7 @@ UINT8 gatt_sr_alloc_rcb(tGATT_HDL_LIST_ELEM *p_list ) UINT8 ii = 0; tGATT_SR_REG *p_sreg = NULL; - /*this is a new application servoce start */ + /*this is a new application service start */ for (ii = 0, p_sreg = gatt_cb.sr_reg; ii < GATT_MAX_SR_PROFILES; ii++, p_sreg++) { if (!p_sreg->in_use) { memset (p_sreg, 0, sizeof(tGATT_SR_REG)); @@ -1616,7 +1616,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl) break; default: - GATT_TRACE_ERROR("inavlid UUID len=%d", p_uuid->len); + GATT_TRACE_ERROR("invalid UUID len=%d", p_uuid->len); SDP_DeleteRecord(sdp_handle); return 0; break; @@ -1633,7 +1633,7 @@ UINT32 gatt_add_sdp_record (tBT_UUID *p_uuid, UINT16 start_hdl, UINT16 end_hdl) SDP_AddProtocolList(sdp_handle, 2, proto_elem_list); - /* Make the service browseable */ + /* Make the service browsable */ SDP_AddUuidSequence (sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &list); return (sdp_handle); @@ -1868,7 +1868,7 @@ UINT8 gatt_num_apps_hold_link(tGATT_TCB *p_tcb) ** ** Function gatt_num_clcb_by_bd_addr ** -** Description The function searches all LCB with macthing bd address +** Description The function searches all LCB with matching bd address ** ** Returns total number of clcb found. ** @@ -1892,7 +1892,7 @@ UINT8 gatt_num_clcb_by_bd_addr(BD_ADDR bda) ** ** Function gatt_sr_update_cback_cnt ** -** Description The function searches all LCB with macthing bd address +** Description The function searches all LCB with matching bd address ** ** Returns total number of clcb found. ** @@ -1916,7 +1916,7 @@ void gatt_sr_copy_prep_cnt_to_cback_cnt(tGATT_TCB *p_tcb ) ** ** Function gatt_sr_is_cback_cnt_zero ** -** Description The function searches all LCB with macthing bd address +** Description The function searches all LCB with matching bd address ** ** Returns True if thetotal application callback count is zero ** @@ -2015,7 +2015,7 @@ void gatt_sr_reset_prep_cnt(tGATT_TCB *p_tcb ) ** ** Function gatt_sr_update_cback_cnt ** -** Description Update the teh application callback count +** Description Update the the application callback count ** ** Returns None ** @@ -2045,7 +2045,7 @@ void gatt_sr_update_cback_cnt(tGATT_TCB *p_tcb, tGATT_IF gatt_if, BOOLEAN is_inc ** ** Function gatt_sr_update_prep_cnt ** -** Description Update the teh prepare write request count +** Description Update the the prepare write request count ** ** Returns None ** @@ -2461,7 +2461,7 @@ void gatt_dbg_display_uuid(tBT_UUID bt_uuid) } - +#if (tGATT_BG_CONN_DEV == TRUE) /******************************************************************************* ** ** Function gatt_is_bg_dev_for_app @@ -2552,7 +2552,7 @@ BOOLEAN gatt_add_bg_dev_list(tGATT_REG *p_reg, BD_ADDR bd_addr, BOOLEAN is_init for (i = 0; i < GATT_MAX_APPS; i ++) { if (is_initator) { if (p_dev->gatt_if[i] == gatt_if) { - GATT_TRACE_ERROR("device already in iniator white list"); + GATT_TRACE_ERROR("device already in initiator white list"); return TRUE; } else if (p_dev->gatt_if[i] == 0) { p_dev->gatt_if[i] = gatt_if; @@ -2618,9 +2618,9 @@ BOOLEAN gatt_remove_bg_dev_for_app(tGATT_IF gatt_if, BD_ADDR bd_addr) ** ** Function gatt_get_num_apps_for_bg_dev ** -** Description Gte the number of applciations for the specified background device +** Description Gte the number of applications for the specified background device ** -** Returns UINT8 total number fo applications +** Returns UINT8 total number for applications ** *******************************************************************************/ UINT8 gatt_get_num_apps_for_bg_dev(BD_ADDR bd_addr) @@ -2842,7 +2842,7 @@ BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_ } return ret; } - +#endif // #if (tGATT_BG_CONN_DEV == TRUE) /******************************************************************************* diff --git a/lib/bt/host/bluedroid/stack/gatt/include/gatt_int.h b/lib/bt/host/bluedroid/stack/gatt/include/gatt_int.h index 1161da62..f9d3cd8e 100644 --- a/lib/bt/host/bluedroid/stack/gatt/include/gatt_int.h +++ b/lib/bt/host/bluedroid/stack/gatt/include/gatt_int.h @@ -130,7 +130,7 @@ typedef union { tGATT_EXEC_FLAG exec_write; /* execute write */ } tGATT_CL_MSG; -/* error response strucutre */ +/* error response structure */ typedef struct { UINT16 handle; UINT8 cmd_code; @@ -480,12 +480,14 @@ typedef struct { UINT32 service_change; } tGATT_SVC_CHG; +#if (tGATT_BG_CONN_DEV == TRUE) typedef struct { tGATT_IF gatt_if[GATT_MAX_APPS]; tGATT_IF listen_gif[GATT_MAX_APPS]; BD_ADDR remote_bda; BOOLEAN in_use; } tGATT_BG_CONN_DEV; +#endif // #if (tGATT_BG_CONN_DEV == TRUE) #define GATT_SVC_CHANGED_CONNECTING 1 /* wait for connection */ #define GATT_SVC_CHANGED_SERVICE 2 /* GATT service discovery */ @@ -553,8 +555,9 @@ typedef struct { tGATT_HDL_CFG hdl_cfg; +#if (tGATT_BG_CONN_DEV == TRUE) tGATT_BG_CONN_DEV bgconn_dev[GATT_MAX_BG_CONN_DEV]; - +#endif // #if (tGATT_BG_CONN_DEV == TRUE) BOOLEAN auto_disc; /* internal use: true for auto discovering after connected */ UINT8 srv_chg_mode; /* internal use: service change mode */ tGATTS_RSP rsp; /* use to read internal service attribute */ @@ -667,6 +670,7 @@ extern BOOLEAN gatt_add_an_item_to_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_L extern BOOLEAN gatt_remove_an_item_from_list(tGATT_HDL_LIST_INFO *p_list, tGATT_HDL_LIST_ELEM *p_remove); extern tGATTS_SRV_CHG *gatt_add_srv_chg_clt(tGATTS_SRV_CHG *p_srv_chg); +#if (tGATT_BG_CONN_DEV == TRUE) /* for background connection */ extern BOOLEAN gatt_update_auto_connect_dev (tGATT_IF gatt_if, BOOLEAN add, BD_ADDR bd_addr, BOOLEAN is_initiator); extern BOOLEAN gatt_is_bg_dev_for_app(tGATT_BG_CONN_DEV *p_dev, tGATT_IF gatt_if); @@ -676,6 +680,7 @@ extern BOOLEAN gatt_find_app_for_bg_dev(BD_ADDR bd_addr, tGATT_IF *p_gatt_if); extern tGATT_BG_CONN_DEV *gatt_find_bg_dev(BD_ADDR remote_bda); extern void gatt_deregister_bgdev_list(tGATT_IF gatt_if); extern void gatt_reset_bgdev_list(void); +#endif // #if (tGATT_BG_CONN_DEV == TRUE) /* server function */ extern UINT8 gatt_sr_find_i_rcb_by_handle(UINT16 handle); |
