mirror of
https://github.com/espressif/esp-idf.git
synced 2025-11-26 12:50:30 +00:00
component/bt: add new demo for Bluetooth SDP client
1. add Bluetooth SDP client demo; 2. some minor typo fixes
This commit is contained in:
@@ -299,7 +299,7 @@ UINT32 SDP_CreateRecord (void)
|
||||
p_db->record[p_db->num_records].record_handle = handle;
|
||||
|
||||
p_db->num_records++;
|
||||
SDP_TRACE_DEBUG("SDP_CreateRecord ok, num_records:%d", p_db->num_records);
|
||||
SDP_TRACE_DEBUG("SDP_CreateRecord ok, num_records:%d\n", p_db->num_records);
|
||||
/* Add the first attribute (the handle) automatically */
|
||||
UINT32_TO_BE_FIELD (buf, handle);
|
||||
SDP_AddAttribute (handle, ATTR_ID_SERVICE_RECORD_HDL, UINT_DESC_TYPE,
|
||||
@@ -307,7 +307,7 @@ UINT32 SDP_CreateRecord (void)
|
||||
|
||||
return (p_db->record[p_db->num_records - 1].record_handle);
|
||||
}
|
||||
else SDP_TRACE_ERROR("SDP_CreateRecord fail, exceed maximum records:%d", SDP_MAX_RECORDS);
|
||||
else SDP_TRACE_ERROR("SDP_CreateRecord fail, exceed maximum records:%d\n", SDP_MAX_RECORDS);
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
@@ -361,7 +361,7 @@ BOOLEAN SDP_DeleteRecord (UINT32 handle)
|
||||
|
||||
sdp_cb.server_db.num_records--;
|
||||
|
||||
SDP_TRACE_DEBUG("SDP_DeleteRecord ok, num_records:%d", sdp_cb.server_db.num_records);
|
||||
SDP_TRACE_DEBUG("SDP_DeleteRecord ok, num_records:%d\n", sdp_cb.server_db.num_records);
|
||||
/* if we're deleting the primary DI record, clear the */
|
||||
/* value in the control block */
|
||||
if( sdp_cb.server_db.di_primary_handle == handle )
|
||||
@@ -417,17 +417,17 @@ BOOLEAN SDP_AddAttribute (UINT32 handle, UINT16 attr_id, UINT8 attr_type,
|
||||
{
|
||||
sprintf((char *)&num_array[i*2],"%02X",(UINT8)(p_val[i]));
|
||||
}
|
||||
SDP_TRACE_DEBUG("SDP_AddAttribute: handle:%X, id:%04X, type:%d, len:%d, p_val:%p, *p_val:%s",
|
||||
SDP_TRACE_DEBUG("SDP_AddAttribute: handle:%X, id:%04X, type:%d, len:%d, p_val:%p, *p_val:%s\n",
|
||||
handle,attr_id,attr_type,attr_len,p_val,num_array);
|
||||
}
|
||||
else if (attr_type == BOOLEAN_DESC_TYPE)
|
||||
{
|
||||
SDP_TRACE_DEBUG("SDP_AddAttribute: handle:%X, id:%04X, type:%d, len:%d, p_val:%p, *p_val:%d",
|
||||
SDP_TRACE_DEBUG("SDP_AddAttribute: handle:%X, id:%04X, type:%d, len:%d, p_val:%p, *p_val:%d\n",
|
||||
handle,attr_id,attr_type,attr_len,p_val,*p_val);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDP_TRACE_DEBUG("SDP_AddAttribute: handle:%X, id:%04X, type:%d, len:%d, p_val:%p, *p_val:%s",
|
||||
SDP_TRACE_DEBUG("SDP_AddAttribute: handle:%X, id:%04X, type:%d, len:%d, p_val:%p, *p_val:%s\n",
|
||||
handle,attr_id,attr_type,attr_len,p_val,p_val);
|
||||
}
|
||||
}
|
||||
@@ -475,7 +475,7 @@ BOOLEAN SDP_AddAttribute (UINT32 handle, UINT16 attr_id, UINT8 attr_type,
|
||||
/* do truncate only for text string type descriptor */
|
||||
if (attr_type == TEXT_STR_DESC_TYPE)
|
||||
{
|
||||
SDP_TRACE_WARNING("SDP_AddAttribute: attr_len:%d too long. truncate to (%d)",
|
||||
SDP_TRACE_WARNING("SDP_AddAttribute: attr_len:%d too long. truncate to (%d)\n",
|
||||
attr_len, SDP_MAX_PAD_LEN - p_rec->free_pad_ptr );
|
||||
|
||||
attr_len = SDP_MAX_PAD_LEN - p_rec->free_pad_ptr;
|
||||
@@ -496,7 +496,7 @@ BOOLEAN SDP_AddAttribute (UINT32 handle, UINT16 attr_id, UINT8 attr_type,
|
||||
else if ((attr_len == 0 && p_attr->len != 0) || /* if truncate to 0 length, simply don't add */
|
||||
p_val == 0)
|
||||
{
|
||||
SDP_TRACE_ERROR("SDP_AddAttribute fail, length exceed maximum: ID %d: attr_len:%d ",
|
||||
SDP_TRACE_ERROR("SDP_AddAttribute fail, length exceed maximum: ID %d: attr_len:%d \n",
|
||||
attr_id, attr_len );
|
||||
p_attr->id = p_attr->type = p_attr->len = 0;
|
||||
return (FALSE);
|
||||
@@ -536,7 +536,7 @@ BOOLEAN SDP_AddSequence (UINT32 handle, UINT16 attr_id, UINT16 num_elem,
|
||||
|
||||
if ((p_buff = (UINT8 *) GKI_getbuf(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2)) == NULL)
|
||||
{
|
||||
SDP_TRACE_ERROR("SDP_AddSequence cannot get a buffer!");
|
||||
SDP_TRACE_ERROR("SDP_AddSequence cannot get a buffer!\n");
|
||||
return (FALSE);
|
||||
}
|
||||
p = p_buff;
|
||||
@@ -577,12 +577,12 @@ BOOLEAN SDP_AddSequence (UINT32 handle, UINT16 attr_id, UINT16 num_elem,
|
||||
if(p_head == p_buff)
|
||||
{
|
||||
/* the first element exceed the max length */
|
||||
SDP_TRACE_ERROR ("SDP_AddSequence - too long(attribute is not added)!!");
|
||||
SDP_TRACE_ERROR ("SDP_AddSequence - too long(attribute is not added)!!\n");
|
||||
GKI_freebuf(p_buff);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
SDP_TRACE_ERROR ("SDP_AddSequence - too long, add %d elements of %d", xx, num_elem);
|
||||
SDP_TRACE_ERROR ("SDP_AddSequence - too long, add %d elements of %d\n", xx, num_elem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -619,7 +619,7 @@ BOOLEAN SDP_AddUuidSequence (UINT32 handle, UINT16 attr_id, UINT16 num_uuids,
|
||||
|
||||
if ((p_buff = (UINT8 *) GKI_getbuf(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2)) == NULL)
|
||||
{
|
||||
SDP_TRACE_ERROR("SDP_AddUuidSequence cannot get a buffer!");
|
||||
SDP_TRACE_ERROR("SDP_AddUuidSequence cannot get a buffer!\n");
|
||||
return (FALSE);
|
||||
}
|
||||
p = p_buff;
|
||||
@@ -632,7 +632,7 @@ BOOLEAN SDP_AddUuidSequence (UINT32 handle, UINT16 attr_id, UINT16 num_uuids,
|
||||
|
||||
if((p - p_buff) > max_len)
|
||||
{
|
||||
SDP_TRACE_WARNING ("SDP_AddUuidSequence - too long, add %d uuids of %d", xx, num_uuids);
|
||||
SDP_TRACE_WARNING ("SDP_AddUuidSequence - too long, add %d uuids of %d\n", xx, num_uuids);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -667,7 +667,7 @@ BOOLEAN SDP_AddProtocolList (UINT32 handle, UINT16 num_elem,
|
||||
|
||||
if ((p_buff = (UINT8 *) GKI_getbuf(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2)) == NULL)
|
||||
{
|
||||
SDP_TRACE_ERROR("SDP_AddProtocolList cannot get a buffer!");
|
||||
SDP_TRACE_ERROR("SDP_AddProtocolList cannot get a buffer!\n");
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
@@ -706,7 +706,7 @@ BOOLEAN SDP_AddAdditionProtoLists (UINT32 handle, UINT16 num_elem,
|
||||
|
||||
if ((p_buff = (UINT8 *) GKI_getbuf(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2)) == NULL)
|
||||
{
|
||||
SDP_TRACE_ERROR("SDP_AddAdditionProtoLists cannot get a buffer!");
|
||||
SDP_TRACE_ERROR("SDP_AddAdditionProtoLists cannot get a buffer!\n");
|
||||
return (FALSE);
|
||||
}
|
||||
p = p_buff;
|
||||
@@ -755,7 +755,7 @@ BOOLEAN SDP_AddProfileDescriptorList (UINT32 handle, UINT16 profile_uuid,
|
||||
|
||||
if ((p_buff = (UINT8 *) GKI_getbuf(sizeof(UINT8) * SDP_MAX_ATTR_LEN)) == NULL)
|
||||
{
|
||||
SDP_TRACE_ERROR("SDP_AddProfileDescriptorList cannot get a buffer!");
|
||||
SDP_TRACE_ERROR("SDP_AddProfileDescriptorList cannot get a buffer!\n");
|
||||
return (FALSE);
|
||||
}
|
||||
p = p_buff+2;
|
||||
@@ -804,7 +804,7 @@ BOOLEAN SDP_AddLanguageBaseAttrIDList (UINT32 handle, UINT16 lang,
|
||||
|
||||
if ((p_buff = (UINT8 *) GKI_getbuf(sizeof(UINT8) * SDP_MAX_ATTR_LEN)) == NULL)
|
||||
{
|
||||
SDP_TRACE_ERROR("SDP_AddLanguageBaseAttrIDList cannot get a buffer!");
|
||||
SDP_TRACE_ERROR("SDP_AddLanguageBaseAttrIDList cannot get a buffer!\n");
|
||||
return (FALSE);
|
||||
}
|
||||
p = p_buff;
|
||||
@@ -853,7 +853,7 @@ BOOLEAN SDP_AddServiceClassIdList (UINT32 handle, UINT16 num_services,
|
||||
|
||||
if ((p_buff = (UINT8 *) GKI_getbuf(sizeof(UINT8) * SDP_MAX_ATTR_LEN * 2)) == NULL)
|
||||
{
|
||||
SDP_TRACE_ERROR("SDP_AddServiceClassIdList cannot get a buffer!");
|
||||
SDP_TRACE_ERROR("SDP_AddServiceClassIdList cannot get a buffer!\n");
|
||||
return (FALSE);
|
||||
}
|
||||
p = p_buff;
|
||||
@@ -899,7 +899,7 @@ BOOLEAN SDP_DeleteAttribute (UINT32 handle, UINT16 attr_id)
|
||||
{
|
||||
tSDP_ATTRIBUTE *p_attr = &p_rec->attribute[0];
|
||||
|
||||
SDP_TRACE_API("Deleting attr_id 0x%04x for handle 0x%x", attr_id, handle);
|
||||
SDP_TRACE_API("Deleting attr_id 0x%04x for handle 0x%x\n", attr_id, handle);
|
||||
/* Found it. Now, find the attribute */
|
||||
for (xx = 0; xx < p_rec->num_attributes; xx++, p_attr++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user