From 2d15803f7057ece1b7ce0d65bbd22b6fcf7ab542 Mon Sep 17 00:00:00 2001 From: wangmengyang Date: Mon, 31 Oct 2016 12:34:11 +0800 Subject: [PATCH] component/bt: add new demo for Bluetooth SDP client 1. add Bluetooth SDP client demo; 2. some minor typo fixes --- components/bt/bluedroid/bta/sdp/bta_sdp_act.c | 34 ++-- components/bt/bluedroid/stack/sdp/sdp_db.c | 38 ++-- .../bt/bluedroid/stack/sdp/sdp_discovery.c | 68 +++---- components/bt/bluedroid/stack/sdp/sdp_main.c | 58 +++--- .../bt/bluedroid/stack/sdp/sdp_server.c | 20 +- components/bt/bluedroid/stack/sdp/sdp_utils.c | 10 +- examples/09_bt_sdp_client/Makefile | 11 ++ examples/09_bt_sdp_client/README.rst | 5 + .../bluedroid_demos/app_core/bt_app_core.c | 175 ++++++++++++++++++ .../app_project/SampleBtSdpClient.c | 124 +++++++++++++ .../components/bluedroid_demos/component.mk | 17 ++ .../bluedroid_demos/include/bt_app_common.h | 30 +++ examples/09_bt_sdp_client/main/component.mk | 10 + examples/09_bt_sdp_client/main/demo_main.c | 28 +++ 14 files changed, 513 insertions(+), 115 deletions(-) create mode 100755 examples/09_bt_sdp_client/Makefile create mode 100755 examples/09_bt_sdp_client/README.rst create mode 100755 examples/09_bt_sdp_client/components/bluedroid_demos/app_core/bt_app_core.c create mode 100644 examples/09_bt_sdp_client/components/bluedroid_demos/app_project/SampleBtSdpClient.c create mode 100755 examples/09_bt_sdp_client/components/bluedroid_demos/component.mk create mode 100755 examples/09_bt_sdp_client/components/bluedroid_demos/include/bt_app_common.h create mode 100755 examples/09_bt_sdp_client/main/component.mk create mode 100755 examples/09_bt_sdp_client/main/demo_main.c diff --git a/components/bt/bluedroid/bta/sdp/bta_sdp_act.c b/components/bt/bluedroid/bta/sdp/bta_sdp_act.c index 21efd21ad..6722163c8 100755 --- a/components/bt/bluedroid/bta/sdp/bta_sdp_act.c +++ b/components/bt/bluedroid/bta/sdp/bta_sdp_act.c @@ -69,7 +69,7 @@ static inline tBT_UUID shorten_sdp_uuid(const tBT_UUID* u) static uint8_t bt_base_uuid[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }; - APPL_TRACE_DEBUG("%s() - uuid len:%d", __func__, u->len); + APPL_TRACE_DEBUG("%s() - uuid len:%d\n", __func__, u->len); if(u->len != 16) return *u; @@ -292,7 +292,7 @@ static void bta_create_ops_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE { if (count == sizeof(record->ops.supported_formats_list)) { APPL_TRACE_ERROR("%s() - supported_formats_list - count overflow - " - "too many sub attributes!!", __func__); + "too many sub attributes!!\n", __func__); /* If you hit this, new formats have been added, * update SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH */ break; @@ -309,7 +309,7 @@ static void bta_create_ops_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_RE if (record->ops.supported_formats_list_len != count) { APPL_TRACE_WARNING("%s() - supported_formats_list - Length of attribute different " "from the actual number of sub-attributes in the sequence " - "att-length: %d - number of elements: %d", __func__, + "att-length: %d - number of elements: %d\n", __func__, record->ops.supported_formats_list_len , count); } @@ -397,7 +397,7 @@ static void bta_sdp_search_cback(UINT16 result, void * user_data) UINT16 uuid16 = 0; int count = 0; tBT_UUID su; - APPL_TRACE_DEBUG("%s() - res: 0x%x", __func__, result); + APPL_TRACE_DEBUG("%s() - res: 0x%x\n", __func__, result); bta_sdp_cb.sdp_active = BTA_SDP_ACTIVE_NONE; @@ -416,24 +416,24 @@ static void bta_sdp_search_cback(UINT16 result, void * user_data) if(p_rec != NULL){ status = BTA_SDP_SUCCESS; if (IS_UUID(UUID_MAP_MAS,uuid->uu.uuid128)) { - APPL_TRACE_DEBUG("%s() - found MAP (MAS) uuid", __func__); + APPL_TRACE_DEBUG("%s() - found MAP (MAS) uuid\n", __func__); bta_create_mas_sdp_record(&evt_data.records[count], p_rec); } else if (IS_UUID(UUID_MAP_MNS,uuid->uu.uuid128)) { - APPL_TRACE_DEBUG("%s() - found MAP (MNS) uuid", __func__); + APPL_TRACE_DEBUG("%s() - found MAP (MNS) uuid\n", __func__); bta_create_mns_sdp_record(&evt_data.records[count], p_rec); } else if (IS_UUID(UUID_PBAP_PSE,uuid->uu.uuid128)){ - APPL_TRACE_DEBUG("%s() - found PBAP (PSE) uuid", __func__); + APPL_TRACE_DEBUG("%s() - found PBAP (PSE) uuid\n", __func__); bta_create_pse_sdp_record(&evt_data.records[count], p_rec); } else if (IS_UUID(UUID_OBEX_OBJECT_PUSH,uuid->uu.uuid128)){ - APPL_TRACE_DEBUG("%s() - found Object Push Server (OPS) uuid", __func__); + APPL_TRACE_DEBUG("%s() - found Object Push Server (OPS) uuid\n", __func__); bta_create_ops_sdp_record(&evt_data.records[count], p_rec); } else if (IS_UUID(UUID_SAP,uuid->uu.uuid128)) { - APPL_TRACE_DEBUG("%s() - found SAP uuid", __func__); + APPL_TRACE_DEBUG("%s() - found SAP uuid\n", __func__); bta_create_sap_sdp_record(&evt_data.records[count], p_rec); } else { /* we do not have specific structure for this */ - APPL_TRACE_DEBUG("%s() - profile not identified. using raw data", __func__); + APPL_TRACE_DEBUG("%s() - profile not identified. using raw data\n", __func__); bta_create_raw_sdp_record(&evt_data.records[count], p_rec); p_rec = NULL; // Terminate loop /* For raw, we only extract the first entry, and then return the entire @@ -444,7 +444,7 @@ static void bta_sdp_search_cback(UINT16 result, void * user_data) } count++; } else { - APPL_TRACE_DEBUG("%s() - UUID not found", __func__); + APPL_TRACE_DEBUG("%s() - UUID not found\n", __func__); } } while (p_rec != NULL && count < BTA_SDP_MAX_RECORDS); @@ -467,7 +467,7 @@ static void bta_sdp_search_cback(UINT16 result, void * user_data) *******************************************************************************/ void bta_sdp_enable(tBTA_SDP_MSG *p_data) { - APPL_TRACE_DEBUG("%s in, sdp_active:%d", __func__, bta_sdp_cb.sdp_active); + APPL_TRACE_DEBUG("%s in, sdp_active:%d\n", __func__, bta_sdp_cb.sdp_active); tBTA_SDP_STATUS status = BTA_SDP_SUCCESS; bta_sdp_cb.p_dm_cback = p_data->enable.p_cback; bta_sdp_cb.p_dm_cback(BTA_SDP_ENABLE_EVT, (tBTA_SDP *)&status, NULL); @@ -489,12 +489,12 @@ void bta_sdp_search(tBTA_SDP_MSG *p_data) tBT_UUID *bta_sdp_search_uuid = osi_malloc(sizeof(tBT_UUID)); if(p_data == NULL) { - APPL_TRACE_DEBUG("SDP control block handle is null"); + APPL_TRACE_DEBUG("SDP control block handle is null\n"); return; } tBTA_SDP_STATUS status = BTA_SDP_FAILURE; - APPL_TRACE_DEBUG("%s in, sdp_active:%d", __func__, bta_sdp_cb.sdp_active); + APPL_TRACE_DEBUG("%s in, sdp_active:%d\n", __func__, bta_sdp_cb.sdp_active); if (bta_sdp_cb.sdp_active != BTA_SDP_ACTIVE_NONE) { @@ -516,7 +516,7 @@ void bta_sdp_search(tBTA_SDP_MSG *p_data) memcpy(bta_sdp_search_uuid, &(p_data->get_search.uuid),sizeof(tBT_UUID)); /* initialize the search for the uuid */ - APPL_TRACE_DEBUG("%s init discovery with UUID(len: %d):", + APPL_TRACE_DEBUG("%s init discovery with UUID(len: %d):\n", __func__, bta_sdp_search_uuid->len); for(x = 0; xlen;x++){ APPL_TRACE_DEBUG("%X",bta_sdp_search_uuid->uu.uuid128[x]); @@ -554,7 +554,7 @@ void bta_sdp_search(tBTA_SDP_MSG *p_data) *******************************************************************************/ void bta_sdp_create_record(tBTA_SDP_MSG *p_data) { - APPL_TRACE_DEBUG("%s() event: %d", __func__, p_data->record.hdr.event); + APPL_TRACE_DEBUG("%s() event: %d\n", __func__, p_data->record.hdr.event); if (bta_sdp_cb.p_dm_cback) bta_sdp_cb.p_dm_cback(BTA_SDP_CREATE_RECORD_USER_EVT, NULL, p_data->record.user_data); } @@ -570,7 +570,7 @@ void bta_sdp_create_record(tBTA_SDP_MSG *p_data) *******************************************************************************/ void bta_sdp_remove_record(tBTA_SDP_MSG *p_data) { - APPL_TRACE_DEBUG("%s() event: %d", __func__, p_data->record.hdr.event); + APPL_TRACE_DEBUG("%s() event: %d\n", __func__, p_data->record.hdr.event); if (bta_sdp_cb.p_dm_cback) bta_sdp_cb.p_dm_cback(BTA_SDP_REMOVE_RECORD_USER_EVT, NULL, p_data->record.user_data); } diff --git a/components/bt/bluedroid/stack/sdp/sdp_db.c b/components/bt/bluedroid/stack/sdp/sdp_db.c index ea8fa8756..8eb680dcd 100755 --- a/components/bt/bluedroid/stack/sdp/sdp_db.c +++ b/components/bt/bluedroid/stack/sdp/sdp_db.c @@ -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++) { diff --git a/components/bt/bluedroid/stack/sdp/sdp_discovery.c b/components/bt/bluedroid/stack/sdp/sdp_discovery.c index 646a62dd3..8e17a28b1 100755 --- a/components/bt/bluedroid/stack/sdp/sdp_discovery.c +++ b/components/bt/bluedroid/stack/sdp/sdp_discovery.c @@ -171,7 +171,7 @@ static void sdp_snd_service_search_req(tCONN_CB *p_ccb, UINT8 cont_len, UINT8 * p_cmd->len = (UINT16)(p - p_start); #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("sdp_snd_service_search_req cont_len :%d disc_state:%d",cont_len, p_ccb->disc_state); + SDP_TRACE_WARNING("sdp_snd_service_search_req cont_len :%d disc_state:%d\n",cont_len, p_ccb->disc_state); #endif @@ -228,7 +228,7 @@ void sdp_disc_server_rsp (tCONN_CB *p_ccb, BT_HDR *p_msg) BOOLEAN invalid_pdu = TRUE; #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("sdp_disc_server_rsp disc_state:%d", p_ccb->disc_state); + SDP_TRACE_WARNING("sdp_disc_server_rsp disc_state:%d\n", p_ccb->disc_state); #endif /* stop inactivity timer when we receive a response */ @@ -270,7 +270,7 @@ void sdp_disc_server_rsp (tCONN_CB *p_ccb, BT_HDR *p_msg) if (invalid_pdu) { - SDP_TRACE_WARNING ("SDP - Unexp. PDU: %d in state: %d", rsp_pdu, p_ccb->disc_state); + SDP_TRACE_WARNING ("SDP - Unexp. PDU: %d in state: %d\n", rsp_pdu, p_ccb->disc_state); sdp_disconnect (p_ccb, SDP_GENERIC_ERROR); } } @@ -300,7 +300,7 @@ static void process_service_search_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) p_ccb->num_handles += cur_handles; if (p_ccb->num_handles == 0) { - SDP_TRACE_WARNING ("SDP - Rcvd ServiceSearchRsp, no matches"); + SDP_TRACE_WARNING ("SDP - Rcvd ServiceSearchRsp, no matches\n"); sdp_disconnect (p_ccb, SDP_NO_RECS_MATCH); return; } @@ -359,9 +359,9 @@ static void sdp_copy_raw_data (tCONN_CB *p_ccb, BOOLEAN offset) for (i = 0; i < p_ccb->list_len; i++) { - sprintf((char *)&num_array[i*2],"%02X",(UINT8)(p_ccb->rsp_list[i])); + sprintf((char *)&num_array[i*2],"%02X\n",(UINT8)(p_ccb->rsp_list[i])); } - SDP_TRACE_WARNING("result :%s",num_array); + SDP_TRACE_WARNING("result :%s\n",num_array); #endif if(p_ccb->p_db->raw_data) @@ -380,7 +380,7 @@ static void sdp_copy_raw_data (tCONN_CB *p_ccb, BOOLEAN offset) cpy_len = list_len; } #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("list_len :%d cpy_len:%d raw_size:%d raw_used:%d", + SDP_TRACE_WARNING("list_len :%d cpy_len:%d raw_size:%d raw_used:%d\n", list_len, cpy_len, p_ccb->p_db->raw_size, p_ccb->p_db->raw_used); #endif memcpy (&p_ccb->p_db->raw_data[p_ccb->p_db->raw_used], p, cpy_len); @@ -406,14 +406,14 @@ static void process_service_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) BOOLEAN cont_request_needed = FALSE; #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("process_service_attr_rsp raw inc:%d", + SDP_TRACE_WARNING("process_service_attr_rsp raw inc:%d\n", SDP_RAW_DATA_INCLUDED); #endif /* If p_reply is NULL, we were called after the records handles were read */ if (p_reply) { #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("ID & len: 0x%02x-%02x-%02x-%02x", + SDP_TRACE_WARNING("ID & len: 0x%02x-%02x-%02x-%02x\n", p_reply[0], p_reply[1], p_reply[2], p_reply[3]); #endif /* Skip transaction ID and length */ @@ -421,7 +421,7 @@ static void process_service_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) BE_STREAM_TO_UINT16 (list_byte_count, p_reply); #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("list_byte_count:%d", list_byte_count); + SDP_TRACE_WARNING("list_byte_count:%d\n", list_byte_count); #endif /* Copy the response to the scratchpad. First, a safety check on the length */ @@ -432,7 +432,7 @@ static void process_service_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) } #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("list_len: %d, list_byte_count: %d", + SDP_TRACE_WARNING("list_len: %d, list_byte_count: %d\n", p_ccb->list_len, list_byte_count); #endif if (p_ccb->rsp_list == NULL) @@ -440,7 +440,7 @@ static void process_service_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) p_ccb->rsp_list = (UINT8 *)GKI_getbuf (SDP_MAX_LIST_BYTE_COUNT); if (p_ccb->rsp_list == NULL) { - SDP_TRACE_ERROR ("SDP - no gki buf to save rsp"); + SDP_TRACE_ERROR ("SDP - no gki buf to save rsp\n"); sdp_disconnect (p_ccb, SDP_NO_RESOURCES); return; } @@ -449,10 +449,10 @@ static void process_service_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) p_ccb->list_len += list_byte_count; p_reply += list_byte_count; #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("list_len: %d(attr_rsp)", p_ccb->list_len); + SDP_TRACE_WARNING("list_len: %d(attr_rsp)\n", p_ccb->list_len); /* Check if we need to request a continuation */ - SDP_TRACE_WARNING("*p_reply:%d(%d)", *p_reply, SDP_MAX_CONTINUATION_LEN); + SDP_TRACE_WARNING("*p_reply:%d(%d)\n", *p_reply, SDP_MAX_CONTINUATION_LEN); #endif if (*p_reply) { @@ -467,7 +467,7 @@ static void process_service_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) { #if (SDP_RAW_DATA_INCLUDED == TRUE) - SDP_TRACE_WARNING("process_service_attr_rsp"); + SDP_TRACE_WARNING("process_service_attr_rsp\n"); sdp_copy_raw_data (p_ccb, FALSE); #endif @@ -566,13 +566,13 @@ static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) BOOLEAN cont_request_needed = FALSE; #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("process_service_search_attr_rsp"); + SDP_TRACE_WARNING("process_service_search_attr_rsp\n"); #endif /* If p_reply is NULL, we were called for the initial read */ if (p_reply) { #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("ID & len: 0x%02x-%02x-%02x-%02x", + SDP_TRACE_WARNING("ID & len: 0x%02x-%02x-%02x-%02x\n", p_reply[0], p_reply[1], p_reply[2], p_reply[3]); #endif /* Skip transaction ID and length */ @@ -580,7 +580,7 @@ static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) BE_STREAM_TO_UINT16 (lists_byte_count, p_reply); #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("lists_byte_count:%d", lists_byte_count); + SDP_TRACE_WARNING("lists_byte_count:%d\n", lists_byte_count); #endif /* Copy the response to the scratchpad. First, a safety check on the length */ @@ -591,7 +591,7 @@ static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) } #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("list_len: %d, list_byte_count: %d", + SDP_TRACE_WARNING("list_len: %d, list_byte_count: %d\n", p_ccb->list_len, lists_byte_count); #endif if (p_ccb->rsp_list == NULL) @@ -599,7 +599,7 @@ static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) p_ccb->rsp_list = (UINT8 *)GKI_getbuf (SDP_MAX_LIST_BYTE_COUNT); if (p_ccb->rsp_list == NULL) { - SDP_TRACE_ERROR ("SDP - no gki buf to save rsp"); + SDP_TRACE_ERROR ("SDP - no gki buf to save rsp\n"); sdp_disconnect (p_ccb, SDP_NO_RESOURCES); return; } @@ -608,10 +608,10 @@ static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) p_ccb->list_len += lists_byte_count; p_reply += lists_byte_count; #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("list_len: %d(search_attr_rsp)", p_ccb->list_len); + SDP_TRACE_WARNING("list_len: %d(search_attr_rsp)\n", p_ccb->list_len); /* Check if we need to request a continuation */ - SDP_TRACE_WARNING("*p_reply:%d(%d)", *p_reply, SDP_MAX_CONTINUATION_LEN); + SDP_TRACE_WARNING("*p_reply:%d(%d)\n", *p_reply, SDP_MAX_CONTINUATION_LEN); #endif if (*p_reply) { @@ -626,7 +626,7 @@ static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) } #if (SDP_DEBUG_RAW == TRUE) - SDP_TRACE_WARNING("cont_request_needed:%d", cont_request_needed); + SDP_TRACE_WARNING("cont_request_needed:%d\n", cont_request_needed); #endif /* If continuation request (or first time request) */ if ((cont_request_needed) || (!p_reply)) @@ -699,7 +699,7 @@ static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) /*******************************************************************/ #if (SDP_RAW_DATA_INCLUDED == TRUE) - SDP_TRACE_WARNING("process_service_search_attr_rsp"); + SDP_TRACE_WARNING("process_service_search_attr_rsp\n"); sdp_copy_raw_data (p_ccb, TRUE); #endif @@ -710,7 +710,7 @@ static void process_service_search_attr_rsp (tCONN_CB *p_ccb, UINT8 *p_reply) if ((type >> 3) != DATA_ELE_SEQ_DESC_TYPE) { - SDP_TRACE_WARNING ("SDP - Wrong type: 0x%02x in attr_rsp", type); + SDP_TRACE_WARNING ("SDP - Wrong type: 0x%02x in attr_rsp\n", type); return; } p = sdpu_get_len_from_type (p, type, &seq_len); @@ -758,14 +758,14 @@ static UINT8 *save_attr_seq (tCONN_CB *p_ccb, UINT8 *p, UINT8 *p_msg_end) if ((type >> 3) != DATA_ELE_SEQ_DESC_TYPE) { - SDP_TRACE_WARNING ("SDP - Wrong type: 0x%02x in attr_rsp", type); + SDP_TRACE_WARNING ("SDP - Wrong type: 0x%02x in attr_rsp\n", type); return (NULL); } p = sdpu_get_len_from_type (p, type, &seq_len); if ((p + seq_len) > p_msg_end) { - SDP_TRACE_WARNING ("SDP - Bad len in attr_rsp %d", seq_len); + SDP_TRACE_WARNING ("SDP - Bad len in attr_rsp %d\n", seq_len); return (NULL); } @@ -773,7 +773,7 @@ static UINT8 *save_attr_seq (tCONN_CB *p_ccb, UINT8 *p, UINT8 *p_msg_end) p_rec = add_record (p_ccb->p_db, p_ccb->device_address); if (!p_rec) { - SDP_TRACE_WARNING ("SDP - DB full add_record"); + SDP_TRACE_WARNING ("SDP - DB full add_record\n"); return (NULL); } @@ -786,7 +786,7 @@ static UINT8 *save_attr_seq (tCONN_CB *p_ccb, UINT8 *p, UINT8 *p_msg_end) p = sdpu_get_len_from_type (p, type, &attr_len); if (((type >> 3) != UINT_DESC_TYPE) || (attr_len != 2)) { - SDP_TRACE_WARNING ("SDP - Bad type: 0x%02x or len: %d in attr_rsp", type, attr_len); + SDP_TRACE_WARNING ("SDP - Bad type: 0x%02x or len: %d in attr_rsp\n", type, attr_len); return (NULL); } BE_STREAM_TO_UINT16 (attr_id, p); @@ -796,7 +796,7 @@ static UINT8 *save_attr_seq (tCONN_CB *p_ccb, UINT8 *p, UINT8 *p_msg_end) if (!p) { - SDP_TRACE_WARNING ("SDP - DB full add_attr"); + SDP_TRACE_WARNING ("SDP - DB full add_attr\n"); return (NULL); } } @@ -916,7 +916,7 @@ static UINT8 *add_attr (UINT8 *p, tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_rec, /* SDP_TRACE_DEBUG ("SDP - attr nest level:%d(list)", nest_level); */ if (nest_level >= MAX_NEST_LEVELS) { - SDP_TRACE_ERROR ("SDP - attr nesting too deep"); + SDP_TRACE_ERROR ("SDP - attr nesting too deep\n"); return (p_end); } @@ -993,7 +993,7 @@ static UINT8 *add_attr (UINT8 *p, tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_rec, } break; default: - SDP_TRACE_WARNING ("SDP - bad len in UUID attr: %d", attr_len); + SDP_TRACE_WARNING ("SDP - bad len in UUID attr: %d\n", attr_len); return (p + attr_len); } break; @@ -1009,7 +1009,7 @@ static UINT8 *add_attr (UINT8 *p, tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_rec, /* SDP_TRACE_DEBUG ("SDP - attr nest level:%d", nest_level); */ if (nest_level >= MAX_NEST_LEVELS) { - SDP_TRACE_ERROR ("SDP - attr nesting too deep"); + SDP_TRACE_ERROR ("SDP - attr nesting too deep\n"); return (p_end); } if(is_additional_list != 0 || attr_id == ATTR_ID_ADDITION_PROTO_DESC_LISTS) @@ -1038,7 +1038,7 @@ static UINT8 *add_attr (UINT8 *p, tSDP_DISCOVERY_DB *p_db, tSDP_DISC_REC *p_rec, p_attr->attr_value.v.u8 = *p++; break; default: - SDP_TRACE_WARNING ("SDP - bad len in boolean attr: %d", attr_len); + SDP_TRACE_WARNING ("SDP - bad len in boolean attr: %d\n", attr_len); return (p + attr_len); } break; diff --git a/components/bt/bluedroid/stack/sdp/sdp_main.c b/components/bt/bluedroid/stack/sdp/sdp_main.c index ba3c763e4..b500f106c 100755 --- a/components/bt/bluedroid/stack/sdp/sdp_main.c +++ b/components/bt/bluedroid/stack/sdp/sdp_main.c @@ -97,7 +97,7 @@ void sdp_init (void) if (!BTM_SetSecurityLevel (FALSE, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER, SDP_SECURITY_LEVEL, SDP_PSM, 0, 0)) { - SDP_TRACE_ERROR ("Security Registration Server failed"); + SDP_TRACE_ERROR ("Security Registration Server failed\n"); return; } #endif @@ -107,7 +107,7 @@ void sdp_init (void) if (!BTM_SetSecurityLevel (TRUE, SDP_SERVICE_NAME, BTM_SEC_SERVICE_SDP_SERVER, SDP_SECURITY_LEVEL, SDP_PSM, 0, 0)) { - SDP_TRACE_ERROR ("Security Registration for Client failed"); + SDP_TRACE_ERROR ("Security Registration for Client failed\n"); return; } #endif @@ -133,7 +133,7 @@ void sdp_init (void) /* Now, register with L2CAP */ if (!L2CA_Register (SDP_PSM, &sdp_cb.reg_info)) { - SDP_TRACE_ERROR ("SDP Registration failed"); + SDP_TRACE_ERROR ("SDP Registration failed\n"); } } @@ -193,7 +193,7 @@ static void sdp_connect_ind (BD_ADDR bd_addr, UINT16 l2cap_cid, UINT16 psm, UIN if (cfg.fcr_present) { - SDP_TRACE_DEBUG("sdp_connect_ind: mode %u, txwinsz %u, max_trans %u, rtrans_tout %u, mon_tout %u, mps %u", + SDP_TRACE_DEBUG("sdp_connect_ind: mode %u, txwinsz %u, max_trans %u, rtrans_tout %u, mon_tout %u, mps %u\n", cfg.fcr.mode, cfg.fcr.tx_win_sz, cfg.fcr.max_transmit, cfg.fcr.rtrans_tout,cfg.fcr.mon_tout, cfg.fcr.mps); } @@ -208,7 +208,7 @@ static void sdp_connect_ind (BD_ADDR bd_addr, UINT16 l2cap_cid, UINT16 psm, UIN } } - SDP_TRACE_EVENT ("SDP - Rcvd L2CAP conn ind, sent config req, CID 0x%x", p_ccb->connection_id); + SDP_TRACE_EVENT ("SDP - Rcvd L2CAP conn ind, sent config req, CID 0x%x\n", p_ccb->connection_id); #else /* No server */ /* Reject the connection */ L2CA_ConnectRsp (bd_addr, l2cap_id, l2cap_cid, L2CAP_CONN_NO_PSM, 0); @@ -235,7 +235,7 @@ static void sdp_connect_cfm (UINT16 l2cap_cid, UINT16 result) /* Find CCB based on CID */ if ((p_ccb = sdpu_find_ccb_by_cid (l2cap_cid)) == NULL) { - SDP_TRACE_WARNING ("SDP - Rcvd conn cnf for unknown CID 0x%x", l2cap_cid); + SDP_TRACE_WARNING ("SDP - Rcvd conn cnf for unknown CID 0x%x\n", l2cap_cid); return; } @@ -249,7 +249,7 @@ static void sdp_connect_cfm (UINT16 l2cap_cid, UINT16 result) if (cfg.fcr_present) { - SDP_TRACE_DEBUG("sdp_connect_cfm: mode %u, txwinsz %u, max_trans %u, rtrans_tout %u, mon_tout %u, mps %u", + SDP_TRACE_DEBUG("sdp_connect_cfm: mode %u, txwinsz %u, max_trans %u, rtrans_tout %u, mon_tout %u, mps %u\n", cfg.fcr.mode, cfg.fcr.tx_win_sz, cfg.fcr.max_transmit, cfg.fcr.rtrans_tout,cfg.fcr.mon_tout, cfg.fcr.mps); } @@ -263,11 +263,11 @@ static void sdp_connect_cfm (UINT16 l2cap_cid, UINT16 result) L2CA_ConfigReq (l2cap_cid, &cfg); } - SDP_TRACE_EVENT ("SDP - got conn cnf, sent cfg req, CID: 0x%x", p_ccb->connection_id); + SDP_TRACE_EVENT ("SDP - got conn cnf, sent cfg req, CID: 0x%x\n", p_ccb->connection_id); } else { - SDP_TRACE_WARNING ("SDP - Rcvd conn cnf with error: 0x%x CID 0x%x", result, p_ccb->connection_id); + SDP_TRACE_WARNING ("SDP - Rcvd conn cnf with error: 0x%x CID 0x%x\n", result, p_ccb->connection_id); /* Tell the user if he has a callback */ if (p_ccb->p_cb || p_ccb->p_cb2) @@ -312,7 +312,7 @@ static void sdp_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg) /* Find CCB based on CID */ if ((p_ccb = sdpu_find_ccb_by_cid (l2cap_cid)) == NULL) { - SDP_TRACE_WARNING ("SDP - Rcvd L2CAP cfg ind, unknown CID: 0x%x", l2cap_cid); + SDP_TRACE_WARNING ("SDP - Rcvd L2CAP cfg ind, unknown CID: 0x%x\n", l2cap_cid); return; } @@ -346,7 +346,7 @@ static void sdp_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg) { p_cfg->fcr.tx_win_sz = sdp_cb.l2cap_my_cfg.fcr.tx_win_sz; p_cfg->result = L2CAP_CFG_UNACCEPTABLE_PARAMS; - SDP_TRACE_DEBUG("sdp_config_ind(CONFIG) -> Please try again with SMALLER TX WINDOW"); + SDP_TRACE_DEBUG("sdp_config_ind(CONFIG) -> Please try again with SMALLER TX WINDOW\n"); } /* Reject if locally we want basic and they don't */ @@ -355,12 +355,12 @@ static void sdp_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg) /* Ask for a new setup */ p_cfg->fcr.mode = L2CAP_FCR_BASIC_MODE; p_cfg->result = L2CAP_CFG_UNACCEPTABLE_PARAMS; - SDP_TRACE_DEBUG("sdp_config_ind(CONFIG) -> Please try again with BASIC mode"); + SDP_TRACE_DEBUG("sdp_config_ind(CONFIG) -> Please try again with BASIC mode\n"); } /* Remain in configure state and give the peer our desired configuration */ if (p_cfg->result != L2CAP_CFG_OK) { - SDP_TRACE_WARNING ("SDP - Rcvd cfg ind, Unacceptable Parameters sent cfg cfm, CID: 0x%x", l2cap_cid); + SDP_TRACE_WARNING ("SDP - Rcvd cfg ind, Unacceptable Parameters sent cfg cfm, CID: 0x%x\n", l2cap_cid); L2CA_ConfigRsp (l2cap_cid, p_cfg); return; } @@ -371,7 +371,7 @@ static void sdp_config_ind (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg) L2CA_ConfigRsp (l2cap_cid, p_cfg); - SDP_TRACE_EVENT ("SDP - Rcvd cfg ind, sent cfg cfm, CID: 0x%x", l2cap_cid); + SDP_TRACE_EVENT ("SDP - Rcvd cfg ind, sent cfg cfm, CID: 0x%x\n", l2cap_cid); p_ccb->con_flags |= SDP_FLAGS_HIS_CFG_DONE; @@ -403,12 +403,12 @@ static void sdp_config_cfm (UINT16 l2cap_cid, tL2CAP_CFG_INFO *p_cfg) { tCONN_CB *p_ccb; - SDP_TRACE_EVENT ("SDP - Rcvd cfg cfm, CID: 0x%x Result: %d", l2cap_cid, p_cfg->result); + SDP_TRACE_EVENT ("SDP - Rcvd cfg cfm, CID: 0x%x Result: %d\n", l2cap_cid, p_cfg->result); /* Find CCB based on CID */ if ((p_ccb = sdpu_find_ccb_by_cid (l2cap_cid)) == NULL) { - SDP_TRACE_WARNING ("SDP - Rcvd L2CAP cfg ind, unknown CID: 0x%x", l2cap_cid); + SDP_TRACE_WARNING ("SDP - Rcvd L2CAP cfg ind, unknown CID: 0x%x\n", l2cap_cid); return; } @@ -464,14 +464,14 @@ static void sdp_disconnect_ind (UINT16 l2cap_cid, BOOLEAN ack_needed) /* Find CCB based on CID */ if ((p_ccb = sdpu_find_ccb_by_cid (l2cap_cid)) == NULL) { - SDP_TRACE_WARNING ("SDP - Rcvd L2CAP disc, unknown CID: 0x%x", l2cap_cid); + SDP_TRACE_WARNING ("SDP - Rcvd L2CAP disc, unknown CID: 0x%x\n", l2cap_cid); return; } if (ack_needed) L2CA_DisconnectRsp (l2cap_cid); - SDP_TRACE_EVENT ("SDP - Rcvd L2CAP disc, CID: 0x%x", l2cap_cid); + SDP_TRACE_EVENT ("SDP - Rcvd L2CAP disc, CID: 0x%x\n", l2cap_cid); #if SDP_CLIENT_ENABLED == TRUE /* Tell the user if he has a callback */ if (p_ccb->p_cb) @@ -516,13 +516,13 @@ static void sdp_data_ind (UINT16 l2cap_cid, BT_HDR *p_msg) } else { - SDP_TRACE_WARNING ("SDP - Ignored L2CAP data while in state: %d, CID: 0x%x", + SDP_TRACE_WARNING ("SDP - Ignored L2CAP data while in state: %d, CID: 0x%x\n", p_ccb->con_state, l2cap_cid); } } else { - SDP_TRACE_WARNING ("SDP - Rcvd L2CAP data, unknown CID: 0x%x", l2cap_cid); + SDP_TRACE_WARNING ("SDP - Rcvd L2CAP data, unknown CID: 0x%x\n", l2cap_cid); } GKI_freebuf (p_msg); @@ -548,11 +548,11 @@ tCONN_CB* sdp_conn_originate (UINT8 *p_bd_addr) /* Allocate a new CCB. Return if none available. */ if ((p_ccb = sdpu_allocate_ccb()) == NULL) { - SDP_TRACE_WARNING ("SDP - no spare CCB for orig"); + SDP_TRACE_WARNING ("SDP - no spare CCB for orig\n"); return (NULL); } - SDP_TRACE_EVENT ("SDP - Originate started"); + SDP_TRACE_EVENT ("SDP - Originate started\n"); /* We are the originator of this connection */ p_ccb->con_flags |= SDP_FLAGS_IS_ORIG; @@ -574,7 +574,7 @@ tCONN_CB* sdp_conn_originate (UINT8 *p_bd_addr) } else { - SDP_TRACE_WARNING ("SDP - Originate failed"); + SDP_TRACE_WARNING ("SDP - Originate failed\n"); sdpu_release_ccb (p_ccb); return (NULL); } @@ -592,7 +592,6 @@ tCONN_CB* sdp_conn_originate (UINT8 *p_bd_addr) void sdp_disconnect (tCONN_CB*p_ccb, UINT16 reason) { #if (defined(SDP_BROWSE_PLUS) && SDP_BROWSE_PLUS == TRUE) - /* If we are browsing for multiple UUIDs ... */ if ((p_ccb->con_state == SDP_STATE_CONNECTED) && (p_ccb->con_flags & SDP_FLAGS_IS_ORIG) @@ -618,7 +617,7 @@ void sdp_disconnect (tCONN_CB*p_ccb, UINT16 reason) p_ccb->cur_handle = 0; - SDP_TRACE_EVENT ("SDP - looking for for more, CID: 0x%x", + SDP_TRACE_EVENT ("SDP - looking for for more, CID: 0x%x\n", p_ccb->connection_id); sdp_disc_connected (p_ccb); @@ -631,7 +630,7 @@ void sdp_disconnect (tCONN_CB*p_ccb, UINT16 reason) #endif - SDP_TRACE_EVENT ("SDP - disconnect CID: 0x%x", p_ccb->connection_id); + SDP_TRACE_EVENT ("SDP - disconnect CID: 0x%x\n", p_ccb->connection_id); /* Check if we have a connection ID */ if (p_ccb->connection_id != 0) @@ -672,12 +671,11 @@ static void sdp_disconnect_cfm (UINT16 l2cap_cid, UINT16 result) /* Find CCB based on CID */ if ((p_ccb = sdpu_find_ccb_by_cid (l2cap_cid)) == NULL) { - SDP_TRACE_WARNING ("SDP - Rcvd L2CAP disc cfm, unknown CID: 0x%x", l2cap_cid); + SDP_TRACE_WARNING ("SDP - Rcvd L2CAP disc cfm, unknown CID: 0x%x\n", l2cap_cid); return; } - SDP_TRACE_EVENT ("SDP - Rcvd L2CAP disc cfm, CID: 0x%x", l2cap_cid); - + SDP_TRACE_EVENT ("SDP - Rcvd L2CAP disc cfm, CID: 0x%x, rsn %d\n", l2cap_cid, p_ccb->disconnect_reason); /* Tell the user if he has a callback */ if (p_ccb->p_cb) (*p_ccb->p_cb) (p_ccb->disconnect_reason); @@ -702,7 +700,7 @@ static void sdp_disconnect_cfm (UINT16 l2cap_cid, UINT16 result) *******************************************************************************/ void sdp_conn_timeout (tCONN_CB*p_ccb) { - SDP_TRACE_EVENT ("SDP - CCB timeout in state: %d CID: 0x%x", + SDP_TRACE_EVENT ("SDP - CCB timeout in state: %d CID: 0x%x\n", p_ccb->con_state, p_ccb->connection_id); L2CA_DisconnectReq (p_ccb->connection_id); diff --git a/components/bt/bluedroid/stack/sdp/sdp_server.c b/components/bt/bluedroid/stack/sdp/sdp_server.c index 333b3e68a..53cb52510 100755 --- a/components/bt/bluedroid/stack/sdp/sdp_server.c +++ b/components/bt/bluedroid/stack/sdp/sdp_server.c @@ -152,7 +152,7 @@ void sdp_server_handle_client_req (tCONN_CB *p_ccb, BT_HDR *p_msg) default: sdpu_build_n_send_error (p_ccb, trans_num, SDP_INVALID_REQ_SYNTAX, SDP_TEXT_BAD_PDU); - SDP_TRACE_WARNING ("SDP - server got unknown PDU: 0x%x", pdu_id); + SDP_TRACE_WARNING ("SDP - server got unknown PDU: 0x%x\n", pdu_id); break; } } @@ -258,7 +258,7 @@ static void process_service_search (tCONN_CB *p_ccb, UINT16 trans_num, /* Get a buffer to use to build the response */ if ((p_buf = (BT_HDR *)GKI_getpoolbuf (SDP_POOL_ID)) == NULL) { - SDP_TRACE_ERROR ("SDP - no buf for search rsp"); + SDP_TRACE_ERROR ("SDP - no buf for search rsp\n"); return; } p_buf->offset = L2CAP_MIN_OFFSET; @@ -373,7 +373,7 @@ static void process_service_attr_req (tCONN_CB *p_ccb, UINT16 trans_num, p_ccb->rsp_list = (UINT8 *)GKI_getbuf(max_list_len); if (p_ccb->rsp_list == NULL) { - SDP_TRACE_ERROR("%s No scratch buf for attr rsp", __func__); + SDP_TRACE_ERROR("%s No scratch buf for attr rsp\n", __func__); return; } @@ -415,7 +415,7 @@ static void process_service_attr_req (tCONN_CB *p_ccb, UINT16 trans_num, p_ccb->rsp_list = (UINT8 *)GKI_getbuf (max_list_len); if (p_ccb->rsp_list == NULL) { - SDP_TRACE_ERROR ("SDP - no scratch buf for search rsp"); + SDP_TRACE_ERROR ("SDP - no scratch buf for search rsp\n"); return; } } @@ -464,7 +464,7 @@ static void process_service_attr_req (tCONN_CB *p_ccb, UINT16 trans_num, { if (attr_len >= SDP_MAX_ATTR_LEN) { - SDP_TRACE_ERROR("SDP attr too big: max_list_len=%d,attr_len=%d", max_list_len, attr_len); + SDP_TRACE_ERROR("SDP attr too big: max_list_len=%d,attr_len=%d\n", max_list_len, attr_len); sdpu_build_n_send_error (p_ccb, trans_num, SDP_NO_RESOURCES, NULL); return; } @@ -523,7 +523,7 @@ static void process_service_attr_req (tCONN_CB *p_ccb, UINT16 trans_num, /* Get a buffer to use to build the response */ if ((p_buf = (BT_HDR *)GKI_getpoolbuf (SDP_POOL_ID)) == NULL) { - SDP_TRACE_ERROR ("SDP - no buf for search rsp"); + SDP_TRACE_ERROR ("SDP - no buf for search rsp\n"); return; } p_buf->offset = L2CAP_MIN_OFFSET; @@ -636,7 +636,7 @@ static void process_service_search_attr_req (tCONN_CB *p_ccb, UINT16 trans_num, p_ccb->rsp_list = (UINT8 *)GKI_getbuf (max_list_len); if (p_ccb->rsp_list == NULL) { - SDP_TRACE_ERROR ("SDP - no scratch buf for search rsp"); + SDP_TRACE_ERROR ("SDP - no scratch buf for search rsp\n"); return; } @@ -678,7 +678,7 @@ static void process_service_search_attr_req (tCONN_CB *p_ccb, UINT16 trans_num, p_ccb->rsp_list = (UINT8 *)GKI_getbuf (max_list_len); if (p_ccb->rsp_list == NULL) { - SDP_TRACE_ERROR ("SDP - no scratch buf for search rsp"); + SDP_TRACE_ERROR ("SDP - no scratch buf for search rsp\n"); return; } } @@ -751,7 +751,7 @@ static void process_service_search_attr_req (tCONN_CB *p_ccb, UINT16 trans_num, { if (attr_len >= SDP_MAX_ATTR_LEN) { - SDP_TRACE_ERROR("SDP attr too big: max_list_len=%d,attr_len=%d", max_list_len, attr_len); + SDP_TRACE_ERROR("SDP attr too big: max_list_len=%d,attr_len=%d\n", max_list_len, attr_len); sdpu_build_n_send_error (p_ccb, trans_num, SDP_NO_RESOURCES, NULL); return; } @@ -859,7 +859,7 @@ static void process_service_search_attr_req (tCONN_CB *p_ccb, UINT16 trans_num, /* Get a buffer to use to build the response */ if ((p_buf = (BT_HDR *)GKI_getpoolbuf (SDP_POOL_ID)) == NULL) { - SDP_TRACE_ERROR ("SDP - no buf for search rsp"); + SDP_TRACE_ERROR ("SDP - no buf for search rsp\n"); return; } p_buf->offset = L2CAP_MIN_OFFSET; diff --git a/components/bt/bluedroid/stack/sdp/sdp_utils.c b/components/bt/bluedroid/stack/sdp/sdp_utils.c index 6e3130b53..90bf58e00 100755 --- a/components/bt/bluedroid/stack/sdp/sdp_utils.c +++ b/components/bt/bluedroid/stack/sdp/sdp_utils.c @@ -158,7 +158,7 @@ void sdpu_release_ccb (tCONN_CB *p_ccb) /* Free the response buffer */ if (p_ccb->rsp_list) { - SDP_TRACE_DEBUG("releasing SDP rsp_list"); + SDP_TRACE_DEBUG("releasing SDP rsp_list\n"); GKI_freebuf(p_ccb->rsp_list); p_ccb->rsp_list = NULL; @@ -323,13 +323,13 @@ void sdpu_build_n_send_error (tCONN_CB *p_ccb, UINT16 trans_num, UINT16 error_co BT_HDR *p_buf; - SDP_TRACE_WARNING ("SDP - sdpu_build_n_send_error code: 0x%x CID: 0x%x", + SDP_TRACE_WARNING ("SDP - sdpu_build_n_send_error code: 0x%x CID: 0x%x\n", error_code, p_ccb->connection_id); /* Get a buffer to use to build and send the packet to L2CAP */ if ((p_buf = (BT_HDR *)GKI_getpoolbuf (SDP_POOL_ID)) == NULL) { - SDP_TRACE_ERROR ("SDP - no buf for err msg"); + SDP_TRACE_ERROR ("SDP - no buf for err msg\n"); return; } p_buf->offset = L2CAP_MIN_OFFSET; @@ -674,7 +674,7 @@ BOOLEAN sdpu_compare_uuid_arrays (UINT8 *p_uuid1, UINT32 len1, UINT8 *p_uuid2, U if( ((len1 != 2) && (len1 != 4) && (len1 != 16)) || ((len2 != 2) && (len2 != 4) && (len2 != 16)) ) { - SDP_TRACE_ERROR("%s: invalid length", __func__); + SDP_TRACE_ERROR("%s: invalid length\n", __func__); return FALSE; } @@ -1019,7 +1019,7 @@ UINT8 *sdpu_build_partial_attrib_entry (UINT8 *p_out, tSDP_ATTRIBUTE *p_attr, UI if ((p_attr_buff = (UINT8 *) GKI_getbuf(sizeof(UINT8) * SDP_MAX_ATTR_LEN )) == NULL) { - SDP_TRACE_ERROR("sdpu_build_partial_attrib_entry cannot get a buffer!"); + SDP_TRACE_ERROR("sdpu_build_partial_attrib_entry cannot get a buffer!\n"); return NULL; } p_tmp_attr = p_attr_buff; diff --git a/examples/09_bt_sdp_client/Makefile b/examples/09_bt_sdp_client/Makefile new file mode 100755 index 000000000..1e91bbb89 --- /dev/null +++ b/examples/09_bt_sdp_client/Makefile @@ -0,0 +1,11 @@ +# +# This is a project Makefile. It is assumed the directory this Makefile resides in is a +# project subdirectory. +# + +PROJECT_NAME := bluedroid_demos + +COMPONENT_ADD_INCLUDEDIRS := components/include + +include $(IDF_PATH)/make/project.mk + diff --git a/examples/09_bt_sdp_client/README.rst b/examples/09_bt_sdp_client/README.rst new file mode 100755 index 000000000..bd6893f45 --- /dev/null +++ b/examples/09_bt_sdp_client/README.rst @@ -0,0 +1,5 @@ +ESP-IDF 08 SDP Client +======================= + +Demo of SDP client for legacy bluetooth + diff --git a/examples/09_bt_sdp_client/components/bluedroid_demos/app_core/bt_app_core.c b/examples/09_bt_sdp_client/components/bluedroid_demos/app_core/bt_app_core.c new file mode 100755 index 000000000..e20c3b39c --- /dev/null +++ b/examples/09_bt_sdp_client/components/bluedroid_demos/app_core/bt_app_core.c @@ -0,0 +1,175 @@ +#include +#include +#include + +#include "fixed_queue.h" +#include "gki.h" +#include "bt_defs.h" +#include "bt_trace.h" +#include "bt_types.h" +#include "allocator.h" + +#include "bta_api.h" +#include "bta_gatt_api.h" +#include "bt_app_common.h" + +#include "controller.h" +//#include "prf_defs.h" +#include "thread.h" +#include "bt_app_common.h" + +static fixed_queue_t *bt_app_msg_queue; + +xQueueHandle xBtAppQueue; +xTaskHandle xBtAppTaskHandle; + +static void bt_app_context_switched(void *p_msg); +static void bt_app_send_msg(void *p_msg); +static void bt_app_task_handler(void *arg); +static void bta_app_msg_ready(fixed_queue_t *queue); +static void bt_app_task_shut_down(void); + + +extern void app_main_entry(void); + +static void bt_app_task_handler(void *arg) +{ + app_main_entry(); + TaskEvt_t *e; + for (;;) { + if (pdTRUE == xQueueReceive(xBtAppQueue, &e, (portTickType)portMAX_DELAY)) { + if (e->sig == 0xff) { + fixed_queue_process(bt_app_msg_queue); + } + osi_free(e); + } + } +} + +static void bt_app_task_post(void) +{ + TaskEvt_t *evt = (TaskEvt_t *)osi_malloc(sizeof(TaskEvt_t)); + if (evt == NULL) + return; + + evt->sig = 0xff; + evt->par = 0; + + if (xQueueSend(xBtAppQueue, &evt, 10/portTICK_RATE_MS) != pdTRUE) { + ets_printf("btdm_post failed\n"); + } +} + +static void bta_app_msg_ready(fixed_queue_t *queue) { + BT_HDR *p_msg; + while (!fixed_queue_is_empty(queue)) { + p_msg = (BT_HDR *)fixed_queue_dequeue(queue); + LOG_ERROR("bta_app_msg_ready, evt: %d\n", p_msg->event); + switch (p_msg->event) { + case BT_EVT_APP_CONTEXT_SWITCH: + bt_app_context_switched(p_msg); + break; + default: + LOG_ERROR("unhandled BT_APP event (%d)\n", p_msg->event & BT_EVT_MASK); + break; + } + GKI_freebuf(p_msg); + } +} + +static void bt_app_context_switched(void *p_msg) +{ + tBTAPP_CONTEXT_SWITCH_CBACK *p = (tBTAPP_CONTEXT_SWITCH_CBACK *) p_msg; + + if (p->p_cb) + p->p_cb(p->event, p->p_param); +} + +static void bt_app_send_msg(void *p_msg) +{ + if (bt_app_msg_queue) { + fixed_queue_enqueue(bt_app_msg_queue, p_msg); + bt_app_task_post(); + } +} + +bt_status_t bt_app_transfer_context (tBTAPP_CBACK *p_cback, UINT16 event, char* p_params, int param_len, tBTAPP_COPY_CBACK *p_copy_cback) +{ + tBTAPP_CONTEXT_SWITCH_CBACK *p_msg; + + LOG_ERROR("btapp_transfer_context evt %d, len %d\n", event, param_len); + + /* allocate and send message that will be executed in btif context */ + if ((p_msg = (tBTAPP_CONTEXT_SWITCH_CBACK *) GKI_getbuf(sizeof(tBTAPP_CONTEXT_SWITCH_CBACK) + param_len)) != NULL) + { + p_msg->hdr.event = BT_EVT_APP_CONTEXT_SWITCH; /* internal event */ + p_msg->p_cb = p_cback; + + p_msg->event = event; /* callback event */ + + /* check if caller has provided a copy callback to do the deep copy */ + if (p_copy_cback) + { + p_copy_cback(event, p_msg->p_param, p_params); + } + else if (p_params) + { + memcpy(p_msg->p_param, p_params, param_len); /* callback parameter data */ + } + + bt_app_send_msg(p_msg); + return BT_STATUS_SUCCESS; + } + else + { + /* let caller deal with a failed allocation */ + return BT_STATUS_NOMEM; + } +} + +void bt_app_task_start_up(void) +{ + bt_app_msg_queue = fixed_queue_new(SIZE_MAX); + if (bt_app_msg_queue == NULL) + goto error_exit; + //ke_event_callback_set(KE_EVENT_BT_APP_TASK, &bt_app_task_handler); + + xBtAppQueue = xQueueCreate(3, sizeof(void *)); + xTaskCreate(bt_app_task_handler, "BtaApp1T", 8192, NULL, configMAX_PRIORITIES - 3, xBtAppTaskHandle); + + fixed_queue_register_dequeue(bt_app_msg_queue, bta_app_msg_ready); + + return; + +error_exit: + LOG_ERROR("%s Unable to allocate resources for bt_app\n", __func__); + bt_app_task_shut_down(); +} + +static void bt_app_task_shut_down(void) +{ + fixed_queue_unregister_dequeue(bt_app_msg_queue); + fixed_queue_free(bt_app_msg_queue, NULL); + bt_app_msg_queue = NULL; + + vTaskDelete(xBtAppTaskHandle); + vQueueDelete(xBtAppQueue); +} + +/* +static void bt_app_upstreams_evt(UINT16 event, char *p_param) +{ + tBTA_DM_SEC *p_data = (tBTA_DM_SEC*)p_param; + switch (event) { + default: + break; + } +} + +static void bt_stack_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) +{ + LOG_ERROR("bt_stack_evt: %d\n", (uint16_t)event); + bt_app_transfer_context(bt_app_upstreams_evt, (uint16_t)event, + (void *)p_data, sizeof(tBTA_DM_SEC), NULL); +} +*/ diff --git a/examples/09_bt_sdp_client/components/bluedroid_demos/app_project/SampleBtSdpClient.c b/examples/09_bt_sdp_client/components/bluedroid_demos/app_project/SampleBtSdpClient.c new file mode 100644 index 000000000..655b7c56c --- /dev/null +++ b/examples/09_bt_sdp_client/components/bluedroid_demos/app_project/SampleBtSdpClient.c @@ -0,0 +1,124 @@ +#include +#include +#include +#include + + +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +#include "bt_app_common.h" +#include "bt_stack_manager.h" +#include "bt_sdp.h" +#include "bt_gap.h" + +/* bta_api.h should not be included as BTA APIs should not be used by APP */ +#include "bta_api.h" + +typedef enum { + BT_APP_EVT_STACK_ON, + BT_APP_EVT_STACK_OFF, + BT_APP_EVT +} tBT_APP_EVT; + +typedef union { + uint32_t dummy; +} tBT_APP_EVT_DATA; + +static void bt_stack_state_changed(bt_state_t state); +static void bt_sdp_search_complete(bt_status_t status, bt_bdaddr_t *bd_addr, uint8_t* uuid, int num_records, bluetooth_sdp_record *records); + +// static bt_bdaddr_t peer_bd_addr = {{0x00, 0x1b, 0xdc, 0x08, 0x0f, 0xe7}}; +static bt_bdaddr_t peer_bd_addr = {{0xfc, 0x3f, 0x7c, 0xf1, 0x2c, 0x78}}; + +/* root browse +static const uint8_t target_uuid[16] = { 0x00, 0x00, 0x10, 0x02, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB }; +*/ + +/* UUID_MAP_MAS */ +static const uint8_t target_uuid[] = {0x00, 0x00, 0x11, 0x32, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}; + +/* UUID AUDIO Source */ +/* +static const uint8_t target_uuid[] = {0x00, 0x00, 0x11, 0x0A, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}; +*/ + +static bt_callbacks_t bt_callbacks = { + bt_stack_state_changed +}; + +static btsdp_callbacks_t btsdp_callbacks = { + bt_sdp_search_complete +}; + +static void bt_app_stack_evt(UINT16 event, char *p_param) +{ + // tBT_APP_EVT_DATA *p_data = (tBT_APP_EVT_DATA *)p_param; + switch (event) { + case BT_APP_EVT_STACK_ON: { + // todo: BTM & BTA APIs should not be called in application task + char *dev_name = "SDP_CLIENT"; + BTM_SetTraceLevel(BT_TRACE_LEVEL_DEBUG); + BTA_DmSetDeviceName(dev_name); + + API_BT_GapSetScanMode(BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE); + + API_BT_SdpInit(&btsdp_callbacks); + + vTaskDelay(20000/portTICK_PERIOD_MS); + API_BT_SdpSearch(&peer_bd_addr, target_uuid); + } + break; + default: + break; + } +} + +static void bt_stack_evt(tBT_APP_EVT event, tBT_APP_EVT_DATA *p_data) +{ + LOG_ERROR("bt_stack_evt: %d\n", (uint16_t)event); + bt_app_transfer_context(bt_app_stack_evt, (uint16_t)event, + (void *)p_data, sizeof(tBT_APP_EVT_DATA), NULL); +} + +static void bt_stack_state_changed(bt_state_t state) +{ + if (state == BT_STATE_ON) { + bt_stack_evt(BT_APP_EVT_STACK_ON, NULL); + } +} + +static void bt_sdp_search_complete(bt_status_t status, bt_bdaddr_t *bd_addr, uint8_t* uuid, int num_records, bluetooth_sdp_record *records) +{ + uint8_t *addr = bd_addr->address; + bluetooth_sdp_hdr_overlay *p = &records->mas.hdr; + LOG_ERROR("sdp search cmpl: st %d, bd_addr: %02x:%02x:%02x:%02x:%02x:%02x, records %d\n", + status, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], num_records); + if (p->service_name_length > 0) { + LOG_ERROR("service name: %s\n", p->service_name); + } + LOG_ERROR("rfc_chl_num %d, l2cap_psm %d, version %02x\n", + p->rfcomm_channel_number, p->l2cap_psm, p->profile_version); +#if 0 + uint8_t *addr = bd_addr->address; + bluetooth_sdp_hdr_overlay *p = &records->hdr; + LOG_ERROR("sdp search cmpl: st %d, bd_addr: %02x:%02x:%02x:%02x:%02x:%02x, records %d, len:%d\n", + status, addr[0], addr[1], addr[2], addr[3], addr[4], addr[5], num_records, p->user1_ptr_len); + if (p->service_name_length > 0) { + LOG_ERROR("service name: %s\n", p->service_name); + } +#endif +} + +void app_main_entry(void) +{ + bt_status_t stat; + stat = API_BTDM_InitStack(&bt_callbacks); + if (stat == BT_STATUS_SUCCESS) { + API_BTDM_EnableStack(); + } +} + diff --git a/examples/09_bt_sdp_client/components/bluedroid_demos/component.mk b/examples/09_bt_sdp_client/components/bluedroid_demos/component.mk new file mode 100755 index 000000000..84150bddc --- /dev/null +++ b/examples/09_bt_sdp_client/components/bluedroid_demos/component.mk @@ -0,0 +1,17 @@ +# +# Main Makefile. This is basically the same as a component makefile. +# +# This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, +# this will take the sources in the src/ directory, compile them and link them into +# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, +# please read the ESP-IDF documents if you need to do this. +# + +COMPONENT_SRCDIRS := \ + app_core \ + app_project + +CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses -I./include + + +include $(IDF_PATH)/make/component_common.mk diff --git a/examples/09_bt_sdp_client/components/bluedroid_demos/include/bt_app_common.h b/examples/09_bt_sdp_client/components/bluedroid_demos/include/bt_app_common.h new file mode 100755 index 000000000..501bfccc9 --- /dev/null +++ b/examples/09_bt_sdp_client/components/bluedroid_demos/include/bt_app_common.h @@ -0,0 +1,30 @@ +#ifndef __BT_APP_COMMON_H__ +#define __BT_APP_COMMON_H__ + +#include +#include "osi.h" +#include "bt_common_types.h" +#include "bt_defs.h" + +/* BT APP Events */ +#define BT_EVT_APP (0xB000) +#define BT_EVT_APP_CONTEXT_SWITCH (0x0001 | BT_EVT_APP) + +typedef void (tBTAPP_CBACK) (uint16_t event, char *p_param); +typedef void (tBTAPP_COPY_CBACK) (uint16_t event, char *p_dest, char *p_src); + +typedef struct +{ + BT_HDR hdr; + tBTAPP_CBACK* p_cb; /* context switch callback */ + + /* parameters passed to callback */ + UINT16 event; /* message event id */ + char p_param[0]; /* parameter area needs to be last */ +} tBTAPP_CONTEXT_SWITCH_CBACK; + +bt_status_t bt_app_transfer_context (tBTAPP_CBACK *p_cback, UINT16 event, char* p_params, int param_len, tBTAPP_COPY_CBACK *p_copy_cback); + +void bt_app_task_start_up(void); + +#endif /* __BT_APP_COMMON_H__ */ diff --git a/examples/09_bt_sdp_client/main/component.mk b/examples/09_bt_sdp_client/main/component.mk new file mode 100755 index 000000000..24356f23e --- /dev/null +++ b/examples/09_bt_sdp_client/main/component.mk @@ -0,0 +1,10 @@ +# +# Main Makefile. This is basically the same as a component makefile. +# +# This Makefile should, at the very least, just include $(SDK_PATH)/make/component_common.mk. By default, +# this will take the sources in the src/ directory, compile them and link them into +# lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable, +# please read the ESP-IDF documents if you need to do this. +# + +include $(IDF_PATH)/make/component_common.mk diff --git a/examples/09_bt_sdp_client/main/demo_main.c b/examples/09_bt_sdp_client/main/demo_main.c new file mode 100755 index 000000000..ad8243a1f --- /dev/null +++ b/examples/09_bt_sdp_client/main/demo_main.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include "bt.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "string.h" + + +extern void bte_main_boot_entry(void *); +extern void bt_app_task_start_up(void); +extern void bt_app_core_start(void); + +void pingTask(void *pvParameters) +{ + while (1) { + vTaskDelay(1000 / portTICK_PERIOD_MS); + printf("ping\n"); + } +} + +void app_main() +{ + bt_controller_init(); + xTaskCreatePinnedToCore(&pingTask, "pingTask", 2048, NULL, 5, NULL, 0); + bt_app_task_start_up(); + // bte_main_boot_entry(bt_app_core_start); +}