diff --git a/components/bt/bluedroid/bta/hh/bta_hh_int.h b/components/bt/bluedroid/bta/hh/bta_hh_int.h index 4e1173aca..c85b20fcb 100644 --- a/components/bt/bluedroid/bta/hh/bta_hh_int.h +++ b/components/bt/bluedroid/bta/hh/bta_hh_int.h @@ -29,10 +29,9 @@ #include "utl.h" #include "bta_hh_api.h" -#if BTA_HH_LE_INCLUDED == TRUE -xxx +//#if BTA_HH_LE_INCLUDED == TRUE #include "bta_gatt_api.h" -#endif +//#endif /* can be moved to bta_api.h */ #define BTA_HH_MAX_RPT_CHARS 8 diff --git a/components/bt/bluedroid/include/bt_common_types.h b/components/bt/bluedroid/include/bt_common_types.h index 87a4d7123..382689a82 100755 --- a/components/bt/bluedroid/include/bt_common_types.h +++ b/components/bt/bluedroid/include/bt_common_types.h @@ -8,9 +8,7 @@ #include "bt_defs.h" #include "thread.h" - -extern xQueueHandle xBtaApp1Queue; -extern xTaskHandle xBtaApp1TaskHandle; +typedef void (* bluedroid_init_done_cb_t)(void); typedef struct { uint8_t client_if; diff --git a/components/bt/bluedroid/main/bte_main.c b/components/bt/bluedroid/main/bte_main.c index e41e33da3..0ad3cee60 100755 --- a/components/bt/bluedroid/main/bte_main.c +++ b/components/bt/bluedroid/main/bte_main.c @@ -26,6 +26,7 @@ #include "bt_defs.h" +#include "bt_common_types.h" #include "bte.h" #include "btu.h" #include "bt_trace.h" @@ -37,7 +38,6 @@ #include "controller.h" #include "hci_layer.h" -#include "bt_app_common.h" //#include "bluedroid_test.h" /* #define LOG_TAG "bt_main" @@ -100,6 +100,8 @@ static void bte_main_enable(void); //extern void bte_load_ble_conf(const char *p_path); fixed_queue_t *btu_hci_msg_queue; +bluedroid_init_done_cb_t bluedroid_init_done_cb; + /****************************************************************************** ** ** Function bte_main_boot_entry @@ -109,7 +111,7 @@ fixed_queue_t *btu_hci_msg_queue; ** Returns None ** ******************************************************************************/ -void bte_main_boot_entry(void) +void bte_main_boot_entry(bluedroid_init_done_cb_t cb) { if (gki_init()) LOG_ERROR("%s: Init GKI Module Failure.\n", __func__); @@ -124,6 +126,8 @@ void bte_main_boot_entry(void) return; } + bluedroid_init_done_cb = cb; + //Caution: No event dispatcher defined now in hci layer //data_dispatcher_register_default(hci->event_dispatcher, btu_hci_msg_queue); hci->set_data_queue(btu_hci_msg_queue); @@ -133,27 +137,9 @@ void bte_main_boot_entry(void) #if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE)) //bte_load_ble_conf(BTE_BLE_STACK_CONF_FILE); #endif - //TODO: STACK CONFIG Module init - //module_init(get_module(STACK_CONFIG_MODULE)); - - // set up bt application task -#if (defined(BT_APP_DEMO) && BT_APP_DEMO == TRUE) - bt_app1_task_start_up(); - // bt_app_start_up(); -#endif //Enbale HCI bte_main_enable(); - - // LOG_ERROR("Test HCI Command\n"); - // controller_get_interface()->devctl_reset(NULL); - - //LOG_ERROR("Test bta_enable_bt\n"); - //bt_test_bta_enable_bt(); - - //LOG_ERROR("Test ble_advertise\n"); - //bt_test_ble_advertise(); - } /****************************************************************************** diff --git a/components/bt/bluedroid/mk.sh b/components/bt/bluedroid/mk.sh deleted file mode 100755 index 6665fd600..000000000 --- a/components/bt/bluedroid/mk.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -FIND_F=component.mk -MV_F=Makefile.backup - -for mkf in `find . -name "$FIND_F"` -do - echo $mkf - mkf_n=`echo $mkf | sed -n "s/$FIND_F/$MV_F/p"` - echo $mkf_n - mv $mkf $mkf_n -done diff --git a/components/bt/bluedroid/profiles/sample_button/button_pro.c b/components/bt/bluedroid/profiles/esp/ble_button/button_pro.c similarity index 94% rename from components/bt/bluedroid/profiles/sample_button/button_pro.c rename to components/bt/bluedroid/profiles/esp/ble_button/button_pro.c index 67409bed6..578cb5da5 100644 --- a/components/bt/bluedroid/profiles/sample_button/button_pro.c +++ b/components/bt/bluedroid/profiles/esp/ble_button/button_pro.c @@ -1,15 +1,15 @@ -/** - **************************************************************************************** - * - * @file button_pro.c - * - * @brief Application entry point - * - * Copyright (C) Espressif 2016 - * Created by Yulong at 2016/8/18 - * - * - **************************************************************************************** +/** + **************************************************************************************** + * + * @file button_pro.c + * + * @brief Application entry point + * + * Copyright (C) Espressif 2016 + * Created by Yulong at 2016/8/18 + * + * + **************************************************************************************** */ #include @@ -18,52 +18,52 @@ #include #include - -#include "bt_target.h" -#include "bt_trace.h" + +#include "bt_target.h" +#include "bt_trace.h" #include "bt_types.h" -#include "gatt_api.h" -#include "bta_api.h" -#include "bta_gatt_api.h" -#include "bta_gatts_int.h" - -#include "button_pro.h" - -#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) - -tBUTTON_CB_ENV button_cb_env; - - - -/***************************************************************************** -** Constants -*****************************************************************************/ -static void button_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data); - - -/******************************************************************************* -** -** Function button_profile_cb -** -** Description the callback function after the profile has been register to the BTA manager module -** -** Returns NULL -** -*******************************************************************************/ -static void button_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) -{ +#include "gatt_api.h" +#include "bta_api.h" +#include "bta_gatt_api.h" +#include "bta_gatts_int.h" + +#include "button_pro.h" + +#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) + +tBUTTON_CB_ENV button_cb_env; + + + +/***************************************************************************** +** Constants +*****************************************************************************/ +static void button_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data); + + +/******************************************************************************* +** +** Function button_profile_cb +** +** Description the callback function after the profile has been register to the BTA manager module +** +** Returns NULL +** +*******************************************************************************/ +static void button_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) +{ tBTA_GATTS_RSP rsp; tBT_UUID uuid = {LEN_UUID_16, {ATT_SVC_BUTTON}}; //LOG_ERROR("p_data->status = %x\n",p_data->status); - //if(p_data->status != BTA_GATT_OK){ - // LOG_ERROR("button profile register failed\n"); - // return; - //} - LOG_ERROR("button profile cb event = %x\n",event); - switch(event) - { - case BTA_GATTS_REG_EVT: + //if(p_data->status != BTA_GATT_OK){ + // LOG_ERROR("button profile register failed\n"); + // return; + //} + LOG_ERROR("button profile cb event = %x\n",event); + switch(event) + { + case BTA_GATTS_REG_EVT: LOG_ERROR("p_data->reg_oper.status = %x\n",p_data->reg_oper.status); LOG_ERROR("(p_data->reg_oper.uuid.uu.uuid16=%x\n",p_data->reg_oper.uuid.uu.uuid16); @@ -71,15 +71,15 @@ static void button_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) { LOG_ERROR("button profile register failed\n"); } - button_cb_env.gatt_if = p_data->reg_oper.server_if; - button_cb_env.enabled = true; - //button_cb_env.button_inst.app_id = p_data->reg_oper.uuid; - //create the button service to the service data base. + button_cb_env.gatt_if = p_data->reg_oper.server_if; + button_cb_env.enabled = true; + //button_cb_env.button_inst.app_id = p_data->reg_oper.uuid; + //create the button service to the service data base. if(p_data->reg_oper.uuid.uu.uuid16 == ATT_SVC_BUTTON) { Button_CreateService(); - } - break; + } + break; case BTA_GATTS_READ_EVT: //tBTA_GATTS_RSP rsp; memset(&rsp,0,sizeof(tBTA_GATTS_API_RSP)); @@ -87,240 +87,240 @@ static void button_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) rsp.attr_value.len = 2; BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id, p_data->req_data.status,&rsp); - break; - case BTA_GATTS_WRITE_EVT: - BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id, - p_data->req_data.status,NULL); - break; - case BTA_GATTS_CONF_EVT: - - break; - case BTA_GATTS_CREATE_EVT: + break; + case BTA_GATTS_WRITE_EVT: + BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id, + p_data->req_data.status,NULL); + break; + case BTA_GATTS_CONF_EVT: + + break; + case BTA_GATTS_CREATE_EVT: //tBT_UUID uuid_butt_write; - uuid.uu.uuid16 = ATT_CHAR_BUTTON_WIT; - //tBTA_GATT_PERM perm = (GATT_PERM_WRITE|GATT_PERM_READ); - //tBTA_GATT_CHAR_PROP prop = (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_WRITE); + uuid.uu.uuid16 = ATT_CHAR_BUTTON_WIT; + //tBTA_GATT_PERM perm = (GATT_PERM_WRITE|GATT_PERM_READ); + //tBTA_GATT_CHAR_PROP prop = (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_WRITE); //uuid = {LEN_UUID_16, {ATT_SVC_BUTTON}}; - button_cb_env.clcb.cur_srvc_id= p_data->create.service_id; - button_cb_env.is_primery = p_data->create.is_primary; + button_cb_env.clcb.cur_srvc_id= p_data->create.service_id; + button_cb_env.is_primery = p_data->create.is_primary; //uuid = {LEN_UUID_16, {ATT_CHAR_BUTTON_WIT}}; //start the button service after created BTA_GATTS_StartService(p_data->create.service_id,BTA_GATT_TRANSPORT_LE); - //add the frist button characteristic --> write characteristic - BTA_GATTS_AddCharacteristic(button_cb_env.clcb.cur_srvc_id,&uuid, + //add the frist button characteristic --> write characteristic + BTA_GATTS_AddCharacteristic(button_cb_env.clcb.cur_srvc_id,&uuid, (GATT_PERM_WRITE|GATT_PERM_READ), - (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_WRITE)); - break; + (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_WRITE)); + break; - case BTA_GATTS_ADD_CHAR_EVT: - if(p_data->add_result.char_uuid.uu.uuid16 == ATT_CHAR_BUTTON_WIT) - { - uuid.uu.uuid16 = ATT_CHAR_BUTTON_NTF; - //tBTA_GATT_PERM perm = GATT_PERM_READ; - tBTA_GATT_CHAR_PROP prop = (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY); - //save the att handle to the env - button_cb_env.button_inst.but_wirt_hdl = p_data->add_result.attr_id; - //add the frist button characteristic --> Notify characteristic - BTA_GATTS_AddCharacteristic(button_cb_env.clcb.cur_srvc_id,&uuid, - GATT_PERM_READ,(GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY)); - }else if(p_data->add_result.char_uuid.uu.uuid16 == ATT_CHAR_BUTTON_NTF){ // add the gattc config descriptor to the notify charateristic - //tBTA_GATT_PERM perm = (GATT_PERM_WRITE|GATT_PERM_WRITE); - uuid.uu.uuid16 = GATT_UUID_CHAR_CLIENT_CONFIG; - button_cb_env.button_inst.but_ntf_hdl = p_data->add_result.attr_id; - BTA_GATTS_AddCharDescriptor (button_cb_env.clcb.cur_srvc_id, + case BTA_GATTS_ADD_CHAR_EVT: + if(p_data->add_result.char_uuid.uu.uuid16 == ATT_CHAR_BUTTON_WIT) + { + uuid.uu.uuid16 = ATT_CHAR_BUTTON_NTF; + //tBTA_GATT_PERM perm = GATT_PERM_READ; + tBTA_GATT_CHAR_PROP prop = (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY); + //save the att handle to the env + button_cb_env.button_inst.but_wirt_hdl = p_data->add_result.attr_id; + //add the frist button characteristic --> Notify characteristic + BTA_GATTS_AddCharacteristic(button_cb_env.clcb.cur_srvc_id,&uuid, + GATT_PERM_READ,(GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY)); + }else if(p_data->add_result.char_uuid.uu.uuid16 == ATT_CHAR_BUTTON_NTF){ // add the gattc config descriptor to the notify charateristic + //tBTA_GATT_PERM perm = (GATT_PERM_WRITE|GATT_PERM_WRITE); + uuid.uu.uuid16 = GATT_UUID_CHAR_CLIENT_CONFIG; + button_cb_env.button_inst.but_ntf_hdl = p_data->add_result.attr_id; + BTA_GATTS_AddCharDescriptor (button_cb_env.clcb.cur_srvc_id, (GATT_PERM_WRITE|GATT_PERM_WRITE), - &uuid); - } - - break; - case BTA_GATTS_ADD_CHAR_DESCR_EVT: - if(p_data->add_result.char_uuid.uu.uuid16 == GATT_UUID_CHAR_CLIENT_CONFIG) - { - button_cb_env.button_inst.but_cfg_hdl = p_data->add_result.attr_id; - } - break; - case BTA_GATTS_CONNECT_EVT: - //set the connection flag to true - button_env_clcb_alloc(p_data->conn.conn_id, p_data->conn.remote_bda); - break; - case BTA_GATTS_DISCONNECT_EVT: - //set the connection flag to true - button_cb_env.clcb.connected = false; - break; - case BTA_GATTS_OPEN_EVT: - break; - case BTA_GATTS_CLOSE_EVT: - if(button_cb_env.clcb.connected && (button_cb_env.clcb.conn_id == p_data->conn.conn_id)) - { - //set the connection channal congested flag to true - button_cb_env.clcb.congest = p_data->congest.congested; - } - break; - case BTA_GATTS_LISTEN_EVT: - break; - case BTA_GATTS_CONGEST_EVT: - break; - default: - break; - } -} - - -/******************************************************************************* -** -** Function Button_CreateService -** -** Description Create a Service for the button profile -** -** Returns NULL -** -*******************************************************************************/ -void Button_CreateService(void) -{ - tBTA_GATTS_IF server_if ; - tBT_UUID uuid = {LEN_UUID_16, {ATT_SVC_BUTTON}}; - UINT16 num_handle = KEY_IDX_NB; - UINT8 inst = 0x00; + &uuid); + } + + break; + case BTA_GATTS_ADD_CHAR_DESCR_EVT: + if(p_data->add_result.char_uuid.uu.uuid16 == GATT_UUID_CHAR_CLIENT_CONFIG) + { + button_cb_env.button_inst.but_cfg_hdl = p_data->add_result.attr_id; + } + break; + case BTA_GATTS_CONNECT_EVT: + //set the connection flag to true + button_env_clcb_alloc(p_data->conn.conn_id, p_data->conn.remote_bda); + break; + case BTA_GATTS_DISCONNECT_EVT: + //set the connection flag to true + button_cb_env.clcb.connected = false; + break; + case BTA_GATTS_OPEN_EVT: + break; + case BTA_GATTS_CLOSE_EVT: + if(button_cb_env.clcb.connected && (button_cb_env.clcb.conn_id == p_data->conn.conn_id)) + { + //set the connection channal congested flag to true + button_cb_env.clcb.congest = p_data->congest.congested; + } + break; + case BTA_GATTS_LISTEN_EVT: + break; + case BTA_GATTS_CONGEST_EVT: + break; + default: + break; + } +} + + +/******************************************************************************* +** +** Function Button_CreateService +** +** Description Create a Service for the button profile +** +** Returns NULL +** +*******************************************************************************/ +void Button_CreateService(void) +{ + tBTA_GATTS_IF server_if ; + tBT_UUID uuid = {LEN_UUID_16, {ATT_SVC_BUTTON}}; + UINT16 num_handle = KEY_IDX_NB; + UINT8 inst = 0x00; server_if = button_cb_env.gatt_if; button_cb_env.inst_id = inst; //if(!button_cb_env.enabled) //{ // LOG_ERROR("button service added error."); //} - BTA_GATTS_CreateService(server_if,&uuid,inst,num_handle,true); - -} - -/******************************************************************************* -** -** Function button_env_clcb_alloc -** -** Description The function allocates a GATT profile connection link control block -** -** Returns NULL if not found. Otherwise pointer to the connection link block. -** -*******************************************************************************/ -tBUT_CLCB *button_env_clcb_alloc (UINT16 conn_id, BD_ADDR remote_bda) -{ - tBUT_CLCB *p_clcb = NULL; - p_clcb = &button_cb_env.clcb; - - if(!p_clcb->in_use) - { - p_clcb->in_use = TRUE; - p_clcb->conn_id = conn_id; - LOG_ERROR("p_clcb->conn_id = %x\n",conn_id); - p_clcb->connected = TRUE; - memcpy(p_clcb->remote_bda,remote_bda,BD_ADDR_LEN); - } - - return p_clcb; -} - -/******************************************************************************* -** -** Function button_env_find_conn_id_by_bd_adddr -** -** Description The function searches all LCB with macthing bd address -** -** Returns total number of clcb found. -** -*******************************************************************************/ -UINT16 button_env_find_conn_id_by_bd_adddr(BD_ADDR remote_bda) -{ - UINT8 i_clcb; - tBUT_CLCB *p_clcb = NULL; - - for(i_clcb = 0, p_clcb = &button_cb_env.clcb; i_clcb < BUTT_MAX_APPS; i_clcb++, p_clcb++) - { - if(p_clcb->in_use && p_clcb->connected &&memcmp(p_clcb->remote_bda,remote_bda,BD_ADDR_LEN)) - { - return p_clcb->conn_id; - } - } - - return GATT_INVALID_CONN_ID; -} - -/******************************************************************************* -** -** Function button_env_clcb_dealloc -** -** Description The function deallocates a GATT profile connection link control block -** -** Returns True the deallocation is successful -** -*******************************************************************************/ + BTA_GATTS_CreateService(server_if,&uuid,inst,num_handle,true); + +} + +/******************************************************************************* +** +** Function button_env_clcb_alloc +** +** Description The function allocates a GATT profile connection link control block +** +** Returns NULL if not found. Otherwise pointer to the connection link block. +** +*******************************************************************************/ +tBUT_CLCB *button_env_clcb_alloc (UINT16 conn_id, BD_ADDR remote_bda) +{ + tBUT_CLCB *p_clcb = NULL; + p_clcb = &button_cb_env.clcb; + + if(!p_clcb->in_use) + { + p_clcb->in_use = TRUE; + p_clcb->conn_id = conn_id; + LOG_ERROR("p_clcb->conn_id = %x\n",conn_id); + p_clcb->connected = TRUE; + memcpy(p_clcb->remote_bda,remote_bda,BD_ADDR_LEN); + } + + return p_clcb; +} + +/******************************************************************************* +** +** Function button_env_find_conn_id_by_bd_adddr +** +** Description The function searches all LCB with macthing bd address +** +** Returns total number of clcb found. +** +*******************************************************************************/ +UINT16 button_env_find_conn_id_by_bd_adddr(BD_ADDR remote_bda) +{ + UINT8 i_clcb; + tBUT_CLCB *p_clcb = NULL; + + for(i_clcb = 0, p_clcb = &button_cb_env.clcb; i_clcb < BUTT_MAX_APPS; i_clcb++, p_clcb++) + { + if(p_clcb->in_use && p_clcb->connected &&memcmp(p_clcb->remote_bda,remote_bda,BD_ADDR_LEN)) + { + return p_clcb->conn_id; + } + } + + return GATT_INVALID_CONN_ID; +} + +/******************************************************************************* +** +** Function button_env_clcb_dealloc +** +** Description The function deallocates a GATT profile connection link control block +** +** Returns True the deallocation is successful +** +*******************************************************************************/ /* -BOOLEAN button_env_clcb_dealloc(UINT16 conn_id) -{ - UINT8 i_clcb = 0; - tBUT_CLCB *p_clcb = NULL; - - for(i_clcb = 0, p_clcb = &button_cb_env.clcb; i_clcb < BUTT_MAX_APPS; i_clcb++, p_clcb++) - { - if(p_clcb->in_use && p_clcb->connected && (p_clcb->conn_id == conn_id)) - { - unsigned j; - for(j = 0; j < ARRAY_SIZE(p_clcb->button_value.data_string);j++) - { - if(p_clcb->button_value.data_string[j]) - { - GKI_freebuf(p_clcb->button_value.data_string[j]); - } - } - memset(p_clcb, 0, sizeof(tBUT_CLCB)); - return TRUE; - } - } - - return FALSE; +BOOLEAN button_env_clcb_dealloc(UINT16 conn_id) +{ + UINT8 i_clcb = 0; + tBUT_CLCB *p_clcb = NULL; + + for(i_clcb = 0, p_clcb = &button_cb_env.clcb; i_clcb < BUTT_MAX_APPS; i_clcb++, p_clcb++) + { + if(p_clcb->in_use && p_clcb->connected && (p_clcb->conn_id == conn_id)) + { + unsigned j; + for(j = 0; j < ARRAY_SIZE(p_clcb->button_value.data_string);j++) + { + if(p_clcb->button_value.data_string[j]) + { + GKI_freebuf(p_clcb->button_value.data_string[j]); + } + } + memset(p_clcb, 0, sizeof(tBUT_CLCB)); + return TRUE; + } + } + + return FALSE; }*/ - - -/******************************************************************************* -** -** Function button_init -** -** Description Initializa the GATT Service for button profiles. -** -*******************************************************************************/ -tGATT_STATUS button_init (void) -{ - tBT_UUID app_uuid = {LEN_UUID_16,{ATT_SVC_BUTTON}}; - - if(button_cb_env.enabled) - { - LOG_ERROR("button svc already initaliezd"); - return GATT_ERROR; - } - else - { - memset(&button_cb_env,0,sizeof(tBUTTON_CB_ENV)); - } - - - /* register the button profile to the BTA_GATTS module*/ - BTA_GATTS_AppRegister(&app_uuid,button_profile_cb); - - button_cb_env.enabled = TRUE; - - return GATT_SUCCESS; -} - -void button_msg_notify(UINT8 len, UINT8 *button_msg) -{ - BOOLEAN conn_status = button_cb_env.clcb.connected; - UINT16 conn_id = button_cb_env.clcb.conn_id; - UINT16 attr_id = button_cb_env.button_inst.but_ntf_hdl; - //notify rsp==false; indicate rsp==true. - BOOLEAN rsp = false; - if(!conn_status && button_cb_env.clcb.congest) - { - LOG_ERROR("the conneciton for button profile has been loss"); - return; - } - - BTA_GATTS_HandleValueIndication (conn_id, attr_id, len, - button_msg, rsp); -} + + +/******************************************************************************* +** +** Function button_init +** +** Description Initializa the GATT Service for button profiles. +** +*******************************************************************************/ +tGATT_STATUS button_init (void) +{ + tBT_UUID app_uuid = {LEN_UUID_16,{ATT_SVC_BUTTON}}; + + if(button_cb_env.enabled) + { + LOG_ERROR("button svc already initaliezd"); + return GATT_ERROR; + } + else + { + memset(&button_cb_env,0,sizeof(tBUTTON_CB_ENV)); + } + + + /* register the button profile to the BTA_GATTS module*/ + BTA_GATTS_AppRegister(&app_uuid,button_profile_cb); + + button_cb_env.enabled = TRUE; + + return GATT_SUCCESS; +} + +void button_msg_notify(UINT8 len, UINT8 *button_msg) +{ + BOOLEAN conn_status = button_cb_env.clcb.connected; + UINT16 conn_id = button_cb_env.clcb.conn_id; + UINT16 attr_id = button_cb_env.button_inst.but_ntf_hdl; + //notify rsp==false; indicate rsp==true. + BOOLEAN rsp = false; + if(!conn_status && button_cb_env.clcb.congest) + { + LOG_ERROR("the conneciton for button profile has been loss"); + return; + } + + BTA_GATTS_HandleValueIndication (conn_id, attr_id, len, + button_msg, rsp); +} diff --git a/components/bt/bluedroid/profiles/include/button_pro.h b/components/bt/bluedroid/profiles/esp/include/button_pro.h similarity index 100% rename from components/bt/bluedroid/profiles/include/button_pro.h rename to components/bt/bluedroid/profiles/esp/include/button_pro.h diff --git a/components/bt/bluedroid/profiles/include/srvc_eng_int.h b/components/bt/bluedroid/profiles/include/srvc_eng_int.h deleted file mode 100644 index edd976399..000000000 --- a/components/bt/bluedroid/profiles/include/srvc_eng_int.h +++ /dev/null @@ -1,88 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 1999-2013 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -#ifndef SRVC_ENG_INT_H -#define SRVC_ENG_INT_H - -#include "bt_target.h" -#include "gatt_api.h" -#include "srvc_api.h" - -#define SRVC_MAX_APPS GATT_CL_MAX_LCB - -#define SRVC_ID_NONE 0 -#define SRVC_ID_DIS 1 -#define SRVC_ID_MAX SRVC_ID_DIS - -#define SRVC_ACT_IGNORE 0 -#define SRVC_ACT_RSP 1 -#define SRVC_ACT_PENDING 2 - -typedef struct -{ - BOOLEAN in_use; - UINT16 conn_id; - BOOLEAN connected; - BD_ADDR bda; - UINT32 trans_id; - UINT8 cur_srvc_id; - - tDIS_VALUE dis_value; - -}tSRVC_CLCB; - - -/* service engine control block */ -typedef struct -{ - tSRVC_CLCB clcb[SRVC_MAX_APPS]; /* connection link*/ - tGATT_IF gatt_if; - BOOLEAN enabled; - -}tSRVC_ENG_CB; - - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Global GATT data */ -#if GATT_DYNAMIC_MEMORY == FALSE -extern tSRVC_ENG_CB srvc_eng_cb; -#else -extern tSRVC_ENG_CB srvc_eng_cb_ptr; -#define srvc_eng_cb (*srvc_eng_cb_ptr) - -#endif - -extern tSRVC_CLCB *srvc_eng_find_clcb_by_conn_id(UINT16 conn_id); -extern tSRVC_CLCB *srvc_eng_find_clcb_by_bd_addr(BD_ADDR bda); -extern UINT16 srvc_eng_find_conn_id_by_bd_addr(BD_ADDR bda); - - -extern void srvc_eng_release_channel (UINT16 conn_id) ; -extern BOOLEAN srvc_eng_request_channel (BD_ADDR remote_bda, UINT8 srvc_id ); -extern void srvc_sr_rsp(UINT8 clcb_idx, tGATT_STATUS st, tGATTS_RSP *p_rsp); -extern void srvc_sr_notify(BD_ADDR remote_bda, UINT16 handle, UINT16 len, UINT8 *p_value); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/components/bt/bluedroid/stack/avrc/avrc_api.c b/components/bt/bluedroid/profiles/std/avrc/avrc_api.c similarity index 100% rename from components/bt/bluedroid/stack/avrc/avrc_api.c rename to components/bt/bluedroid/profiles/std/avrc/avrc_api.c diff --git a/components/bt/bluedroid/stack/avrc/avrc_bld_ct.c b/components/bt/bluedroid/profiles/std/avrc/avrc_bld_ct.c similarity index 100% rename from components/bt/bluedroid/stack/avrc/avrc_bld_ct.c rename to components/bt/bluedroid/profiles/std/avrc/avrc_bld_ct.c diff --git a/components/bt/bluedroid/stack/avrc/avrc_bld_tg.c b/components/bt/bluedroid/profiles/std/avrc/avrc_bld_tg.c similarity index 100% rename from components/bt/bluedroid/stack/avrc/avrc_bld_tg.c rename to components/bt/bluedroid/profiles/std/avrc/avrc_bld_tg.c diff --git a/components/bt/bluedroid/stack/avrc/avrc_opt.c b/components/bt/bluedroid/profiles/std/avrc/avrc_opt.c similarity index 100% rename from components/bt/bluedroid/stack/avrc/avrc_opt.c rename to components/bt/bluedroid/profiles/std/avrc/avrc_opt.c diff --git a/components/bt/bluedroid/stack/avrc/avrc_pars_ct.c b/components/bt/bluedroid/profiles/std/avrc/avrc_pars_ct.c similarity index 100% rename from components/bt/bluedroid/stack/avrc/avrc_pars_ct.c rename to components/bt/bluedroid/profiles/std/avrc/avrc_pars_ct.c diff --git a/components/bt/bluedroid/stack/avrc/avrc_pars_tg.c b/components/bt/bluedroid/profiles/std/avrc/avrc_pars_tg.c similarity index 100% rename from components/bt/bluedroid/stack/avrc/avrc_pars_tg.c rename to components/bt/bluedroid/profiles/std/avrc/avrc_pars_tg.c diff --git a/components/bt/bluedroid/stack/avrc/avrc_sdp.c b/components/bt/bluedroid/profiles/std/avrc/avrc_sdp.c similarity index 100% rename from components/bt/bluedroid/stack/avrc/avrc_sdp.c rename to components/bt/bluedroid/profiles/std/avrc/avrc_sdp.c diff --git a/components/bt/bluedroid/stack/avrc/avrc_utils.c b/components/bt/bluedroid/profiles/std/avrc/avrc_utils.c similarity index 100% rename from components/bt/bluedroid/stack/avrc/avrc_utils.c rename to components/bt/bluedroid/profiles/std/avrc/avrc_utils.c diff --git a/components/bt/bluedroid/stack/avrc/include/avrc_int.h b/components/bt/bluedroid/profiles/std/avrc/include/avrc_int.h similarity index 100% rename from components/bt/bluedroid/stack/avrc/include/avrc_int.h rename to components/bt/bluedroid/profiles/std/avrc/include/avrc_int.h diff --git a/components/bt/bluedroid/profiles/baterry/baterry_prf.c b/components/bt/bluedroid/profiles/std/battery/battery_prf.c similarity index 99% rename from components/bt/bluedroid/profiles/baterry/baterry_prf.c rename to components/bt/bluedroid/profiles/std/battery/battery_prf.c index 6e5d5cfd4..b1cde82e9 100644 --- a/components/bt/bluedroid/profiles/baterry/baterry_prf.c +++ b/components/bt/bluedroid/profiles/std/battery/battery_prf.c @@ -17,7 +17,7 @@ #include "bt_trace.h" #include "btm_api.h" #include "bt_types.h" -#include "gatt_profile.h" +#include "dis_api.h" #if BLE_INCLUDED == true diff --git a/components/bt/bluedroid/profiles/include/srvc_battery_int.h b/components/bt/bluedroid/profiles/std/battery/include/srvc_battery_int.h similarity index 100% rename from components/bt/bluedroid/profiles/include/srvc_battery_int.h rename to components/bt/bluedroid/profiles/std/battery/include/srvc_battery_int.h diff --git a/components/bt/bluedroid/profiles/diss/diss_profile.c b/components/bt/bluedroid/profiles/std/dis/dis_profile.c similarity index 99% rename from components/bt/bluedroid/profiles/diss/diss_profile.c rename to components/bt/bluedroid/profiles/std/dis/dis_profile.c index c53c22d04..fb00bf311 100644 --- a/components/bt/bluedroid/profiles/diss/diss_profile.c +++ b/components/bt/bluedroid/profiles/std/dis/dis_profile.c @@ -34,7 +34,7 @@ #include "bt_trace.h" #include "btm_api.h" #include "bt_types.h" -#include "gatt_profile.h" +#include "dis_api.h" #if BLE_INCLUDED == TRUE diff --git a/components/bt/bluedroid/profiles/include/srvc_dis_int.h b/components/bt/bluedroid/profiles/std/dis/include/srvc_dis_int.h similarity index 100% rename from components/bt/bluedroid/profiles/include/srvc_dis_int.h rename to components/bt/bluedroid/profiles/std/dis/include/srvc_dis_int.h diff --git a/components/bt/bluedroid/stack/include/hid_conn.h b/components/bt/bluedroid/profiles/std/hid/include/hid_conn.h similarity index 100% rename from components/bt/bluedroid/stack/include/hid_conn.h rename to components/bt/bluedroid/profiles/std/hid/include/hid_conn.h diff --git a/components/bt/bluedroid/stack/include/hidh_int.h b/components/bt/bluedroid/profiles/std/hid/include/hidh_int.h similarity index 100% rename from components/bt/bluedroid/stack/include/hidh_int.h rename to components/bt/bluedroid/profiles/std/hid/include/hidh_int.h diff --git a/components/bt/bluedroid/profiles/hid_le/hid_le_prf.c b/components/bt/bluedroid/profiles/std/hid_le/hid_le_prf.c similarity index 56% rename from components/bt/bluedroid/profiles/hid_le/hid_le_prf.c rename to components/bt/bluedroid/profiles/std/hid_le/hid_le_prf.c index 25b7c8c45..98ae546b9 100644 --- a/components/bt/bluedroid/profiles/hid_le/hid_le_prf.c +++ b/components/bt/bluedroid/profiles/std/hid_le/hid_le_prf.c @@ -1,300 +1,300 @@ -/** - **************************************************************************************** - * - * @file hid_le_prf.c - * - * @brief Application entry point - * - * Copyright (C) Espressif 2016 - * Created by Yulong at 2016/9/7 - * - * - **************************************************************************************** - */ -#include -#include "hid_le_prf.h" -#include "prf_defs.h" +/** + **************************************************************************************** + * + * @file hid_le_prf.c + * + * @brief Application entry point + * + * Copyright (C) Espressif 2016 + * Created by Yulong at 2016/9/7 + * + * + **************************************************************************************** + */ +#include +#include "hid_le_prf.h" +#include "prf_defs.h" #include "bta_gatt_api.h" - -tHIDD_LE_ENV hidd_le_env; - -tBT_UUID char_info_uuid = {LEN_UUID_16, {CHAR_HID_INFO_UUID}}; -tBT_UUID char_ctnl_pt_uuid = {LEN_UUID_16, {CHAR_HID_CTNL_PT_UUID}}; -tBT_UUID char_report_map_uuid = {LEN_UUID_16, {CHAR_REPORT_MAP_UUID}}; -tBT_UUID char_proto_mode_uuid = {LEN_UUID_16, {CHAR_PROTOCOL_MODE_UUID}}; -tBT_UUID char_kb_in_report_uuid = {LEN_UUID_16, {CHAR_BOOT_KB_IN_REPORT_UUID}}; -tBT_UUID char_kb_out_report_uuid = {LEN_UUID_16,{CHAR_BOOT_KB_OUT_REPORT_UUID}}; -tBT_UUID char_mouse_in_report_uuid = {LEN_UUID_16,{CHAR_BOOT_MOUSE_IN_REPORT_UUID}}; - - - -/// Full HID device Database Description - Used to add attributes into the database -const tCHAR_DESC hids_char_db[HIDD_LE_CHAR_MAX] = -{ - // HID Information Characteristic Value - [HIDD_LE_INFO_CHAR] = { - &char_info_uuid, - GATT_PERM_READ, - GATT_CHAR_PROP_BIT_READ - }, - - // HID Control Point Characteristic Value - [HIDD_LE_CTNL_PT_CHAR] = { - &char_ctnl_pt_uuid, - GATT_PERM_WRITE, - GATT_CHAR_PROP_BIT_WRITE_NR - }, - - // Report Map Characteristic Value - [HIDD_LE_REPORT_MAP_CHAR] = { - &char_report_map_uuid, - GATT_PERM_READ, - GATT_CHAR_PROP_BIT_READ - }, - - // Protocol Mode Characteristic Declaration - [HIDD_LE_PROTO_MODE_CHAR] = { - &char_proto_mode_uuid, - GATT_PERM_READ, - GATT_CHAR_PROP_BIT_READ, - }, - - // Boot Keyboard Input Report Characteristic Value - [HIDD_LE_BOOT_KB_IN_REPORT_CHAR] = { - &char_kb_in_report_uuid, - GATT_PERM_READ, - (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY), - - }, - - // Boot Keyboard Output Report Characteristic Value - [HIDD_LE_BOOT_KB_OUT_REPORT_CHAR] = { - &char_kb_out_report_uuid, - GATT_PERM_READ, - (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_WRITE|GATT_CHAR_PROP_BIT_WRITE_NR) - }, - - // Boot Mouse Input Report Characteristic Value - [HIDD_LE_BOOT_MOUSE_IN_REPORT_CHAR] = { - &char_mouse_in_report_uuid, - GATT_PERM_READ, - (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY), - }, -}; - - -//tBT_UUID hid_uuid = {LEN_UUID_16, {ATT_SVC_BUTTON}}; - -static void HID_AddCharacteristic(const tCHAR_DESC *char_desc); - -/***************************************************************************** -** Constants -*****************************************************************************/ -static void hidd_le_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data); - -/******************************************************************************* -** -** Function hidd_le_profile_cb -** -** Description the callback function after the hid device profile has been register to the BTA manager module -** -** Returns NULL -** -*******************************************************************************/ -static void HID_AddCharacteristic(const tCHAR_DESC *char_desc) -{ - UINT16 service_id; - if(char_desc == NULL) - { - LOG_ERROR("Invalid hid characteristic"); - return; - } - //check the hid device serivce has been register to the data base or not - if(!hidd_le_env.enabled) - { - LOG_ERROR("The hid device didn't register yet"); - return; - } - //get the service id from the env whitch has been register - service_id = hidd_le_env.hidd_clcb.cur_srvc_id; - if(char_desc->char_uuid != 0x00) - { - // start added the charact to the data base - BTA_GATTS_AddCharacteristic(service_id, - char_desc->char_uuid, - char_desc->perm, - char_desc->prop); - } -} - - -/******************************************************************************* -** -** Function hidd_le_profile_cb -** -** Description the callback function after the hid device profile has been register to the BTA manager module -** -** Returns NULL -** -*******************************************************************************/ -static void hidd_le_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) -{ - tBTA_GATTS_RSP rsp; - tBT_UUID uuid = {LEN_UUID_16, {ATT_SVC_HID}}; - static UINT8 hid_char_idx; - tHIDD_CLCB *p_clcb = NULL; - switch(event) - { - case BTA_GATTS_REG_EVT: - //check the register of the hid device profile has been succeess or not - if(p_data->reg_oper.status != BTA_GATT_OK) + +tHIDD_LE_ENV hidd_le_env; + +tBT_UUID char_info_uuid = {LEN_UUID_16, {CHAR_HID_INFO_UUID}}; +tBT_UUID char_ctnl_pt_uuid = {LEN_UUID_16, {CHAR_HID_CTNL_PT_UUID}}; +tBT_UUID char_report_map_uuid = {LEN_UUID_16, {CHAR_REPORT_MAP_UUID}}; +tBT_UUID char_proto_mode_uuid = {LEN_UUID_16, {CHAR_PROTOCOL_MODE_UUID}}; +tBT_UUID char_kb_in_report_uuid = {LEN_UUID_16, {CHAR_BOOT_KB_IN_REPORT_UUID}}; +tBT_UUID char_kb_out_report_uuid = {LEN_UUID_16,{CHAR_BOOT_KB_OUT_REPORT_UUID}}; +tBT_UUID char_mouse_in_report_uuid = {LEN_UUID_16,{CHAR_BOOT_MOUSE_IN_REPORT_UUID}}; + + + +/// Full HID device Database Description - Used to add attributes into the database +const tCHAR_DESC hids_char_db[HIDD_LE_CHAR_MAX] = +{ + // HID Information Characteristic Value + [HIDD_LE_INFO_CHAR] = { + &char_info_uuid, + GATT_PERM_READ, + GATT_CHAR_PROP_BIT_READ + }, + + // HID Control Point Characteristic Value + [HIDD_LE_CTNL_PT_CHAR] = { + &char_ctnl_pt_uuid, + GATT_PERM_WRITE, + GATT_CHAR_PROP_BIT_WRITE_NR + }, + + // Report Map Characteristic Value + [HIDD_LE_REPORT_MAP_CHAR] = { + &char_report_map_uuid, + GATT_PERM_READ, + GATT_CHAR_PROP_BIT_READ + }, + + // Protocol Mode Characteristic Declaration + [HIDD_LE_PROTO_MODE_CHAR] = { + &char_proto_mode_uuid, + GATT_PERM_READ, + GATT_CHAR_PROP_BIT_READ, + }, + + // Boot Keyboard Input Report Characteristic Value + [HIDD_LE_BOOT_KB_IN_REPORT_CHAR] = { + &char_kb_in_report_uuid, + GATT_PERM_READ, + (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY), + + }, + + // Boot Keyboard Output Report Characteristic Value + [HIDD_LE_BOOT_KB_OUT_REPORT_CHAR] = { + &char_kb_out_report_uuid, + GATT_PERM_READ, + (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_WRITE|GATT_CHAR_PROP_BIT_WRITE_NR) + }, + + // Boot Mouse Input Report Characteristic Value + [HIDD_LE_BOOT_MOUSE_IN_REPORT_CHAR] = { + &char_mouse_in_report_uuid, + GATT_PERM_READ, + (GATT_CHAR_PROP_BIT_READ|GATT_CHAR_PROP_BIT_NOTIFY), + }, +}; + + +//tBT_UUID hid_uuid = {LEN_UUID_16, {ATT_SVC_BUTTON}}; + +static void HID_AddCharacteristic(const tCHAR_DESC *char_desc); + +/***************************************************************************** + ** Constants + *****************************************************************************/ +static void hidd_le_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data); + +/******************************************************************************* + ** + ** Function hidd_le_profile_cb + ** + ** Description the callback function after the hid device profile has been register to the BTA manager module + ** + ** Returns NULL + ** + *******************************************************************************/ +static void HID_AddCharacteristic(const tCHAR_DESC *char_desc) +{ + UINT16 service_id; + if(char_desc == NULL) + { + LOG_ERROR("Invalid hid characteristic"); + return; + } + //check the hid device serivce has been register to the data base or not + if(!hidd_le_env.enabled) + { + LOG_ERROR("The hid device didn't register yet"); + return; + } + //get the service id from the env whitch has been register + service_id = hidd_le_env.hidd_clcb.cur_srvc_id; + if(char_desc->char_uuid != 0x00) + { + // start added the charact to the data base + BTA_GATTS_AddCharacteristic(service_id, + char_desc->char_uuid, + char_desc->perm, + char_desc->prop); + } +} + + +/******************************************************************************* + ** + ** Function hidd_le_profile_cb + ** + ** Description the callback function after the hid device profile has been register to the BTA manager module + ** + ** Returns NULL + ** + *******************************************************************************/ +static void hidd_le_profile_cb(tBTA_GATTS_EVT event, tBTA_GATTS *p_data) +{ + tBTA_GATTS_RSP rsp; + tBT_UUID uuid = {LEN_UUID_16, {ATT_SVC_HID}}; + static UINT8 hid_char_idx; + tHIDD_CLCB *p_clcb = NULL; + switch(event) + { + case BTA_GATTS_REG_EVT: + //check the register of the hid device profile has been succeess or not + if(p_data->reg_oper.status != BTA_GATT_OK) { LOG_ERROR("button profile register failed\n"); - } - //save the gatt interface in the hid device ENV - hidd_le_env.gatt_if = p_data->reg_oper.server_if; - //set the env flag to enable - hidd_le_env.enabled = true; - //create the hid device service to the service data base. - if(p_data->reg_oper.uuid.uu.uuid16 == ATT_SVC_HID) + } + //save the gatt interface in the hid device ENV + hidd_le_env.gatt_if = p_data->reg_oper.server_if; + //set the env flag to enable + hidd_le_env.enabled = true; + //create the hid device service to the service data base. + if(p_data->reg_oper.uuid.uu.uuid16 == ATT_SVC_HID) { - hidd_le_CreateService(true); - } - break; - case BTA_GATTS_CREATE_EVT: - if(p_data->create.uuid.uu.uuid16 == ATT_SVC_HID) - { - ///store the service id to the env - hidd_le_env.hidd_clcb.cur_srvc_id = p_data->create.service_id; - //start the button service after created - BTA_GATTS_StartService(p_data->create.service_id,BTA_GATT_TRANSPORT_LE); - hid_char_idx = HIDD_LE_INFO_CHAR; - //added the info character to the data base. - HID_AddCharacteristic(&hids_char_db[hid_char_idx]); - hid_char_idx++; - } - - break; - case BTA_GATTS_ADD_INCL_SRVC_EVT: - - break; - case BTA_GATTS_ADD_CHAR_EVT: - if(hid_char_idx < HIDD_LE_CHAR_MAX) //added the characteristic until the index overflow - { - HID_AddCharacteristic(&hids_char_db[hid_char_idx]); - if((p_data->add_result.char_uuid.uu.uuid16 == CHAR_BOOT_KB_IN_REPORT_UUID) || - (p_data->add_result.char_uuid.uu.uuid16 == CHAR_BOOT_MOUSE_IN_REPORT_UUID)) - { - // add the gattc config descriptor to the notify charateristic - //tBTA_GATT_PERM perm = (GATT_PERM_WRITE|GATT_PERM_WRITE); - uuid.uu.uuid16 = GATT_UUID_CHAR_CLIENT_CONFIG; - - BTA_GATTS_AddCharDescriptor (hidd_le_env.hidd_clcb.cur_srvc_id, - GATT_PERM_WRITE, - &uuid); - } - } - hid_char_idx++; - break; - case BTA_GATTS_ADD_CHAR_DESCR_EVT: - - break; - case BTA_GATTS_WRITE_EVT: - BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id, - p_data->req_data.status,NULL); - break; - case BTA_GATTS_CONNECT_EVT: - p_clcb = &hidd_le_env.hidd_clcb; - - if(!p_clcb->in_use) - { - p_clcb->in_use = TRUE; - p_clcb->conn_id = p_data->conn.conn_id;; - LOG_ERROR("hidd->conn_id = %x\n",p_data->conn.conn_id); - p_clcb->connected = TRUE; - memcpy(p_clcb->remote_bda, p_data->conn.remote_bda,BD_ADDR_LEN); - } - break; - case BTA_GATTS_DISCONNECT_EVT: - p_clcb = &hidd_le_env.hidd_clcb; - //set the connection flag to true - p_clcb->connected = false; - p_clcb->in_use = TRUE; - memset(p_clcb->remote_bda,0,BD_ADDR_LEN); - break; - case BTA_GATTS_START_EVT: - break; - case BTA_GATTS_CONGEST_EVT: - if(hidd_le_env.hidd_clcb.connected && (hidd_le_env.hidd_clcb.conn_id == p_data->conn.conn_id)) - { - //set the connection channal congested flag to true - hidd_le_env.hidd_clcb.congest = p_data->congest.congested; - } - break; - default: - break; - } -} - -/******************************************************************************* -** -** Function hidd_le_CreateService -** -** Description Create a Service for the hid device profile -** -** Parameters is_primary: this service is the primary service or not,true is the primary service -** false is not the primary service -** p_service_uuid: service UUID. -** -** Returns NULL -** -*******************************************************************************/ -void hidd_le_CreateService(BOOLEAN is_primary) -{ - tBTA_GATTS_IF server_if ; - tBT_UUID uuid = {LEN_UUID_16, {ATT_SVC_HID}}; - //the number of the hid device attributes in the hid service. - UINT16 num_handle = HIDD_LE_IDX_NB; - UINT8 inst = 0x00; - server_if = hidd_le_env.gatt_if; - hidd_le_env.inst_id = inst; - //start create the hid device service - BTA_GATTS_CreateService(server_if,&uuid,inst,num_handle,is_primary); -} - - - - -/******************************************************************************* -** -** Function hidd_le_init -** -** Description Initializa the GATT Service for button profiles. -** Returns NULL -*******************************************************************************/ -tGATT_STATUS hidd_le_init (void) -{ - tBT_UUID app_uuid = {LEN_UUID_16,{ATT_SVC_HID}}; - - if(hidd_le_env.enabled) - { - LOG_ERROR("hid device svc already initaliezd"); - return GATT_ERROR; - } - else - { - memset(&hidd_le_env,0,sizeof(tHIDD_LE_ENV)); - } - - - /* register the hid deivce profile to the BTA_GATTS module*/ - BTA_GATTS_AppRegister(&app_uuid,hidd_le_profile_cb); - - hidd_le_env.enabled = TRUE; - - return GATT_SUCCESS; -} - - - - + hidd_le_CreateService(true); + } + break; + case BTA_GATTS_CREATE_EVT: + if(p_data->create.uuid.uu.uuid16 == ATT_SVC_HID) + { + ///store the service id to the env + hidd_le_env.hidd_clcb.cur_srvc_id = p_data->create.service_id; + //start the button service after created + BTA_GATTS_StartService(p_data->create.service_id,BTA_GATT_TRANSPORT_LE); + hid_char_idx = HIDD_LE_INFO_CHAR; + //added the info character to the data base. + HID_AddCharacteristic(&hids_char_db[hid_char_idx]); + hid_char_idx++; + } + + break; + case BTA_GATTS_ADD_INCL_SRVC_EVT: + + break; + case BTA_GATTS_ADD_CHAR_EVT: + if(hid_char_idx < HIDD_LE_CHAR_MAX) //added the characteristic until the index overflow + { + HID_AddCharacteristic(&hids_char_db[hid_char_idx]); + if((p_data->add_result.char_uuid.uu.uuid16 == CHAR_BOOT_KB_IN_REPORT_UUID) || + (p_data->add_result.char_uuid.uu.uuid16 == CHAR_BOOT_MOUSE_IN_REPORT_UUID)) + { + // add the gattc config descriptor to the notify charateristic + //tBTA_GATT_PERM perm = (GATT_PERM_WRITE|GATT_PERM_WRITE); + uuid.uu.uuid16 = GATT_UUID_CHAR_CLIENT_CONFIG; + + BTA_GATTS_AddCharDescriptor (hidd_le_env.hidd_clcb.cur_srvc_id, + GATT_PERM_WRITE, + &uuid); + } + } + hid_char_idx++; + break; + case BTA_GATTS_ADD_CHAR_DESCR_EVT: + + break; + case BTA_GATTS_WRITE_EVT: + BTA_GATTS_SendRsp(p_data->req_data.conn_id,p_data->req_data.trans_id, + p_data->req_data.status,NULL); + break; + case BTA_GATTS_CONNECT_EVT: + p_clcb = &hidd_le_env.hidd_clcb; + + if(!p_clcb->in_use) + { + p_clcb->in_use = TRUE; + p_clcb->conn_id = p_data->conn.conn_id;; + LOG_ERROR("hidd->conn_id = %x\n",p_data->conn.conn_id); + p_clcb->connected = TRUE; + memcpy(p_clcb->remote_bda, p_data->conn.remote_bda,BD_ADDR_LEN); + } + break; + case BTA_GATTS_DISCONNECT_EVT: + p_clcb = &hidd_le_env.hidd_clcb; + //set the connection flag to true + p_clcb->connected = false; + p_clcb->in_use = TRUE; + memset(p_clcb->remote_bda,0,BD_ADDR_LEN); + break; + case BTA_GATTS_START_EVT: + break; + case BTA_GATTS_CONGEST_EVT: + if(hidd_le_env.hidd_clcb.connected && (hidd_le_env.hidd_clcb.conn_id == p_data->conn.conn_id)) + { + //set the connection channal congested flag to true + hidd_le_env.hidd_clcb.congest = p_data->congest.congested; + } + break; + default: + break; + } +} + +/******************************************************************************* + ** + ** Function hidd_le_CreateService + ** + ** Description Create a Service for the hid device profile + ** + ** Parameters is_primary: this service is the primary service or not,true is the primary service + ** false is not the primary service + ** p_service_uuid: service UUID. + ** + ** Returns NULL + ** + *******************************************************************************/ +void hidd_le_CreateService(BOOLEAN is_primary) +{ + tBTA_GATTS_IF server_if ; + tBT_UUID uuid = {LEN_UUID_16, {ATT_SVC_HID}}; + //the number of the hid device attributes in the hid service. + UINT16 num_handle = HIDD_LE_IDX_NB; + UINT8 inst = 0x00; + server_if = hidd_le_env.gatt_if; + hidd_le_env.inst_id = inst; + //start create the hid device service + BTA_GATTS_CreateService(server_if,&uuid,inst,num_handle,is_primary); +} + + + + +/******************************************************************************* + ** + ** Function hidd_le_init + ** + ** Description Initializa the GATT Service for button profiles. + ** Returns NULL + *******************************************************************************/ +tGATT_STATUS hidd_le_init (void) +{ + tBT_UUID app_uuid = {LEN_UUID_16,{ATT_SVC_HID}}; + + if(hidd_le_env.enabled) + { + LOG_ERROR("hid device svc already initaliezd"); + return GATT_ERROR; + } + else + { + memset(&hidd_le_env,0,sizeof(tHIDD_LE_ENV)); + } + + + /* register the hid deivce profile to the BTA_GATTS module*/ + BTA_GATTS_AppRegister(&app_uuid,hidd_le_profile_cb); + + hidd_le_env.enabled = TRUE; + + return GATT_SUCCESS; +} + + + + diff --git a/components/bt/bluedroid/stack/include/avct_api.h b/components/bt/bluedroid/profiles/std/include/avct_api.h similarity index 100% rename from components/bt/bluedroid/stack/include/avct_api.h rename to components/bt/bluedroid/profiles/std/include/avct_api.h diff --git a/components/bt/bluedroid/stack/include/avdt_api.h b/components/bt/bluedroid/profiles/std/include/avdt_api.h similarity index 100% rename from components/bt/bluedroid/stack/include/avdt_api.h rename to components/bt/bluedroid/profiles/std/include/avdt_api.h diff --git a/components/bt/bluedroid/stack/include/avdt_defs.h b/components/bt/bluedroid/profiles/std/include/avdt_defs.h similarity index 100% rename from components/bt/bluedroid/stack/include/avdt_defs.h rename to components/bt/bluedroid/profiles/std/include/avdt_defs.h diff --git a/components/bt/bluedroid/stack/include/avdtc_api.h b/components/bt/bluedroid/profiles/std/include/avdtc_api.h similarity index 100% rename from components/bt/bluedroid/stack/include/avdtc_api.h rename to components/bt/bluedroid/profiles/std/include/avdtc_api.h diff --git a/components/bt/bluedroid/stack/include/avrc_api.h b/components/bt/bluedroid/profiles/std/include/avrc_api.h similarity index 100% rename from components/bt/bluedroid/stack/include/avrc_api.h rename to components/bt/bluedroid/profiles/std/include/avrc_api.h diff --git a/components/bt/bluedroid/stack/include/avrc_defs.h b/components/bt/bluedroid/profiles/std/include/avrc_defs.h similarity index 100% rename from components/bt/bluedroid/stack/include/avrc_defs.h rename to components/bt/bluedroid/profiles/std/include/avrc_defs.h diff --git a/components/bt/bluedroid/profiles/include/gatt_profile.h b/components/bt/bluedroid/profiles/std/include/dis_api.h similarity index 100% rename from components/bt/bluedroid/profiles/include/gatt_profile.h rename to components/bt/bluedroid/profiles/std/include/dis_api.h diff --git a/components/bt/bluedroid/profiles/include/hid_le_prf.h b/components/bt/bluedroid/profiles/std/include/hid_le_prf.h similarity index 100% rename from components/bt/bluedroid/profiles/include/hid_le_prf.h rename to components/bt/bluedroid/profiles/std/include/hid_le_prf.h diff --git a/components/bt/bluedroid/stack/include/hiddefs.h b/components/bt/bluedroid/profiles/std/include/hiddefs.h similarity index 100% rename from components/bt/bluedroid/stack/include/hiddefs.h rename to components/bt/bluedroid/profiles/std/include/hiddefs.h diff --git a/components/bt/bluedroid/stack/include/hidh_api.h b/components/bt/bluedroid/profiles/std/include/hidh_api.h similarity index 100% rename from components/bt/bluedroid/stack/include/hidh_api.h rename to components/bt/bluedroid/profiles/std/include/hidh_api.h diff --git a/components/bt/bluedroid/profiles/include/prf_defs.h b/components/bt/bluedroid/profiles/std/include/prf_defs.h similarity index 100% rename from components/bt/bluedroid/profiles/include/prf_defs.h rename to components/bt/bluedroid/profiles/std/include/prf_defs.h diff --git a/components/bt/bluedroid/stack/include/rfcdefs.h b/components/bt/bluedroid/profiles/std/include/rfcdefs.h similarity index 100% rename from components/bt/bluedroid/stack/include/rfcdefs.h rename to components/bt/bluedroid/profiles/std/include/rfcdefs.h diff --git a/components/bt/bluedroid/profiles/include/srvc_api.h b/components/bt/bluedroid/profiles/std/include/srvc_api.h similarity index 100% rename from components/bt/bluedroid/profiles/include/srvc_api.h rename to components/bt/bluedroid/profiles/std/include/srvc_api.h diff --git a/components/bt/bluedroid/stack/rfcomm/include/port_int.h b/components/bt/bluedroid/profiles/std/rfcomm/include/port_int.h similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/include/port_int.h rename to components/bt/bluedroid/profiles/std/rfcomm/include/port_int.h diff --git a/components/bt/bluedroid/stack/rfcomm/include/rfc_int.h b/components/bt/bluedroid/profiles/std/rfcomm/include/rfc_int.h similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/include/rfc_int.h rename to components/bt/bluedroid/profiles/std/rfcomm/include/rfc_int.h diff --git a/components/bt/bluedroid/stack/rfcomm/port_api.c b/components/bt/bluedroid/profiles/std/rfcomm/port_api.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/port_api.c rename to components/bt/bluedroid/profiles/std/rfcomm/port_api.c diff --git a/components/bt/bluedroid/stack/rfcomm/port_rfc.c b/components/bt/bluedroid/profiles/std/rfcomm/port_rfc.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/port_rfc.c rename to components/bt/bluedroid/profiles/std/rfcomm/port_rfc.c diff --git a/components/bt/bluedroid/stack/rfcomm/port_utils.c b/components/bt/bluedroid/profiles/std/rfcomm/port_utils.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/port_utils.c rename to components/bt/bluedroid/profiles/std/rfcomm/port_utils.c diff --git a/components/bt/bluedroid/stack/rfcomm/rfc_l2cap_if.c b/components/bt/bluedroid/profiles/std/rfcomm/rfc_l2cap_if.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/rfc_l2cap_if.c rename to components/bt/bluedroid/profiles/std/rfcomm/rfc_l2cap_if.c diff --git a/components/bt/bluedroid/stack/rfcomm/rfc_mx_fsm.c b/components/bt/bluedroid/profiles/std/rfcomm/rfc_mx_fsm.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/rfc_mx_fsm.c rename to components/bt/bluedroid/profiles/std/rfcomm/rfc_mx_fsm.c diff --git a/components/bt/bluedroid/stack/rfcomm/rfc_port_fsm.c b/components/bt/bluedroid/profiles/std/rfcomm/rfc_port_fsm.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/rfc_port_fsm.c rename to components/bt/bluedroid/profiles/std/rfcomm/rfc_port_fsm.c diff --git a/components/bt/bluedroid/stack/rfcomm/rfc_port_if.c b/components/bt/bluedroid/profiles/std/rfcomm/rfc_port_if.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/rfc_port_if.c rename to components/bt/bluedroid/profiles/std/rfcomm/rfc_port_if.c diff --git a/components/bt/bluedroid/stack/rfcomm/rfc_ts_frames.c b/components/bt/bluedroid/profiles/std/rfcomm/rfc_ts_frames.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/rfc_ts_frames.c rename to components/bt/bluedroid/profiles/std/rfcomm/rfc_ts_frames.c diff --git a/components/bt/bluedroid/stack/rfcomm/rfc_utils.c b/components/bt/bluedroid/profiles/std/rfcomm/rfc_utils.c similarity index 100% rename from components/bt/bluedroid/stack/rfcomm/rfc_utils.c rename to components/bt/bluedroid/profiles/std/rfcomm/rfc_utils.c diff --git a/components/bt/bluedroid/stack/btu/btu_task.c b/components/bt/bluedroid/stack/btu/btu_task.c index 5ae139904..802a67eb1 100755 --- a/components/bt/bluedroid/stack/btu/btu_task.c +++ b/components/bt/bluedroid/stack/btu/btu_task.c @@ -82,9 +82,9 @@ extern void avdt_rcv_sync_info (BT_HDR *p_buf); #include "btm_ble_int.h" #endif -#if (defined(BT_APP_DEMO) && BT_APP_DEMO == TRUE) -#include "bt_app_common.h" -#endif +//#if (defined(BT_APP_DEMO) && BT_APP_DEMO == TRUE) +//#include "bt_app_common.h" +//#endif extern void BTE_InitStack(void); @@ -127,6 +127,8 @@ extern fixed_queue_t *event_queue; //extern thread_t *bt_workqueue_thread; +extern bluedroid_init_done_cb_t bluedroid_init_done_cb; + /* Define a function prototype to allow a generic timeout handler */ typedef void (tUSER_TIMEOUT_FUNC) (TIMER_LIST_ENT *p_tle); @@ -371,8 +373,9 @@ void btu_task_start_up(void) { // Inform the bt jni thread initialization is ok. // btif_transfer_context(btif_init_ok, 0, NULL, 0, NULL); -#if (defined(BT_APP_DEMO) && BT_APP_DEMO == TRUE) - bt_app1_transfer_context(bt_app1_init_ok, 0, NULL, 0, NULL); +#if(defined(BT_APP_DEMO) && BT_APP_DEMO == TRUE) + if (bluedroid_init_done_cb) + bluedroid_init_done_cb(); #endif } diff --git a/components/bt/bluedroid/stack/include/gap_int.h b/components/bt/bluedroid/stack/gap/include/gap_int.h similarity index 100% rename from components/bt/bluedroid/stack/include/gap_int.h rename to components/bt/bluedroid/stack/gap/include/gap_int.h diff --git a/components/bt/bluedroid/stack/include/gatt_int.h b/components/bt/bluedroid/stack/gatt/include/gatt_int.h similarity index 100% rename from components/bt/bluedroid/stack/include/gatt_int.h rename to components/bt/bluedroid/stack/gatt/include/gatt_int.h diff --git a/components/bt/bluedroid/stack/include/avdt_int.h b/components/bt/bluedroid/stack/include/avdt_int.h deleted file mode 100755 index fb1b31360..000000000 --- a/components/bt/bluedroid/stack/include/avdt_int.h +++ /dev/null @@ -1,742 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2002-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This file contains interfaces which are internal to AVDTP. - * - ******************************************************************************/ -#ifndef AVDT_INT_H -#define AVDT_INT_H - -#include "gki.h" -#include "avdt_api.h" -#include "avdtc_api.h" -#include "avdt_defs.h" -#include "l2c_api.h" -#include "btm_api.h" - -#ifndef AVDT_DEBUG -#define AVDT_DEBUG FALSE -#endif - -/***************************************************************************** -** constants -*****************************************************************************/ - -/* channel types */ -enum { - AVDT_CHAN_SIG, /* signaling channel */ - AVDT_CHAN_MEDIA, /* media channel */ -#if AVDT_REPORTING == TRUE - AVDT_CHAN_REPORT, /* reporting channel */ -#endif - AVDT_CHAN_NUM_TYPES -}; - -/* protocol service capabilities of this AVDTP implementation */ -/* for now multiplexing will be used only for fragmentation */ -#if ((AVDT_MULTIPLEXING == TRUE) && (AVDT_REPORTING == TRUE)) -#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT) -#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_REPORT) -#else /* AVDT_MULTIPLEXING && AVDT_REPORTING */ - -#if (AVDT_MULTIPLEXING == TRUE) -#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX | AVDT_PSC_DELAY_RPT) -#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_MUX) -#else /* AVDT_MULTIPLEXING */ - -#if (AVDT_REPORTING == TRUE) -#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT | AVDT_PSC_DELAY_RPT) -#define AVDT_LEG_PSC (AVDT_PSC_TRANS | AVDT_PSC_REPORT) -#else /* AVDT_REPORTING */ -#define AVDT_PSC (AVDT_PSC_TRANS | AVDT_PSC_DELAY_RPT) -#define AVDT_LEG_PSC (AVDT_PSC_TRANS) -#endif /* AVDT_REPORTING */ - -#endif /* AVDT_MULTIPLEXING */ - -#endif /* AVDT_MULTIPLEXING && AVDT_REPORTING */ - -/* initiator/acceptor signaling roles */ -#define AVDT_CLOSE_ACP 0 -#define AVDT_CLOSE_INT 1 -#define AVDT_OPEN_ACP 2 -#define AVDT_OPEN_INT 3 - -/* states for avdt_scb_verify */ -#define AVDT_VERIFY_OPEN 0 -#define AVDT_VERIFY_STREAMING 1 -#define AVDT_VERIFY_SUSPEND 2 -#define AVDT_VERIFY_START 3 - -/* to distinguish CCB events from SCB events */ -#define AVDT_CCB_MKR 0x80 - -/* offset where AVDTP signaling message header starts in message */ -#define AVDT_HDR_OFFSET (L2CAP_MIN_OFFSET + AVDT_NUM_SEPS) - -/* offset where AVDTP signaling message content starts; -** use the size of a start header since it's the largest possible -** layout of signaling message in a buffer is: -** -** | BT_HDR | SCB handles | L2CAP + HCI header | AVDTP header | data ... | -** -** Note that we "hide" the scb handles at the top of the message buffer. -*/ -#define AVDT_MSG_OFFSET (L2CAP_MIN_OFFSET + AVDT_NUM_SEPS + AVDT_LEN_TYPE_START) - -/* scb transport channel connect timeout value */ -#define AVDT_SCB_TC_CONN_TOUT 10 - -/* scb transport channel disconnect timeout value */ -#define AVDT_SCB_TC_DISC_TOUT 10 - -/* maximum number of command retransmissions */ -#ifndef AVDT_RET_MAX -#define AVDT_RET_MAX 1 -#endif - - -/* ccb state machine states */ -enum { - AVDT_CCB_IDLE_ST, - AVDT_CCB_OPENING_ST, - AVDT_CCB_OPEN_ST, - AVDT_CCB_CLOSING_ST -}; - -/* state machine action enumeration list */ -enum { - AVDT_CCB_CHAN_OPEN, - AVDT_CCB_CHAN_CLOSE, - AVDT_CCB_CHK_CLOSE, - AVDT_CCB_HDL_DISCOVER_CMD, - AVDT_CCB_HDL_DISCOVER_RSP, - AVDT_CCB_HDL_GETCAP_CMD, - AVDT_CCB_HDL_GETCAP_RSP, - AVDT_CCB_HDL_START_CMD, - AVDT_CCB_HDL_START_RSP, - AVDT_CCB_HDL_SUSPEND_CMD, - AVDT_CCB_HDL_SUSPEND_RSP, - AVDT_CCB_SND_DISCOVER_CMD, - AVDT_CCB_SND_DISCOVER_RSP, - AVDT_CCB_SND_GETCAP_CMD, - AVDT_CCB_SND_GETCAP_RSP, - AVDT_CCB_SND_START_CMD, - AVDT_CCB_SND_START_RSP, - AVDT_CCB_SND_SUSPEND_CMD, - AVDT_CCB_SND_SUSPEND_RSP, - AVDT_CCB_CLEAR_CMDS, - AVDT_CCB_CMD_FAIL, - AVDT_CCB_FREE_CMD, - AVDT_CCB_CONG_STATE, - AVDT_CCB_RET_CMD, - AVDT_CCB_SND_CMD, - AVDT_CCB_SND_MSG, - AVDT_CCB_SET_RECONN, - AVDT_CCB_CLR_RECONN, - AVDT_CCB_CHK_RECONN, - AVDT_CCB_CHK_TIMER, - AVDT_CCB_SET_CONN, - AVDT_CCB_SET_DISCONN, - AVDT_CCB_DO_DISCONN, - AVDT_CCB_LL_CLOSED, - AVDT_CCB_LL_OPENED, - AVDT_CCB_DEALLOC, - AVDT_CCB_NUM_ACTIONS -}; - -#define AVDT_CCB_IGNORE AVDT_CCB_NUM_ACTIONS - -/* ccb state machine events */ -enum { - AVDT_CCB_API_DISCOVER_REQ_EVT, - AVDT_CCB_API_GETCAP_REQ_EVT, - AVDT_CCB_API_START_REQ_EVT, - AVDT_CCB_API_SUSPEND_REQ_EVT, - AVDT_CCB_API_DISCOVER_RSP_EVT, - AVDT_CCB_API_GETCAP_RSP_EVT, - AVDT_CCB_API_START_RSP_EVT, - AVDT_CCB_API_SUSPEND_RSP_EVT, - AVDT_CCB_API_CONNECT_REQ_EVT, - AVDT_CCB_API_DISCONNECT_REQ_EVT, - AVDT_CCB_MSG_DISCOVER_CMD_EVT, - AVDT_CCB_MSG_GETCAP_CMD_EVT, - AVDT_CCB_MSG_START_CMD_EVT, - AVDT_CCB_MSG_SUSPEND_CMD_EVT, - AVDT_CCB_MSG_DISCOVER_RSP_EVT, - AVDT_CCB_MSG_GETCAP_RSP_EVT, - AVDT_CCB_MSG_START_RSP_EVT, - AVDT_CCB_MSG_SUSPEND_RSP_EVT, - AVDT_CCB_RCVRSP_EVT, - AVDT_CCB_SENDMSG_EVT, - AVDT_CCB_RET_TOUT_EVT, - AVDT_CCB_RSP_TOUT_EVT, - AVDT_CCB_IDLE_TOUT_EVT, - AVDT_CCB_UL_OPEN_EVT, - AVDT_CCB_UL_CLOSE_EVT, - AVDT_CCB_LL_OPEN_EVT, - AVDT_CCB_LL_CLOSE_EVT, - AVDT_CCB_LL_CONG_EVT -}; - - -/* scb state machine states; these state values are private to this module so -** the scb state cannot be read or set by actions functions -*/ -enum { - AVDT_SCB_IDLE_ST, - AVDT_SCB_CONF_ST, - AVDT_SCB_OPENING_ST, - AVDT_SCB_OPEN_ST, - AVDT_SCB_STREAM_ST, - AVDT_SCB_CLOSING_ST -}; - -/* state machine action enumeration list */ -enum { - AVDT_SCB_HDL_ABORT_CMD, - AVDT_SCB_HDL_ABORT_RSP, - AVDT_SCB_HDL_CLOSE_CMD, - AVDT_SCB_HDL_CLOSE_RSP, - AVDT_SCB_HDL_GETCONFIG_CMD, - AVDT_SCB_HDL_GETCONFIG_RSP, - AVDT_SCB_HDL_OPEN_CMD, - AVDT_SCB_HDL_OPEN_REJ, - AVDT_SCB_HDL_OPEN_RSP, - AVDT_SCB_HDL_PKT, - AVDT_SCB_DROP_PKT, - AVDT_SCB_HDL_RECONFIG_CMD, - AVDT_SCB_HDL_RECONFIG_RSP, - AVDT_SCB_HDL_SECURITY_CMD, - AVDT_SCB_HDL_SECURITY_RSP, - AVDT_SCB_HDL_SETCONFIG_CMD, - AVDT_SCB_HDL_SETCONFIG_REJ, - AVDT_SCB_HDL_SETCONFIG_RSP, - AVDT_SCB_HDL_START_CMD, - AVDT_SCB_HDL_START_RSP, - AVDT_SCB_HDL_SUSPEND_CMD, - AVDT_SCB_HDL_SUSPEND_RSP, - AVDT_SCB_HDL_TC_CLOSE, -#if AVDT_REPORTING == TRUE - AVDT_SCB_HDL_TC_CLOSE_STO, -#endif - AVDT_SCB_HDL_TC_OPEN, -#if AVDT_REPORTING == TRUE - AVDT_SCB_HDL_TC_OPEN_STO, -#endif - AVDT_SCB_SND_DELAY_RPT_REQ, - AVDT_SCB_HDL_DELAY_RPT_CMD, - AVDT_SCB_HDL_DELAY_RPT_RSP, - AVDT_SCB_HDL_WRITE_REQ, - AVDT_SCB_SND_ABORT_REQ, - AVDT_SCB_SND_ABORT_RSP, - AVDT_SCB_SND_CLOSE_REQ, - AVDT_SCB_SND_STREAM_CLOSE, - AVDT_SCB_SND_CLOSE_RSP, - AVDT_SCB_SND_GETCONFIG_REQ, - AVDT_SCB_SND_GETCONFIG_RSP, - AVDT_SCB_SND_OPEN_REQ, - AVDT_SCB_SND_OPEN_RSP, - AVDT_SCB_SND_RECONFIG_REQ, - AVDT_SCB_SND_RECONFIG_RSP, - AVDT_SCB_SND_SECURITY_REQ, - AVDT_SCB_SND_SECURITY_RSP, - AVDT_SCB_SND_SETCONFIG_REQ, - AVDT_SCB_SND_SETCONFIG_REJ, - AVDT_SCB_SND_SETCONFIG_RSP, - AVDT_SCB_SND_TC_CLOSE, - AVDT_SCB_CB_ERR, - AVDT_SCB_CONG_STATE, - AVDT_SCB_REJ_STATE, - AVDT_SCB_REJ_IN_USE, - AVDT_SCB_REJ_NOT_IN_USE, - AVDT_SCB_SET_REMOVE, - AVDT_SCB_FREE_PKT, - AVDT_SCB_CLR_PKT, - AVDT_SCB_CHK_SND_PKT, - AVDT_SCB_TC_TIMER, - AVDT_SCB_CLR_VARS, - AVDT_SCB_DEALLOC, - AVDT_SCB_NUM_ACTIONS -}; - -#define AVDT_SCB_IGNORE AVDT_SCB_NUM_ACTIONS - -/* scb state machine events */ -enum { - AVDT_SCB_API_REMOVE_EVT, - AVDT_SCB_API_WRITE_REQ_EVT, - AVDT_SCB_API_GETCONFIG_REQ_EVT, - AVDT_SCB_API_DELAY_RPT_REQ_EVT, - AVDT_SCB_API_SETCONFIG_REQ_EVT, - AVDT_SCB_API_OPEN_REQ_EVT, - AVDT_SCB_API_CLOSE_REQ_EVT, - AVDT_SCB_API_RECONFIG_REQ_EVT, - AVDT_SCB_API_SECURITY_REQ_EVT, - AVDT_SCB_API_ABORT_REQ_EVT, - AVDT_SCB_API_GETCONFIG_RSP_EVT, - AVDT_SCB_API_SETCONFIG_RSP_EVT, - AVDT_SCB_API_SETCONFIG_REJ_EVT, - AVDT_SCB_API_OPEN_RSP_EVT, - AVDT_SCB_API_CLOSE_RSP_EVT, - AVDT_SCB_API_RECONFIG_RSP_EVT, - AVDT_SCB_API_SECURITY_RSP_EVT, - AVDT_SCB_API_ABORT_RSP_EVT, - AVDT_SCB_MSG_SETCONFIG_CMD_EVT, - AVDT_SCB_MSG_GETCONFIG_CMD_EVT, - AVDT_SCB_MSG_OPEN_CMD_EVT, - AVDT_SCB_MSG_START_CMD_EVT, - AVDT_SCB_MSG_SUSPEND_CMD_EVT, - AVDT_SCB_MSG_CLOSE_CMD_EVT, - AVDT_SCB_MSG_ABORT_CMD_EVT, - AVDT_SCB_MSG_RECONFIG_CMD_EVT, - AVDT_SCB_MSG_SECURITY_CMD_EVT, - AVDT_SCB_MSG_DELAY_RPT_CMD_EVT, - AVDT_SCB_MSG_DELAY_RPT_RSP_EVT, - AVDT_SCB_MSG_SETCONFIG_RSP_EVT, - AVDT_SCB_MSG_GETCONFIG_RSP_EVT, - AVDT_SCB_MSG_OPEN_RSP_EVT, - AVDT_SCB_MSG_START_RSP_EVT, - AVDT_SCB_MSG_SUSPEND_RSP_EVT, - AVDT_SCB_MSG_CLOSE_RSP_EVT, - AVDT_SCB_MSG_ABORT_RSP_EVT, - AVDT_SCB_MSG_RECONFIG_RSP_EVT, - AVDT_SCB_MSG_SECURITY_RSP_EVT, - AVDT_SCB_MSG_SETCONFIG_REJ_EVT, - AVDT_SCB_MSG_OPEN_REJ_EVT, - AVDT_SCB_MSG_START_REJ_EVT, - AVDT_SCB_MSG_SUSPEND_REJ_EVT, - AVDT_SCB_TC_TOUT_EVT, - AVDT_SCB_TC_OPEN_EVT, - AVDT_SCB_TC_CLOSE_EVT, - AVDT_SCB_TC_CONG_EVT, - AVDT_SCB_TC_DATA_EVT, - AVDT_SCB_CC_CLOSE_EVT -}; - -/* adaption layer number of stream routing table entries */ -#if AVDT_REPORTING == TRUE -/* 2 channels(1 media, 1 report) for each SEP and one for signalling */ -#define AVDT_NUM_RT_TBL ((AVDT_NUM_SEPS<<1) + 1) -#else -#define AVDT_NUM_RT_TBL (AVDT_NUM_SEPS + 1) -#endif - -/* adaption layer number of transport channel table entries - moved to target.h -#define AVDT_NUM_TC_TBL (AVDT_NUM_SEPS + AVDT_NUM_LINKS) */ - -/* "states" used in transport channel table */ -#define AVDT_AD_ST_UNUSED 0 /* Unused - unallocated */ -#define AVDT_AD_ST_IDLE 1 /* No connection */ -#define AVDT_AD_ST_ACP 2 /* Waiting to accept a connection */ -#define AVDT_AD_ST_INT 3 /* Initiating a connection */ -#define AVDT_AD_ST_CONN 4 /* Waiting for connection confirm */ -#define AVDT_AD_ST_CFG 5 /* Waiting for configuration complete */ -#define AVDT_AD_ST_OPEN 6 /* Channel opened */ -#define AVDT_AD_ST_SEC_INT 7 /* Security process as INT */ -#define AVDT_AD_ST_SEC_ACP 8 /* Security process as ACP */ - -/* Configuration flags. tAVDT_TC_TBL.cfg_flags */ -#define AVDT_L2C_CFG_IND_DONE (1<<0) -#define AVDT_L2C_CFG_CFM_DONE (1<<1) -#define AVDT_L2C_CFG_CONN_INT (1<<2) -#define AVDT_L2C_CFG_CONN_ACP (1<<3) - - -/* result code for avdt_ad_write_req() (L2CA_DataWrite()) */ -#define AVDT_AD_FAILED L2CAP_DW_FAILED /* FALSE */ -#define AVDT_AD_SUCCESS L2CAP_DW_SUCCESS /* TRUE */ -#define AVDT_AD_CONGESTED L2CAP_DW_CONGESTED /* 2 */ - -/***************************************************************************** -** data types -*****************************************************************************/ - -/* msg union of all message parameter types */ -typedef union { - tAVDT_EVT_HDR hdr; - tAVDT_EVT_HDR single; - tAVDT_SETCONFIG config_cmd; - tAVDT_CONFIG reconfig_cmd; - tAVDT_MULTI multi; - tAVDT_SECURITY security_cmd; - tAVDT_DISCOVER discover_rsp; - tAVDT_CONFIG svccap; - tAVDT_SECURITY security_rsp; - tAVDT_DELAY_RPT delay_rpt_cmd; -} tAVDT_MSG; - -/* data type for AVDT_CCB_API_DISCOVER_REQ_EVT */ -typedef struct { - tAVDT_CTRL_CBACK *p_cback; - tAVDT_SEP_INFO *p_sep_info; - UINT8 num_seps; -} tAVDT_CCB_API_DISCOVER; - -/* data type for AVDT_CCB_API_GETCAP_REQ_EVT */ -typedef struct { - tAVDT_EVT_HDR single; - tAVDT_CTRL_CBACK *p_cback; - tAVDT_CFG *p_cfg; -} tAVDT_CCB_API_GETCAP; - -/* data type for AVDT_CCB_API_CONNECT_REQ_EVT */ -typedef struct { - tAVDT_CTRL_CBACK *p_cback; - UINT8 sec_mask; -} tAVDT_CCB_API_CONNECT; - -/* data type for AVDT_CCB_API_DISCONNECT_REQ_EVT */ -typedef struct { - tAVDT_CTRL_CBACK *p_cback; -} tAVDT_CCB_API_DISCONNECT; - -/* union associated with ccb state machine events */ -typedef union { - tAVDT_CCB_API_DISCOVER discover; - tAVDT_CCB_API_GETCAP getcap; - tAVDT_CCB_API_CONNECT connect; - tAVDT_CCB_API_DISCONNECT disconnect; - tAVDT_MSG msg; - BOOLEAN llcong; - UINT8 err_code; -} tAVDT_CCB_EVT; - -/* channel control block type */ -typedef struct { - BD_ADDR peer_addr; /* BD address of peer */ - TIMER_LIST_ENT timer_entry; /* CCB timer list entry */ - BUFFER_Q cmd_q; /* Queue for outgoing command messages */ - BUFFER_Q rsp_q; /* Queue for outgoing response and reject messages */ - tAVDT_CTRL_CBACK *proc_cback; /* Procedure callback function */ - tAVDT_CTRL_CBACK *p_conn_cback; /* Connection/disconnection callback function */ - void *p_proc_data; /* Pointer to data storage for procedure */ - BT_HDR *p_curr_cmd; /* Current command being sent awaiting response */ - BT_HDR *p_curr_msg; /* Current message being sent */ - BT_HDR *p_rx_msg; /* Current message being received */ - BOOLEAN allocated; /* Whether ccb is allocated */ - UINT8 state; /* The CCB state machine state */ - BOOLEAN ll_opened; /* TRUE if LL is opened */ - BOOLEAN proc_busy; /* TRUE when a discover or get capabilities procedure in progress */ - UINT8 proc_param; /* Procedure parameter; either SEID for get capabilities or number of SEPS for discover */ - BOOLEAN cong; /* Whether signaling channel is congested */ - UINT8 label; /* Message header "label" (sequence number) */ - BOOLEAN reconn; /* If TRUE, reinitiate connection after transitioning from CLOSING to IDLE state */ - UINT8 ret_count; /* Command retransmission count */ -} tAVDT_CCB; - -/* type for action functions */ -typedef void (*tAVDT_CCB_ACTION)(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); - -/* type for AVDT_SCB_API_WRITE_REQ_EVT */ -typedef struct { - BT_HDR *p_buf; - UINT32 time_stamp; -#if AVDT_MULTIPLEXING == TRUE - BUFFER_Q frag_q; /* Queue for outgoing media fragments. p_buf should be 0 */ - UINT8 *p_data; - UINT32 data_len; -#endif - UINT8 m_pt; - tAVDT_DATA_OPT_MASK opt; -} tAVDT_SCB_APIWRITE; - -/* type for AVDT_SCB_TC_CLOSE_EVT */ -typedef struct { - UINT8 old_tc_state; /* channel state before closed */ - UINT8 tcid; /* TCID */ - UINT8 type; /* channel type */ -} tAVDT_SCB_TC_CLOSE; - -/* type for scb event data */ -typedef union { - tAVDT_MSG msg; - tAVDT_SCB_APIWRITE apiwrite; - tAVDT_DELAY_RPT apidelay; - tAVDT_OPEN open; - tAVDT_SCB_TC_CLOSE close; - BOOLEAN llcong; - BT_HDR *p_pkt; -} tAVDT_SCB_EVT; - -/* stream control block type */ -typedef struct { - tAVDT_CS cs; /* stream creation struct */ - tAVDT_CFG curr_cfg; /* current configuration */ - tAVDT_CFG req_cfg; /* requested configuration */ - TIMER_LIST_ENT timer_entry; /* timer entry */ - BT_HDR *p_pkt; /* packet waiting to be sent */ - tAVDT_CCB *p_ccb; /* ccb associated with this scb */ - UINT16 media_seq; /* media packet sequence number */ - BOOLEAN allocated; /* whether scb is allocated or unused */ - BOOLEAN in_use; /* whether stream being used by peer */ - BOOLEAN sink_activated; /* A2DP Sink activated/de-activated from Application */ - UINT8 role; /* initiator/acceptor role in current procedure */ - BOOLEAN remove; /* whether CB is marked for removal */ - UINT8 state; /* state machine state */ - UINT8 peer_seid; /* SEID of peer stream */ - UINT8 curr_evt; /* current event; set only by state machine */ - BOOLEAN cong; /* Whether media transport channel is congested */ - UINT8 close_code; /* Error code received in close response */ -#if AVDT_MULTIPLEXING == TRUE - BUFFER_Q frag_q; /* Queue for outgoing media fragments */ - UINT32 frag_off; /* length of already received media fragments */ - UINT32 frag_org_len; /* original length before fragmentation of receiving media packet */ - UINT8 *p_next_frag; /* next fragment to send */ - UINT8 *p_media_buf; /* buffer for media packet assigned by AVDT_SetMediaBuf */ - UINT32 media_buf_len; /* length of buffer for media packet assigned by AVDT_SetMediaBuf */ -#endif -} tAVDT_SCB; - -/* type for action functions */ -typedef void (*tAVDT_SCB_ACTION)(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); - -/* adaption layer type for transport channel table */ -typedef struct { - UINT16 peer_mtu; /* L2CAP mtu of the peer device */ - UINT16 my_mtu; /* Our MTU for this channel */ - UINT16 my_flush_to; /* Our flush timeout for this channel */ - UINT16 lcid; - UINT8 tcid; /* transport channel id */ - UINT8 ccb_idx; /* channel control block associated with this tc */ - UINT8 state; /* transport channel state */ - UINT8 cfg_flags; /* L2CAP configuration flags */ - UINT8 id; -} tAVDT_TC_TBL; - -/* adaption layer type for stream routing table */ -typedef struct { - UINT16 lcid; /* L2CAP LCID of the associated transport channel */ - UINT8 scb_hdl; /* stream control block associated with this tc */ -} tAVDT_RT_TBL; - - -/* adaption layer control block */ -typedef struct { - tAVDT_RT_TBL rt_tbl[AVDT_NUM_LINKS][AVDT_NUM_RT_TBL]; - tAVDT_TC_TBL tc_tbl[AVDT_NUM_TC_TBL]; - UINT8 lcid_tbl[MAX_L2CAP_CHANNELS]; /* map LCID to tc_tbl index */ -} tAVDT_AD; - -/* Control block for AVDT */ -typedef struct { - tAVDT_REG rcb; /* registration control block */ - tAVDT_CCB ccb[AVDT_NUM_LINKS]; /* channel control blocks */ - tAVDT_SCB scb[AVDT_NUM_SEPS]; /* stream control blocks */ - tAVDT_AD ad; /* adaption layer control block */ - tAVDTC_CTRL_CBACK *p_conf_cback; /* conformance callback function */ - tAVDT_CCB_ACTION *p_ccb_act; /* pointer to CCB action functions */ - tAVDT_SCB_ACTION *p_scb_act; /* pointer to SCB action functions */ - tAVDT_CTRL_CBACK *p_conn_cback; /* connection callback function */ - UINT8 trace_level; /* trace level */ -} tAVDT_CB; - - -/***************************************************************************** -** function declarations -*****************************************************************************/ - -/* CCB function declarations */ -extern void avdt_ccb_init(void); -extern void avdt_ccb_event(tAVDT_CCB *p_ccb, UINT8 event, tAVDT_CCB_EVT *p_data); -extern tAVDT_CCB *avdt_ccb_by_bd(BD_ADDR bd_addr); -extern tAVDT_CCB *avdt_ccb_alloc(BD_ADDR bd_addr); -extern void avdt_ccb_dealloc(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern UINT8 avdt_ccb_to_idx(tAVDT_CCB *p_ccb); -extern tAVDT_CCB *avdt_ccb_by_idx(UINT8 idx); - -/* CCB action functions */ -extern void avdt_ccb_chan_open(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_chan_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_chk_close(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_hdl_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_hdl_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_hdl_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_hdl_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_hdl_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_hdl_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_hdl_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_hdl_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_discover_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_discover_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_getcap_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_getcap_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_start_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_start_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_suspend_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_suspend_rsp(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_clear_cmds(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_cmd_fail(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_free_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_cong_state(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_ret_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_cmd(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_snd_msg(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_set_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_clr_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_chk_reconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_chk_timer(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_set_conn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_set_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_do_disconn(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_ll_closed(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); -extern void avdt_ccb_ll_opened(tAVDT_CCB *p_ccb, tAVDT_CCB_EVT *p_data); - -/* SCB function prototypes */ -extern void avdt_scb_event(tAVDT_SCB *p_scb, UINT8 event, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_init(void); -extern tAVDT_SCB *avdt_scb_alloc(tAVDT_CS *p_cs); -extern void avdt_scb_dealloc(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern UINT8 avdt_scb_to_hdl(tAVDT_SCB *p_scb); -extern tAVDT_SCB *avdt_scb_by_hdl(UINT8 hdl); -extern UINT8 avdt_scb_verify(tAVDT_CCB *p_ccb, UINT8 state, UINT8 *p_seid, UINT16 num_seid, UINT8 *p_err_code); -extern void avdt_scb_peer_seid_list(tAVDT_MULTI *p_multi); -extern UINT32 avdt_scb_gen_ssrc(tAVDT_SCB *p_scb); - -/* SCB action functions */ -extern void avdt_scb_hdl_abort_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_abort_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_close_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_close_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_getconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_getconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_open_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_open_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_open_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_drop_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_reconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_security_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_security_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_setconfig_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_setconfig_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_start_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_start_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_suspend_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_suspend_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_delay_rpt_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_delay_rpt_cmd(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_delay_rpt_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_tc_open(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_tc_close_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_tc_open_sto(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_hdl_write_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_abort_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_abort_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_close_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_stream_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_close_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_getconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_getconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_open_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_open_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_reconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_reconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_security_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_security_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_setconfig_req(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_setconfig_rej(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_setconfig_rsp(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_snd_tc_close(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_cb_err(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_cong_state(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_rej_state(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_rej_in_use(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_rej_not_in_use(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_set_remove(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_free_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_chk_snd_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_clr_pkt(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_tc_timer(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_clr_vars(tAVDT_SCB *p_scb, tAVDT_SCB_EVT *p_data); -extern void avdt_scb_queue_frags(tAVDT_SCB *p_scb, UINT8 **pp_data, UINT32 *p_data_len, BUFFER_Q *pq); - -/* msg function declarations */ -extern BOOLEAN avdt_msg_send(tAVDT_CCB *p_ccb, BT_HDR *p_msg); -extern void avdt_msg_send_cmd(tAVDT_CCB *p_ccb, void *p_scb, UINT8 sig_id, tAVDT_MSG *p_params); -extern void avdt_msg_send_rsp(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params); -extern void avdt_msg_send_rej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params); -extern void avdt_msg_send_grej(tAVDT_CCB *p_ccb, UINT8 sig_id, tAVDT_MSG *p_params); -extern void avdt_msg_ind(tAVDT_CCB *p_ccb, BT_HDR *p_buf); - -/* adaption layer function declarations */ -extern void avdt_ad_init(void); -extern UINT8 avdt_ad_type_to_tcid(UINT8 type, tAVDT_SCB *p_scb); -extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_st(UINT8 type, tAVDT_CCB *p_ccb, UINT8 state); -extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_lcid(UINT16 lcid); -extern tAVDT_TC_TBL *avdt_ad_tc_tbl_alloc(tAVDT_CCB *p_ccb); -extern UINT8 avdt_ad_tc_tbl_to_idx(tAVDT_TC_TBL *p_tbl); -extern void avdt_ad_tc_close_ind(tAVDT_TC_TBL *p_tbl, UINT16 reason); -extern void avdt_ad_tc_open_ind(tAVDT_TC_TBL *p_tbl); -extern void avdt_ad_tc_cong_ind(tAVDT_TC_TBL *p_tbl, BOOLEAN is_congested); -extern void avdt_ad_tc_data_ind(tAVDT_TC_TBL *p_tbl, BT_HDR *p_buf); -extern tAVDT_TC_TBL *avdt_ad_tc_tbl_by_type(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb); -extern UINT8 avdt_ad_write_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, BT_HDR *p_buf); -extern void avdt_ad_open_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb, UINT8 role); -extern void avdt_ad_close_req(UINT8 type, tAVDT_CCB *p_ccb, tAVDT_SCB *p_scb); - -extern void avdt_process_timeout(TIMER_LIST_ENT *p_tle); - -/***************************************************************************** -** macros -*****************************************************************************/ - -/* we store the scb and the label in the layer_specific field of the -** current cmd -*/ -#define AVDT_BLD_LAYERSPEC(ls, msg, label) \ - ls = (((label) << 4) | (msg)) - -#define AVDT_LAYERSPEC_LABEL(ls) ((UINT8)((ls) >> 4)) - -#define AVDT_LAYERSPEC_MSG(ls) ((UINT8)((ls) & 0x000F)) - -/***************************************************************************** -** global data -*****************************************************************************/ -#ifdef __cplusplus -extern "C" -{ -#endif - -/****************************************************************************** -** Main Control Block -*******************************************************************************/ -#if AVDT_DYNAMIC_MEMORY == FALSE -extern tAVDT_CB avdt_cb; -#else -extern tAVDT_CB *avdt_cb_ptr; -#define avdt_cb (*avdt_cb_ptr) -#endif - - -/* L2CAP callback registration structure */ -extern const tL2CAP_APPL_INFO avdt_l2c_appl; - -/* reject message event lookup table */ -extern const UINT8 avdt_msg_rej_2_evt[]; -#ifdef __cplusplus -} -#endif - -#endif /* AVDT_INT_H */ diff --git a/components/bt/bluedroid/stack/include/bnep_api.h b/components/bt/bluedroid/stack/include/bnep_api.h deleted file mode 100755 index 3ca31d5d3..000000000 --- a/components/bt/bluedroid/stack/include/bnep_api.h +++ /dev/null @@ -1,464 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2001-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This interface file contains the interface to the Bluetooth Network - * Encapsilation Protocol (BNEP). - * - ******************************************************************************/ -#ifndef BNEP_API_H -#define BNEP_API_H - -#include "l2c_api.h" - -/***************************************************************************** -** Constants -*****************************************************************************/ - -/* Define the minimum offset needed in a GKI buffer for -** sending BNEP packets. Note, we are currently not sending -** extension headers, but may in the future, so allow -** space for them -*/ -#define BNEP_MINIMUM_OFFSET (15 + L2CAP_MIN_OFFSET) -#define BNEP_INVALID_HANDLE 0xFFFF - -/***************************************************************************** -** Type Definitions -*****************************************************************************/ - -/* Define the result codes from BNEP -*/ -enum -{ - BNEP_SUCCESS, /* Success */ - BNEP_CONN_DISCONNECTED, /* Connection terminated */ - BNEP_NO_RESOURCES, /* No resources */ - BNEP_MTU_EXCEDED, /* Attempt to write long data */ - BNEP_INVALID_OFFSET, /* Insufficient offset in GKI buffer */ - BNEP_CONN_FAILED, /* Connection failed */ - BNEP_CONN_FAILED_CFG, /* Connection failed cos of config */ - BNEP_CONN_FAILED_SRC_UUID, /* Connection failed wrong source UUID */ - BNEP_CONN_FAILED_DST_UUID, /* Connection failed wrong destination UUID */ - BNEP_CONN_FAILED_UUID_SIZE, /* Connection failed wrong size UUID */ - BNEP_Q_SIZE_EXCEEDED, /* Too many buffers to dest */ - BNEP_TOO_MANY_FILTERS, /* Too many local filters specified */ - BNEP_SET_FILTER_FAIL, /* Set Filter failed */ - BNEP_WRONG_HANDLE, /* Wrong handle for the connection */ - BNEP_WRONG_STATE, /* Connection is in wrong state */ - BNEP_SECURITY_FAIL, /* Failed because of security */ - BNEP_IGNORE_CMD, /* To ignore the rcvd command */ - BNEP_TX_FLOW_ON, /* tx data flow enabled */ - BNEP_TX_FLOW_OFF /* tx data flow disabled */ - -}; typedef UINT8 tBNEP_RESULT; - - -/*************************** -** Callback Functions -****************************/ - -/* Connection state change callback prototype. Parameters are -** Connection handle -** BD Address of remote -** Connection state change result -** BNEP_SUCCESS indicates connection is success -** All values are used to indicate the reason for failure -** Flag to indicate if it is just a role change -*/ -typedef void (tBNEP_CONN_STATE_CB) (UINT16 handle, - BD_ADDR rem_bda, - tBNEP_RESULT result, - BOOLEAN is_role_change); - - - - -/* Connection indication callback prototype. Parameters are -** BD Address of remote, remote UUID and local UUID -** and flag to indicate role change and handle to the connection -** When BNEP calls this function profile should -** use BNEP_ConnectResp call to accept or reject the request -*/ -typedef void (tBNEP_CONNECT_IND_CB) (UINT16 handle, - BD_ADDR bd_addr, - tBT_UUID *remote_uuid, - tBT_UUID *local_uuid, - BOOLEAN is_role_change); - - - -/* Data buffer received indication callback prototype. Parameters are -** Handle to the connection -** Source BD/Ethernet Address -** Dest BD/Ethernet address -** Protocol -** Pointer to the buffer -** Flag to indicate whether extension headers to be forwarded are present -*/ -typedef void (tBNEP_DATA_BUF_CB) (UINT16 handle, - UINT8 *src, - UINT8 *dst, - UINT16 protocol, - BT_HDR *p_buf, - BOOLEAN fw_ext_present); - - -/* Data received indication callback prototype. Parameters are -** Handle to the connection -** Source BD/Ethernet Address -** Dest BD/Ethernet address -** Protocol -** Pointer to the beginning of the data -** Length of data -** Flag to indicate whether extension headers to be forwarded are present -*/ -typedef void (tBNEP_DATA_IND_CB) (UINT16 handle, - UINT8 *src, - UINT8 *dst, - UINT16 protocol, - UINT8 *p_data, - UINT16 len, - BOOLEAN fw_ext_present); - -/* Flow control callback for TX data. Parameters are -** Handle to the connection -** Event flow status -*/ -typedef void (tBNEP_TX_DATA_FLOW_CB) (UINT16 handle, - tBNEP_RESULT event); - -/* Filters received indication callback prototype. Parameters are -** Handle to the connection -** TRUE if the cb is called for indication -** Ignore this if it is indication, otherwise it is the result -** for the filter set operation performed by the local -** device -** Number of protocol filters present -** Pointer to the filters start. Filters are present in pairs -** of start of the range and end of the range. -** They will be present in big endian order. First -** two bytes will be starting of the first range and -** next two bytes will be ending of the range. -*/ -typedef void (tBNEP_FILTER_IND_CB) (UINT16 handle, - BOOLEAN indication, - tBNEP_RESULT result, - UINT16 num_filters, - UINT8 *p_filters); - - - -/* Multicast Filters received indication callback prototype. Parameters are -** Handle to the connection -** TRUE if the cb is called for indication -** Ignore this if it is indication, otherwise it is the result -** for the filter set operation performed by the local -** device -** Number of multicast filters present -** Pointer to the filters start. Filters are present in pairs -** of start of the range and end of the range. -** First six bytes will be starting of the first range and -** next six bytes will be ending of the range. -*/ -typedef void (tBNEP_MFILTER_IND_CB) (UINT16 handle, - BOOLEAN indication, - tBNEP_RESULT result, - UINT16 num_mfilters, - UINT8 *p_mfilters); - -/* This is the structure used by profile to register with BNEP */ -typedef struct -{ - tBNEP_CONNECT_IND_CB *p_conn_ind_cb; /* To indicate the conn request */ - tBNEP_CONN_STATE_CB *p_conn_state_cb; /* To indicate conn state change */ - tBNEP_DATA_IND_CB *p_data_ind_cb; /* To pass the data received */ - tBNEP_DATA_BUF_CB *p_data_buf_cb; /* To pass the data buffer received */ - tBNEP_TX_DATA_FLOW_CB *p_tx_data_flow_cb; /* data flow callback */ - tBNEP_FILTER_IND_CB *p_filter_ind_cb; /* To indicate that peer set protocol filters */ - tBNEP_MFILTER_IND_CB *p_mfilter_ind_cb; /* To indicate that peer set mcast filters */ - -} tBNEP_REGISTER; - - - -/* This is the structure used by profile to get the status of BNEP */ -typedef struct -{ -#define BNEP_STATUS_FAILE 0 -#define BNEP_STATUS_CONNECTED 1 - UINT8 con_status; - - UINT16 l2cap_cid; - BD_ADDR rem_bda; - UINT16 rem_mtu_size; - UINT16 xmit_q_depth; - - UINT16 sent_num_filters; - UINT16 sent_mcast_filters; - UINT16 rcvd_num_filters; - UINT16 rcvd_mcast_filters; - tBT_UUID src_uuid; - tBT_UUID dst_uuid; - -} tBNEP_STATUS; - - - -/***************************************************************************** -** External Function Declarations -*****************************************************************************/ -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************************************************* -** -** Function BNEP_Register -** -** Description This function is called by the upper layer to register -** its callbacks with BNEP -** -** Parameters: p_reg_info - contains all callback function pointers -** -** -** Returns BNEP_SUCCESS if registered successfully -** BNEP_FAILURE if connection state callback is missing -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_Register (tBNEP_REGISTER *p_reg_info); - -/******************************************************************************* -** -** Function BNEP_Deregister -** -** Description This function is called by the upper layer to de-register -** its callbacks. -** -** Parameters: void -** -** -** Returns void -** -*******************************************************************************/ -extern void BNEP_Deregister (void); - - -/******************************************************************************* -** -** Function BNEP_Connect -** -** Description This function creates a BNEP connection to a remote -** device. -** -** Parameters: p_rem_addr - BD_ADDR of the peer -** src_uuid - source uuid for the connection -** dst_uuid - destination uuid for the connection -** p_handle - pointer to return the handle for the connection -** -** Returns BNEP_SUCCESS if connection started -** BNEP_NO_RESOURCES if no resources -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_Connect (BD_ADDR p_rem_bda, - tBT_UUID *src_uuid, - tBT_UUID *dst_uuid, - UINT16 *p_handle); - -/******************************************************************************* -** -** Function BNEP_ConnectResp -** -** Description This function is called in responce to connection indication -** -** -** Parameters: handle - handle given in the connection indication -** resp - responce for the connection indication -** -** Returns BNEP_SUCCESS if connection started -** BNEP_WRONG_HANDLE if the connection is not found -** BNEP_WRONG_STATE if the responce is not expected -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_ConnectResp (UINT16 handle, tBNEP_RESULT resp); - -/******************************************************************************* -** -** Function BNEP_Disconnect -** -** Description This function is called to close the specified connection. -** -** Parameters: handle - handle of the connection -** -** Returns BNEP_SUCCESS if connection is disconnected -** BNEP_WRONG_HANDLE if no connection is not found -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_Disconnect (UINT16 handle); - -/******************************************************************************* -** -** Function BNEP_WriteBuf -** -** Description This function sends data in a GKI buffer on BNEP connection -** -** Parameters: handle - handle of the connection to write -** p_dest_addr - BD_ADDR/Ethernet addr of the destination -** p_buf - pointer to address of buffer with data -** protocol - protocol type of the packet -** p_src_addr - (optional) BD_ADDR/ethernet address of the source -** (should be NULL if it is local BD Addr) -** fw_ext_present - forwarded extensions present -** -** Returns: BNEP_WRONG_HANDLE - if passed handle is not valid -** BNEP_MTU_EXCEDED - If the data length is greater than MTU -** BNEP_IGNORE_CMD - If the packet is filtered out -** BNEP_Q_SIZE_EXCEEDED - If the Tx Q is full -** BNEP_SUCCESS - If written successfully -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_WriteBuf (UINT16 handle, - UINT8 *p_dest_addr, - BT_HDR *p_buf, - UINT16 protocol, - UINT8 *p_src_addr, - BOOLEAN fw_ext_present); - -/******************************************************************************* -** -** Function BNEP_Write -** -** Description This function sends data over a BNEP connection -** -** Parameters: handle - handle of the connection to write -** p_dest_addr - BD_ADDR/Ethernet addr of the destination -** p_data - pointer to data start -** protocol - protocol type of the packet -** p_src_addr - (optional) BD_ADDR/ethernet address of the source -** (should be NULL if it is local BD Addr) -** fw_ext_present - forwarded extensions present -** -** Returns: BNEP_WRONG_HANDLE - if passed handle is not valid -** BNEP_MTU_EXCEDED - If the data length is greater than MTU -** BNEP_IGNORE_CMD - If the packet is filtered out -** BNEP_Q_SIZE_EXCEEDED - If the Tx Q is full -** BNEP_NO_RESOURCES - If not able to allocate a buffer -** BNEP_SUCCESS - If written successfully -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_Write (UINT16 handle, - UINT8 *p_dest_addr, - UINT8 *p_data, - UINT16 len, - UINT16 protocol, - UINT8 *p_src_addr, - BOOLEAN fw_ext_present); - -/******************************************************************************* -** -** Function BNEP_SetProtocolFilters -** -** Description This function sets the protocol filters on peer device -** -** Parameters: handle - Handle for the connection -** num_filters - total number of filter ranges -** p_start_array - Array of beginings of all protocol ranges -** p_end_array - Array of ends of all protocol ranges -** -** Returns BNEP_WRONG_HANDLE - if the connection handle is not valid -** BNEP_SET_FILTER_FAIL - if the connection is in wrong state -** BNEP_TOO_MANY_FILTERS - if too many filters -** BNEP_SUCCESS - if request sent successfully -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_SetProtocolFilters (UINT16 handle, - UINT16 num_filters, - UINT16 *p_start_array, - UINT16 *p_end_array); - -/******************************************************************************* -** -** Function BNEP_SetMulticastFilters -** -** Description This function sets the filters for multicast addresses for BNEP. -** -** Parameters: handle - Handle for the connection -** num_filters - total number of filter ranges -** p_start_array - Pointer to sequence of beginings of all -** multicast address ranges -** p_end_array - Pointer to sequence of ends of all -** multicast address ranges -** -** Returns BNEP_WRONG_HANDLE - if the connection handle is not valid -** BNEP_SET_FILTER_FAIL - if the connection is in wrong state -** BNEP_TOO_MANY_FILTERS - if too many filters -** BNEP_SUCCESS - if request sent successfully -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_SetMulticastFilters (UINT16 handle, - UINT16 num_filters, - UINT8 *p_start_array, - UINT8 *p_end_array); - -/******************************************************************************* -** -** Function BNEP_SetTraceLevel -** -** Description This function sets the trace level for BNEP. If called with -** a value of 0xFF, it simply reads the current trace level. -** -** Returns the new (current) trace level -** -*******************************************************************************/ -extern UINT8 BNEP_SetTraceLevel (UINT8 new_level); - -/******************************************************************************* -** -** Function BNEP_Init -** -** Description This function initializes the BNEP unit. It should be called -** before accessing any other APIs to initialize the control block -** -** Returns void -** -*******************************************************************************/ -extern void BNEP_Init (void); - -/******************************************************************************* -** -** Function BNEP_GetStatus -** -** Description This function gets the status information for BNEP connection -** -** Returns BNEP_SUCCESS - if the status is available -** BNEP_NO_RESOURCES - if no structure is passed for output -** BNEP_WRONG_HANDLE - if the handle is invalid -** BNEP_WRONG_STATE - if not in connected state -** -*******************************************************************************/ -extern tBNEP_RESULT BNEP_GetStatus (UINT16 handle, tBNEP_STATUS *p_status); - - - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/components/bt/bluedroid/stack/include/bnep_int.h b/components/bt/bluedroid/stack/include/bnep_int.h deleted file mode 100755 index 5322e5039..000000000 --- a/components/bt/bluedroid/stack/include/bnep_int.h +++ /dev/null @@ -1,250 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2001-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This file contains internally used BNEP definitions - * - ******************************************************************************/ - -#ifndef BNEP_INT_H -#define BNEP_INT_H - -#include "bt_target.h" -#include "gki.h" -#include "bnep_api.h" -#include "btm_int.h" -#include "btu.h" - - -/* BNEP frame types -*/ -#define BNEP_FRAME_GENERAL_ETHERNET 0x00 -#define BNEP_FRAME_CONTROL 0x01 -#define BNEP_FRAME_COMPRESSED_ETHERNET 0x02 -#define BNEP_FRAME_COMPRESSED_ETHERNET_SRC_ONLY 0x03 -#define BNEP_FRAME_COMPRESSED_ETHERNET_DEST_ONLY 0x04 - - -/* BNEP filter control message types -*/ -#define BNEP_CONTROL_COMMAND_NOT_UNDERSTOOD 0x00 -#define BNEP_SETUP_CONNECTION_REQUEST_MSG 0x01 -#define BNEP_SETUP_CONNECTION_RESPONSE_MSG 0x02 -#define BNEP_FILTER_NET_TYPE_SET_MSG 0x03 -#define BNEP_FILTER_NET_TYPE_RESPONSE_MSG 0x04 -#define BNEP_FILTER_MULTI_ADDR_SET_MSG 0x05 -#define BNEP_FILTER_MULTI_ADDR_RESPONSE_MSG 0x06 - - -/* BNEP header extension types -*/ -#define BNEP_EXTENSION_FILTER_CONTROL 0x00 - - -/* BNEP Setup Connection response codes -*/ -#define BNEP_SETUP_CONN_OK 0x0000 -#define BNEP_SETUP_INVALID_DEST_UUID 0x0001 -#define BNEP_SETUP_INVALID_SRC_UUID 0x0002 -#define BNEP_SETUP_INVALID_UUID_SIZE 0x0003 -#define BNEP_SETUP_CONN_NOT_ALLOWED 0x0004 - - -/* BNEP filter control response codes -*/ -#define BNEP_FILTER_CRL_OK 0x0000 -#define BNEP_FILTER_CRL_UNSUPPORTED 0x0001 -#define BNEP_FILTER_CRL_BAD_RANGE 0x0002 -#define BNEP_FILTER_CRL_MAX_REACHED 0x0003 -#define BNEP_FILTER_CRL_SECURITY_ERR 0x0004 - - -/* 802.1p protocol packet will have actual protocol field in side the payload */ -#define BNEP_802_1_P_PROTOCOL 0x8100 - -/* Timeout definitions. -*/ -#define BNEP_CONN_TIMEOUT 20 /* Connection related timeout */ -#define BNEP_HOST_TIMEOUT 200 /* host responce timeout */ -#define BNEP_FILTER_SET_TIMEOUT 10 - -/* Define the Out-Flow default values. */ -#define BNEP_OFLOW_QOS_FLAG 0 -#define BNEP_OFLOW_SERV_TYPE 0 -#define BNEP_OFLOW_TOKEN_RATE 0 -#define BNEP_OFLOW_TOKEN_BUCKET_SIZE 0 -#define BNEP_OFLOW_PEAK_BANDWIDTH 0 -#define BNEP_OFLOW_LATENCY 0 -#define BNEP_OFLOW_DELAY_VARIATION 0 - -/* Define the In-Flow default values. */ -#define BNEP_IFLOW_QOS_FLAG 0 -#define BNEP_IFLOW_SERV_TYPE 0 -#define BNEP_IFLOW_TOKEN_RATE 0 -#define BNEP_IFLOW_TOKEN_BUCKET_SIZE 0 -#define BNEP_IFLOW_PEAK_BANDWIDTH 0 -#define BNEP_IFLOW_LATENCY 0 -#define BNEP_IFLOW_DELAY_VARIATION 0 - -#define BNEP_FLUSH_TO 0xFFFF - -#define BNEP_MAX_RETRANSMITS 3 - -/* Define the BNEP Connection Control Block -*/ -typedef struct -{ -#define BNEP_STATE_IDLE 0 -#define BNEP_STATE_CONN_START 1 -#define BNEP_STATE_CFG_SETUP 2 -#define BNEP_STATE_CONN_SETUP 3 -#define BNEP_STATE_SEC_CHECKING 4 -#define BNEP_STATE_SETUP_RCVD 5 -#define BNEP_STATE_CONNECTED 6 - UINT8 con_state; - -#define BNEP_FLAGS_IS_ORIG 0x01 -#define BNEP_FLAGS_HIS_CFG_DONE 0x02 -#define BNEP_FLAGS_MY_CFG_DONE 0x04 -#define BNEP_FLAGS_L2CAP_CONGESTED 0x08 -#define BNEP_FLAGS_FILTER_RESP_PEND 0x10 -#define BNEP_FLAGS_MULTI_RESP_PEND 0x20 -#define BNEP_FLAGS_SETUP_RCVD 0x40 -#define BNEP_FLAGS_CONN_COMPLETED 0x80 - UINT8 con_flags; - BT_HDR *p_pending_data; - - UINT16 l2cap_cid; - BD_ADDR rem_bda; - UINT16 rem_mtu_size; - TIMER_LIST_ENT conn_tle; - BUFFER_Q xmit_q; - - UINT16 sent_num_filters; - UINT16 sent_prot_filter_start[BNEP_MAX_PROT_FILTERS]; - UINT16 sent_prot_filter_end[BNEP_MAX_PROT_FILTERS]; - - UINT16 sent_mcast_filters; - BD_ADDR sent_mcast_filter_start[BNEP_MAX_MULTI_FILTERS]; - BD_ADDR sent_mcast_filter_end[BNEP_MAX_MULTI_FILTERS]; - - UINT16 rcvd_num_filters; - UINT16 rcvd_prot_filter_start[BNEP_MAX_PROT_FILTERS]; - UINT16 rcvd_prot_filter_end[BNEP_MAX_PROT_FILTERS]; - - UINT16 rcvd_mcast_filters; - BD_ADDR rcvd_mcast_filter_start[BNEP_MAX_MULTI_FILTERS]; - BD_ADDR rcvd_mcast_filter_end[BNEP_MAX_MULTI_FILTERS]; - - UINT16 bad_pkts_rcvd; - UINT8 re_transmits; - UINT16 handle; - tBT_UUID prv_src_uuid; - tBT_UUID prv_dst_uuid; - tBT_UUID src_uuid; - tBT_UUID dst_uuid; - -} tBNEP_CONN; - - -/* The main BNEP control block -*/ -typedef struct -{ - tL2CAP_CFG_INFO l2cap_my_cfg; /* My L2CAP config */ - tBNEP_CONN bcb[BNEP_MAX_CONNECTIONS]; - - tBNEP_CONNECT_IND_CB *p_conn_ind_cb; - tBNEP_CONN_STATE_CB *p_conn_state_cb; - tBNEP_DATA_IND_CB *p_data_ind_cb; - tBNEP_DATA_BUF_CB *p_data_buf_cb; - tBNEP_FILTER_IND_CB *p_filter_ind_cb; - tBNEP_MFILTER_IND_CB *p_mfilter_ind_cb; - tBNEP_TX_DATA_FLOW_CB *p_tx_data_flow_cb; - - tL2CAP_APPL_INFO reg_info; - - TIMER_LIST_ENT bnep_tle; - BOOLEAN profile_registered; /* TRUE when we got our BD addr */ - UINT8 trace_level; - -} tBNEP_CB; - -#ifdef __cplusplus -extern "C" { -#endif - -/* Global BNEP data -*/ -#if BNEP_DYNAMIC_MEMORY == FALSE -extern tBNEP_CB bnep_cb; -#else -extern tBNEP_CB *bnep_cb_ptr; -#define bnep_cb (*bnep_cb_ptr) -#endif - -/* Functions provided by bnep_main.c -*/ -extern tBNEP_RESULT bnep_register_with_l2cap (void); -extern void bnep_disconnect (tBNEP_CONN *p_bcb, UINT16 reason); -extern tBNEP_CONN *bnep_conn_originate (UINT8 *p_bd_addr); -extern void bnep_process_timeout (TIMER_LIST_ENT *p_tle); -extern void bnep_connected (tBNEP_CONN *p_bcb); - - -/* Functions provided by bnep_utils.c -*/ -extern tBNEP_CONN *bnepu_find_bcb_by_cid (UINT16 cid); -extern tBNEP_CONN *bnepu_find_bcb_by_bd_addr (UINT8 *p_bda); -extern tBNEP_CONN *bnepu_allocate_bcb (BD_ADDR p_rem_bda); -extern void bnepu_release_bcb (tBNEP_CONN *p_bcb); -extern void bnepu_send_peer_our_filters (tBNEP_CONN *p_bcb); -extern void bnepu_send_peer_our_multi_filters (tBNEP_CONN *p_bcb); -extern BOOLEAN bnepu_does_dest_support_prot (tBNEP_CONN *p_bcb, UINT16 protocol); -extern void bnepu_build_bnep_hdr (tBNEP_CONN *p_bcb, BT_HDR *p_buf, UINT16 protocol, - UINT8 *p_src_addr, UINT8 *p_dest_addr, BOOLEAN ext_bit); -extern void test_bnepu_build_bnep_hdr (tBNEP_CONN *p_bcb, BT_HDR *p_buf, UINT16 protocol, - UINT8 *p_src_addr, UINT8 *p_dest_addr, UINT8 type); - -extern tBNEP_CONN *bnepu_get_route_to_dest (UINT8 *p_bda); -extern void bnepu_check_send_packet (tBNEP_CONN *p_bcb, BT_HDR *p_buf); -extern void bnep_send_command_not_understood (tBNEP_CONN *p_bcb, UINT8 cmd_code); -extern void bnepu_process_peer_filter_set (tBNEP_CONN *p_bcb, UINT8 *p_filters, UINT16 len); -extern void bnepu_process_peer_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data); -extern void bnepu_process_multicast_filter_rsp (tBNEP_CONN *p_bcb, UINT8 *p_data); -extern void bnep_send_conn_req (tBNEP_CONN *p_bcb); -extern void bnep_send_conn_responce (tBNEP_CONN *p_bcb, UINT16 resp_code); -extern void bnep_process_setup_conn_req (tBNEP_CONN *p_bcb, UINT8 *p_setup, UINT8 len); -extern void bnep_process_setup_conn_responce (tBNEP_CONN *p_bcb, UINT8 *p_setup); -extern UINT8 *bnep_process_control_packet (tBNEP_CONN *p_bcb, UINT8 *p, UINT16 *len, - BOOLEAN is_ext); -extern void bnep_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT trasnport, - void *p_ref_data, UINT8 result); -extern tBNEP_RESULT bnep_is_packet_allowed (tBNEP_CONN *p_bcb, BD_ADDR p_dest_addr, UINT16 protocol, - BOOLEAN fw_ext_present, UINT8 *p_data); -extern UINT32 bnep_get_uuid32 (tBT_UUID *src_uuid); - - - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/components/bt/bluedroid/stack/include/pan_api.h b/components/bt/bluedroid/stack/include/pan_api.h deleted file mode 100755 index 17826b503..000000000 --- a/components/bt/bluedroid/stack/include/pan_api.h +++ /dev/null @@ -1,459 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2001-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * this file contains the PAN API definitions - * - ******************************************************************************/ -#ifndef PAN_API_H -#define PAN_API_H - -#include "bnep_api.h" - -/***************************************************************************** -** Constants -*****************************************************************************/ - -/* Define the minimum offset needed in a GKI buffer for -** sending PAN packets. Note, we are currently not sending -** extension headers, but may in the future, so allow -** space for them -*/ -#define PAN_MINIMUM_OFFSET BNEP_MINIMUM_OFFSET - - -/* -** The handle is passed from BNEP to PAN. The same handle is used -** between PAN and application as well -*/ -#define PAN_INVALID_HANDLE BNEP_INVALID_HANDLE - -/* Bit map for PAN roles */ -#define PAN_ROLE_CLIENT 0x01 /* PANU role */ -#define PAN_ROLE_GN_SERVER 0x02 /* GN role */ -#define PAN_ROLE_NAP_SERVER 0x04 /* NAP role */ - -/* Bitmap to indicate the usage of the Data */ -#define PAN_DATA_TO_HOST 0x01 -#define PAN_DATA_TO_LAN 0x02 - - -/***************************************************************************** -** Type Definitions -*****************************************************************************/ - -/* Define the result codes from PAN */ -enum -{ - PAN_SUCCESS, /* Success */ - PAN_DISCONNECTED = BNEP_CONN_DISCONNECTED, /* Connection terminated */ - PAN_CONN_FAILED = BNEP_CONN_FAILED, /* Connection failed */ - PAN_NO_RESOURCES = BNEP_NO_RESOURCES, /* No resources */ - PAN_MTU_EXCEDED = BNEP_MTU_EXCEDED, /* Attempt to write long data */ - PAN_INVALID_OFFSET = BNEP_INVALID_OFFSET, /* Insufficient offset in GKI buffer */ - PAN_CONN_FAILED_CFG = BNEP_CONN_FAILED_CFG, /* Connection failed cos of config */ - PAN_INVALID_SRC_ROLE = BNEP_CONN_FAILED_SRC_UUID, /* Connection failed wrong source UUID */ - PAN_INVALID_DST_ROLE = BNEP_CONN_FAILED_DST_UUID, /* Connection failed wrong destination UUID */ - PAN_CONN_FAILED_UUID_SIZE = BNEP_CONN_FAILED_UUID_SIZE, /* Connection failed wrong size UUID */ - PAN_Q_SIZE_EXCEEDED = BNEP_Q_SIZE_EXCEEDED, /* Too many buffers to dest */ - PAN_TOO_MANY_FILTERS = BNEP_TOO_MANY_FILTERS, /* Too many local filters specified */ - PAN_SET_FILTER_FAIL = BNEP_SET_FILTER_FAIL, /* Set Filter failed */ - PAN_WRONG_HANDLE = BNEP_WRONG_HANDLE, /* Wrong handle for the connection */ - PAN_WRONG_STATE = BNEP_WRONG_STATE, /* Connection is in wrong state */ - PAN_SECURITY_FAIL = BNEP_SECURITY_FAIL, /* Failed because of security */ - PAN_IGNORE_CMD = BNEP_IGNORE_CMD, /* To ignore the rcvd command */ - PAN_TX_FLOW_ON = BNEP_TX_FLOW_ON, /* tx data flow enabled */ - PAN_TX_FLOW_OFF = BNEP_TX_FLOW_OFF, /* tx data flow disabled */ - PAN_FAILURE /* Failure */ - -}; -typedef UINT8 tPAN_RESULT; - - -/***************************************************************** -** Callback Function Prototypes -*****************************************************************/ - -/* This is call back function used to report connection status -** to the application. The second parameter TRUE means -** to create the bridge and FALSE means to remove it. -*/ -typedef void (tPAN_CONN_STATE_CB) (UINT16 handle, BD_ADDR bd_addr, tPAN_RESULT state, BOOLEAN is_role_change, - UINT8 src_role, UINT8 dst_role); - - -/* This is call back function used to create bridge for the -** Connected device. The parameter "state" indicates -** whether to create the bridge or remove it. TRUE means -** to create the bridge and FALSE means to remove it. -*/ -typedef void (tPAN_BRIDGE_REQ_CB) (BD_ADDR bd_addr, BOOLEAN state); - - -/* Data received indication callback prototype. Parameters are -** Source BD/Ethernet Address -** Dest BD/Ethernet address -** Protocol -** Address of buffer (or data if non-GKI) -** Length of data (non-GKI) -** ext is flag to indicate whether it has aby extension headers -** Flag used to indicate to forward on LAN -** FALSE - Use it for internal stack -** TRUE - Send it across the ethernet as well -*/ -typedef void (tPAN_DATA_IND_CB) (UINT16 handle, - BD_ADDR src, - BD_ADDR dst, - UINT16 protocol, - UINT8 *p_data, - UINT16 len, - BOOLEAN ext, - BOOLEAN forward); - - -/* Data buffer received indication callback prototype. Parameters are -** Source BD/Ethernet Address -** Dest BD/Ethernet address -** Protocol -** pointer to the data buffer -** ext is flag to indicate whether it has aby extension headers -** Flag used to indicate to forward on LAN -** FALSE - Use it for internal stack -** TRUE - Send it across the ethernet as well -*/ -typedef void (tPAN_DATA_BUF_IND_CB) (UINT16 handle, - BD_ADDR src, - BD_ADDR dst, - UINT16 protocol, - BT_HDR *p_buf, - BOOLEAN ext, - BOOLEAN forward); - - -/* Flow control callback for TX data. Parameters are -** Handle to the connection -** Event flow status -*/ -typedef void (tPAN_TX_DATA_FLOW_CB) (UINT16 handle, - tPAN_RESULT event); - -/* Filters received indication callback prototype. Parameters are -** Handle to the connection -** TRUE if the cb is called for indication -** Ignore this if it is indication, otherwise it is the result -** for the filter set operation performed by the local -** device -** Number of protocol filters present -** Pointer to the filters start. Filters are present in pairs -** of start of the range and end of the range. -** They will be present in big endian order. First -** two bytes will be starting of the first range and -** next two bytes will be ending of the range. -*/ -typedef void (tPAN_FILTER_IND_CB) (UINT16 handle, - BOOLEAN indication, - tBNEP_RESULT result, - UINT16 num_filters, - UINT8 *p_filters); - - - -/* Multicast Filters received indication callback prototype. Parameters are -** Handle to the connection -** TRUE if the cb is called for indication -** Ignore this if it is indication, otherwise it is the result -** for the filter set operation performed by the local -** device -** Number of multicast filters present -** Pointer to the filters start. Filters are present in pairs -** of start of the range and end of the range. -** First six bytes will be starting of the first range and -** next six bytes will be ending of the range. -*/ -typedef void (tPAN_MFILTER_IND_CB) (UINT16 handle, - BOOLEAN indication, - tBNEP_RESULT result, - UINT16 num_mfilters, - UINT8 *p_mfilters); - - - - -/* This structure is used to register with PAN profile -** It is passed as a parameter to PAN_Register call. -*/ -typedef struct -{ - tPAN_CONN_STATE_CB *pan_conn_state_cb; /* Connection state callback */ - tPAN_BRIDGE_REQ_CB *pan_bridge_req_cb; /* Bridge request callback */ - tPAN_DATA_IND_CB *pan_data_ind_cb; /* Data indication callback */ - tPAN_DATA_BUF_IND_CB *pan_data_buf_ind_cb; /* Data buffer indication callback */ - tPAN_FILTER_IND_CB *pan_pfilt_ind_cb; /* protocol filter indication callback */ - tPAN_MFILTER_IND_CB *pan_mfilt_ind_cb; /* multicast filter indication callback */ - tPAN_TX_DATA_FLOW_CB *pan_tx_data_flow_cb; /* data flow callback */ - char *user_service_name; /* Service name for PANU role */ - char *gn_service_name; /* Service name for GN role */ - char *nap_service_name; /* Service name for NAP role */ - -} tPAN_REGISTER; - - -/***************************************************************************** -** External Function Declarations -*****************************************************************************/ -#ifdef __cplusplus -extern "C" -{ -#endif - -/******************************************************************************* -** -** Function PAN_Register -** -** Description This function is called by the application to register -** its callbacks with PAN profile. The application then -** should set the PAN role explicitly. -** -** Parameters: p_register - contains all callback function pointers -** -** -** Returns none -** -*******************************************************************************/ -extern void PAN_Register (tPAN_REGISTER *p_register); - - -/******************************************************************************* -** -** Function PAN_Deregister -** -** Description This function is called by the application to de-register -** its callbacks with PAN profile. This will make the PAN to -** become inactive. This will deregister PAN services from SDP -** and close all active connections -** -** Returns none -** -*******************************************************************************/ -extern void PAN_Deregister (void); - -/******************************************************************************* -** -** Function PAN_SetRole -** -** Description This function is called by the application to set the PAN -** profile role. This should be called after PAN_Register. -** This can be called any time to change the PAN role -** -** Parameters: role - is bit map of roles to be active -** PAN_ROLE_CLIENT is for PANU role -** PAN_ROLE_GN_SERVER is for GN role -** PAN_ROLE_NAP_SERVER is for NAP role -** sec_mask - Security mask for different roles -** It is array of UINT8. The byte represent the -** security for roles PANU, GN and NAP in order -** p_user_name - Service name for PANU role -** p_gn_name - Service name for GN role -** p_nap_name - Service name for NAP role -** Can be NULL if user wants it to be default -** -** Returns PAN_SUCCESS - if the role is set successfully -** PAN_FAILURE - if the role is not valid -** -*******************************************************************************/ -extern tPAN_RESULT PAN_SetRole (UINT8 role, - UINT8 *sec_mask, - char *p_user_name, - char *p_gn_name, - char *p_nap_name); - -/******************************************************************************* -** -** Function PAN_Connect -** -** Description This function is called by the application to initiate a -** connection to the remote device -** -** Parameters: rem_bda - BD Addr of the remote device -** src_role - Role of the local device for the connection -** dst_role - Role of the remote device for the connection -** PAN_ROLE_CLIENT is for PANU role -** PAN_ROLE_GN_SERVER is for GN role -** PAN_ROLE_NAP_SERVER is for NAP role -** *handle - Pointer for returning Handle to the connection -** -** Returns PAN_SUCCESS - if the connection is initiated successfully -** PAN_NO_RESOURCES - resources are not sufficent -** PAN_FAILURE - if the connection cannot be initiated -** this can be because of the combination of -** src and dst roles may not be valid or -** allowed at that point of time -** -*******************************************************************************/ -extern tPAN_RESULT PAN_Connect (BD_ADDR rem_bda, UINT8 src_role, UINT8 dst_role, UINT16 *handle); - -/******************************************************************************* -** -** Function PAN_Disconnect -** -** Description This is used to disconnect the connection -** -** Parameters: handle - handle for the connection -** -** Returns PAN_SUCCESS - if the connection is closed successfully -** PAN_FAILURE - if the connection is not found or -** there is an error in disconnecting -** -*******************************************************************************/ -extern tPAN_RESULT PAN_Disconnect (UINT16 handle); - -/******************************************************************************* -** -** Function PAN_Write -** -** Description This sends data over the PAN connections. If this is called -** on GN or NAP side and the packet is multicast or broadcast -** it will be sent on all the links. Otherwise the correct link -** is found based on the destination address and forwarded on it -** If the return value is not PAN_SUCCESS the application should -** take care of releasing the message buffer -** -** Parameters: dst - MAC or BD Addr of the destination device -** src - MAC or BD Addr of the source who sent this packet -** protocol - protocol of the ethernet packet like IP or ARP -** p_data - pointer to the data -** len - length of the data -** ext - to indicate that extension headers present -** -** Returns PAN_SUCCESS - if the data is sent successfully -** PAN_FAILURE - if the connection is not found or -** there is an error in sending data -** -*******************************************************************************/ -extern tPAN_RESULT PAN_Write (UINT16 handle, - BD_ADDR dst, - BD_ADDR src, - UINT16 protocol, - UINT8 *p_data, - UINT16 len, - BOOLEAN ext); - -/******************************************************************************* -** -** Function PAN_WriteBuf -** -** Description This sends data over the PAN connections. If this is called -** on GN or NAP side and the packet is multicast or broadcast -** it will be sent on all the links. Otherwise the correct link -** is found based on the destination address and forwarded on it -** If the return value is not PAN_SUCCESS the application should -** take care of releasing the message buffer -** -** Parameters: dst - MAC or BD Addr of the destination device -** src - MAC or BD Addr of the source who sent this packet -** protocol - protocol of the ethernet packet like IP or ARP -** p_buf - pointer to the data buffer -** ext - to indicate that extension headers present -** -** Returns PAN_SUCCESS - if the data is sent successfully -** PAN_FAILURE - if the connection is not found or -** there is an error in sending data -** -*******************************************************************************/ -extern tPAN_RESULT PAN_WriteBuf (UINT16 handle, - BD_ADDR dst, - BD_ADDR src, - UINT16 protocol, - BT_HDR *p_buf, - BOOLEAN ext); - -/******************************************************************************* -** -** Function PAN_SetProtocolFilters -** -** Description This function is used to set protocol filters on the peer -** -** Parameters: handle - handle for the connection -** num_filters - number of protocol filter ranges -** start - array of starting protocol numbers -** end - array of ending protocol numbers -** -** -** Returns PAN_SUCCESS if protocol filters are set successfully -** PAN_FAILURE if connection not found or error in setting -** -*******************************************************************************/ -extern tPAN_RESULT PAN_SetProtocolFilters (UINT16 handle, - UINT16 num_filters, - UINT16 *p_start_array, - UINT16 *p_end_array); - -/******************************************************************************* -** -** Function PAN_SetMulticastFilters -** -** Description This function is used to set multicast filters on the peer -** -** Parameters: handle - handle for the connection -** num_filters - number of multicast filter ranges -** p_start_array - Pointer to sequence of beginings of all -** multicast address ranges -** p_end_array - Pointer to sequence of ends of all -** multicast address ranges -** -** -** Returns PAN_SUCCESS if multicast filters are set successfully -** PAN_FAILURE if connection not found or error in setting -** -*******************************************************************************/ -extern tBNEP_RESULT PAN_SetMulticastFilters (UINT16 handle, - UINT16 num_mcast_filters, - UINT8 *p_start_array, - UINT8 *p_end_array); - -/******************************************************************************* -** -** Function PAN_SetTraceLevel -** -** Description This function sets the trace level for PAN. If called with -** a value of 0xFF, it simply reads the current trace level. -** -** Returns the new (current) trace level -** -*******************************************************************************/ -extern UINT8 PAN_SetTraceLevel (UINT8 new_level); - -/******************************************************************************* -** -** Function PAN_Init -** -** Description This function initializes the PAN unit. It should be called -** before accessing any other APIs to initialize the control -** block. -** -** Returns void -** -*******************************************************************************/ -extern void PAN_Init (void); - -#ifdef __cplusplus -} -#endif - -#endif /* PAN_API_H */ diff --git a/components/bt/bluedroid/stack/include/pan_int.h b/components/bt/bluedroid/stack/include/pan_int.h deleted file mode 100755 index 4e463e668..000000000 --- a/components/bt/bluedroid/stack/include/pan_int.h +++ /dev/null @@ -1,156 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2001-2012 Broadcom Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at: - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -/****************************************************************************** - * - * This file contains internally used PAN definitions - * - ******************************************************************************/ - -#ifndef PAN_INT_H -#define PAN_INT_H - -#include "pan_api.h" - -/* -** This role is used to shutdown the profile. Used internally -** Applications should call PAN_Deregister to shutdown the profile -*/ -#define PAN_ROLE_INACTIVE 0 - -/* Protocols supported by the host internal stack, are registered with SDP */ -#define PAN_PROTOCOL_IP 0x0800 -#define PAN_PROTOCOL_ARP 0x0806 - -#define PAN_PROFILE_VERSION 0x0100 /* Version 1.00 */ - -/* Define the PAN Connection Control Block -*/ -typedef struct -{ -#define PAN_STATE_IDLE 0 -#define PAN_STATE_CONN_START 1 -#define PAN_STATE_CONNECTED 2 - UINT8 con_state; - -#define PAN_FLAGS_CONN_COMPLETED 0x01 - UINT8 con_flags; - - UINT16 handle; - BD_ADDR rem_bda; - - UINT16 bad_pkts_rcvd; - UINT16 src_uuid; - UINT16 dst_uuid; - UINT16 prv_src_uuid; - UINT16 prv_dst_uuid; - UINT16 ip_addr_known; - UINT32 ip_addr; - -} tPAN_CONN; - - -/* The main PAN control block -*/ -typedef struct -{ - UINT8 role; - UINT8 active_role; - UINT8 prv_active_role; - tPAN_CONN pcb[MAX_PAN_CONNS]; - - tPAN_CONN_STATE_CB *pan_conn_state_cb; /* Connection state callback */ - tPAN_BRIDGE_REQ_CB *pan_bridge_req_cb; - tPAN_DATA_IND_CB *pan_data_ind_cb; - tPAN_DATA_BUF_IND_CB *pan_data_buf_ind_cb; - tPAN_FILTER_IND_CB *pan_pfilt_ind_cb; /* protocol filter indication callback */ - tPAN_MFILTER_IND_CB *pan_mfilt_ind_cb; /* multicast filter indication callback */ - tPAN_TX_DATA_FLOW_CB *pan_tx_data_flow_cb; - - char *user_service_name; - char *gn_service_name; - char *nap_service_name; - UINT32 pan_user_sdp_handle; - UINT32 pan_gn_sdp_handle; - UINT32 pan_nap_sdp_handle; - UINT8 num_conns; - UINT8 trace_level; -} tPAN_CB; - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Global PAN data -*/ -#if PAN_DYNAMIC_MEMORY == FALSE -extern tPAN_CB pan_cb; -#else -extern tPAN_CB *pan_cb_ptr; -#define pan_cb (*pan_cb_ptr) -#endif - -/*******************************************************************************/ -extern void pan_register_with_bnep (void); -extern void pan_conn_ind_cb (UINT16 handle, - BD_ADDR p_bda, - tBT_UUID *remote_uuid, - tBT_UUID *local_uuid, - BOOLEAN is_role_change); -extern void pan_connect_state_cb (UINT16 handle, BD_ADDR rem_bda, tBNEP_RESULT result, BOOLEAN is_role_change); -extern void pan_data_ind_cb (UINT16 handle, - UINT8 *src, - UINT8 *dst, - UINT16 protocol, - UINT8 *p_data, - UINT16 len, - BOOLEAN fw_ext_present); -extern void pan_data_buf_ind_cb (UINT16 handle, - UINT8 *src, - UINT8 *dst, - UINT16 protocol, - BT_HDR *p_buf, - BOOLEAN ext); -extern void pan_tx_data_flow_cb (UINT16 handle, - tBNEP_RESULT event); -void pan_proto_filt_ind_cb (UINT16 handle, - BOOLEAN indication, - tBNEP_RESULT result, - UINT16 num_filters, - UINT8 *p_filters); -void pan_mcast_filt_ind_cb (UINT16 handle, - BOOLEAN indication, - tBNEP_RESULT result, - UINT16 num_filters, - UINT8 *p_filters); -extern UINT32 pan_register_with_sdp (UINT16 uuid, UINT8 sec_mask, char *p_name, char *p_desc); -extern tPAN_CONN *pan_allocate_pcb (BD_ADDR p_bda, UINT16 handle); -extern tPAN_CONN *pan_get_pcb_by_handle (UINT16 handle); -extern tPAN_CONN *pan_get_pcb_by_addr (BD_ADDR p_bda); -extern void pan_close_all_connections (void); -extern void pan_release_pcb (tPAN_CONN *p_pcb); -extern void pan_dump_status (void); - -/********************************************************************************/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/components/bt/bluedroid/stack/l2cap/Kconfig b/components/bt/bluedroid/stack/l2cap/Kconfig deleted file mode 100644 index e69de29bb..000000000 diff --git a/components/bt/bluedroid/stack/include/l2c_int.h b/components/bt/bluedroid/stack/l2cap/include/l2c_int.h similarity index 100% rename from components/bt/bluedroid/stack/include/l2c_int.h rename to components/bt/bluedroid/stack/l2cap/include/l2c_int.h diff --git a/components/bt/bluedroid/stack/include/sdpint.h b/components/bt/bluedroid/stack/sdp/include/sdpint.h similarity index 100% rename from components/bt/bluedroid/stack/include/sdpint.h rename to components/bt/bluedroid/stack/sdp/include/sdpint.h diff --git a/components/bt/bluedroid/stack/include/aes.h b/components/bt/bluedroid/stack/smp/include/aes.h similarity index 100% rename from components/bt/bluedroid/stack/include/aes.h rename to components/bt/bluedroid/stack/smp/include/aes.h diff --git a/components/bt/bluedroid/stack/include/p_256_ecc_pp.h b/components/bt/bluedroid/stack/smp/include/p_256_ecc_pp.h similarity index 100% rename from components/bt/bluedroid/stack/include/p_256_ecc_pp.h rename to components/bt/bluedroid/stack/smp/include/p_256_ecc_pp.h diff --git a/components/bt/bluedroid/stack/include/p_256_multprecision.h b/components/bt/bluedroid/stack/smp/include/p_256_multprecision.h similarity index 100% rename from components/bt/bluedroid/stack/include/p_256_multprecision.h rename to components/bt/bluedroid/stack/smp/include/p_256_multprecision.h diff --git a/components/bt/bluedroid/stack/include/smp_int.h b/components/bt/bluedroid/stack/smp/include/smp_int.h similarity index 100% rename from components/bt/bluedroid/stack/include/smp_int.h rename to components/bt/bluedroid/stack/smp/include/smp_int.h diff --git a/components/bt/component.mk b/components/bt/component.mk index eb031ad37..707562a21 100644 --- a/components/bt/component.mk +++ b/components/bt/component.mk @@ -2,9 +2,33 @@ # Component Makefile # -COMPONENT_ADD_INCLUDEDIRS := ./include bluedroid/include bluedroid/osi/include bluedroid/gki/include bluedroid/btcore/include bluedroid/hci/include bluedroid/device/include bluedroid/stack/include bluedroid/app/include bluedroid/profiles/include bluedroid/bta/include bluedroid/stack/avrc/include bluedroid/stack/rfcomm/include bluedroid/bta/sys/include +COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \ + bluedroid/bta/sys/include \ + bluedroid/btcore/include \ + bluedroid/device/include \ + bluedroid/gki/include \ + bluedroid/hci/include \ + bluedroid/osi/include \ + bluedroid/profiles/esp/include \ + bluedroid/profiles/std/avrc/include \ + bluedroid/profiles/std/battery/include \ + bluedroid/profiles/std/dis/include \ + bluedroid/profiles/std/hid/include \ + bluedroid/profiles/std/rfcomm/include \ + bluedroid/profiles/std/include \ + bluedroid/stack/btm/include \ + bluedroid/stack/btu/include \ + bluedroid/stack/gap/include \ + bluedroid/stack/gatt/include \ + bluedroid/stack/hcic/include \ + bluedroid/stack/l2cap/include \ + bluedroid/stack/sdp/include \ + bluedroid/stack/smp/include \ + bluedroid/stack/include \ + bluedroid/include \ + include -CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses +CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses -I./include LIBS := btdm_app @@ -16,44 +40,39 @@ COMPONENT_ADD_LDFLAGS := -lbt -L$(abspath lib) \ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) $(COMPONENT_LIBRARY): $(ALL_LIB_FILES) -COMPONENT_SRCDIRS := \ - bluedroid/main \ - bluedroid/profiles/hid_le \ - bluedroid/profiles/baterry \ - bluedroid/profiles/sample_button \ - bluedroid/profiles/diss \ - bluedroid/profiles \ - bluedroid/hci \ - bluedroid/stack/btu \ - bluedroid/stack/btm \ - bluedroid/stack/gatt \ - bluedroid/stack/avrc \ - bluedroid/stack/hcic \ - bluedroid/stack/srvc \ - bluedroid/stack/gap \ - bluedroid/stack/l2cap \ - bluedroid/stack/smp \ - bluedroid/stack/sdp \ - bluedroid/stack/rfcomm \ - bluedroid/stack \ - bluedroid/btcore \ - bluedroid/device \ - bluedroid/app/app_client_profiles \ - bluedroid/app/app_client_profiles/battery_c \ - bluedroid/app/app_project \ - bluedroid/app/app_profiles \ - bluedroid/app/app_profiles/app_sample_button \ - bluedroid/app/app_core \ - bluedroid/app \ - bluedroid/gki \ - bluedroid/bta/gatt \ - bluedroid/bta/dm \ - bluedroid/bta/sys \ - bluedroid/bta \ - bluedroid/osi \ - bluedroid/test \ - bluedroid/btif \ - bluedroid \ - ./ +COMPONENT_SRCDIRS := bluedroid/bta/dm \ + bluedroid/bta/gatt \ + bluedroid/bta/hh \ + bluedroid/bta/sys \ + bluedroid/bta \ + bluedroid/btcore \ + bluedroid/btif \ + bluedroid/device \ + bluedroid/gki \ + bluedroid/hci \ + bluedroid/main \ + bluedroid/osi \ + bluedroid/profiles/esp/ble_button \ + bluedroid/profiles/esp \ + bluedroid/profiles/std/avrc \ + bluedroid/profiles/std/battery \ + bluedroid/profiles/std/dis \ + bluedroid/profiles/std/hid \ + bluedroid/profiles/std/hid_le \ + bluedroid/profiles/std/rfcomm \ + bluedroid/profiles/std \ + bluedroid/profiles \ + bluedroid/stack/btm \ + bluedroid/stack/btu \ + bluedroid/stack/gap \ + bluedroid/stack/gatt \ + bluedroid/stack/hcic \ + bluedroid/stack/include \ + bluedroid/stack/l2cap \ + bluedroid/stack/sdp \ + bluedroid/stack/smp \ + bluedroid/stack \ + bluedroid \ + . include $(IDF_PATH)/make/component_common.mk diff --git a/examples/05_bluedroid_demos/Makefile b/examples/05_bluedroid_demos/Makefile new file mode 100644 index 000000000..1e91bbb89 --- /dev/null +++ b/examples/05_bluedroid_demos/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/05_bluedroid_demos/README.rst b/examples/05_bluedroid_demos/README.rst new file mode 100644 index 000000000..4861adcf4 --- /dev/null +++ b/examples/05_bluedroid_demos/README.rst @@ -0,0 +1,6 @@ +ESP-IDF Bluedroid Demos +======================= + +Some demos integration for bluedroid + + diff --git a/components/bt/bluedroid/app/app_client_profiles/battery_c/battery_c.c b/examples/05_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c similarity index 100% rename from components/bt/bluedroid/app/app_client_profiles/battery_c/battery_c.c rename to examples/05_bluedroid_demos/components/bluedroid_demos/app_client_profiles/battery_c/battery_c.c diff --git a/components/bt/bluedroid/app/app_core/bt_app.c b/examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c similarity index 100% rename from components/bt/bluedroid/app/app_core/bt_app.c rename to examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app.c diff --git a/components/bt/bluedroid/app/app_core/bt_app_core.c b/examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c similarity index 57% rename from components/bt/bluedroid/app/app_core/bt_app_core.c rename to examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c index 40c64778a..790764fda 100644 --- a/components/bt/bluedroid/app/app_core/bt_app_core.c +++ b/examples/05_bluedroid_demos/components/bluedroid_demos/app_core/bt_app_core.c @@ -22,48 +22,48 @@ #include "button_pro.h" #include "thread.h" #include "bt_app_common.h" -#include "gatt_profile.h" +#include "dis_api.h" #include "gattc_profile.h" #include "smp_int.h" #include "smp_api.h" -static fixed_queue_t *bta_app1_msg_queue; -fixed_queue_t *bt_app1_general_alarm_queue; -hash_map_t *bt_app1_general_alarm_hash_map; -pthread_mutex_t bt_app1_general_alarm_lock; -static const size_t BT_APP1_GENERAL_ALARM_HASH_MAP_SIZE = 10; +static fixed_queue_t *bta_app_msg_queue; +fixed_queue_t *bt_app_general_alarm_queue; +hash_map_t *bt_app_general_alarm_hash_map; +pthread_mutex_t bt_app_general_alarm_lock; +static const size_t BT_APP_GENERAL_ALARM_HASH_MAP_SIZE = 10; xQueueHandle xBtaApp1Queue; xTaskHandle xBtaApp1TaskHandle; -#define BT_APP1_TTYPE_MAIN_ENTRY (1) +#define BT_APP_TTYPE_MAIN_ENTRY (1) static TIMER_LIST_ENT main_boot_tle; tSMP_CB smp_cmd; -static void bt_app1_context_switched(void *p_msg); -static void bt_app1_send_msg(void *p_msg); -static void bt_app1_task_handler(void *arg); -static void bta_app1_msg_ready(fixed_queue_t *queue); -static void bt_app1_task_shut_down(void); +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); -static void bt_app1_general_alarm_ready(fixed_queue_t *queue); -static void bt_app1_general_alarm_process(TIMER_LIST_ENT *p_tle); -void bt_app1_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec); +static void bt_app_general_alarm_ready(fixed_queue_t *queue); +static void bt_app_general_alarm_process(TIMER_LIST_ENT *p_tle); +void bt_app_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec); //extern void ble_test_conn(void); //extern void bt_test_start_inquiry(void); extern void ble_server_test(void); -static void bt_app1_task_handler(void *arg) +static void bt_app_task_handler(void *arg) { TaskEvt_t *e; UINT8 button_msg[2] = {0x01,0x00}; for (;;) { if (pdTRUE == xQueueReceive(xBtaApp1Queue, &e, (portTickType)portMAX_DELAY)) { if (e->sig == 0xff) { - fixed_queue_process(bta_app1_msg_queue); - fixed_queue_process(bt_app1_general_alarm_queue); + fixed_queue_process(bta_app_msg_queue); + fixed_queue_process(bt_app_general_alarm_queue); }else if(e->sig == BUTTON_PRESS_EVT){ LOG_ERROR("button_press_event come in,button_value=%x\n",e->par); button_msg[1] = e->par; @@ -74,7 +74,7 @@ static void bt_app1_task_handler(void *arg) } } -static void bt_app1_task_post(void) +static void bt_app_task_post(void) { TaskEvt_t *evt = (TaskEvt_t *)osi_malloc(sizeof(TaskEvt_t)); @@ -91,50 +91,50 @@ static void bt_app1_task_post(void) } -static void bta_app1_msg_ready(fixed_queue_t *queue) { +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_app1_msg_ready, evt: %d\n", p_msg->event); + LOG_ERROR("bta_app_msg_ready, evt: %d\n", p_msg->event); switch (p_msg->event) { - case BT_EVT_APP1_CONTEXT_SWITCH: - bt_app1_context_switched(p_msg); + case BT_EVT_APP_CONTEXT_SWITCH: + bt_app_context_switched(p_msg); break; default: - LOG_ERROR("unhandled BT_APP1 event (%d)\n", p_msg->event & BT_EVT_MASK); + LOG_ERROR("unhandled BT_APP event (%d)\n", p_msg->event & BT_EVT_MASK); break; } GKI_freebuf(p_msg); } } -static void bt_app1_context_switched(void *p_msg) +static void bt_app_context_switched(void *p_msg) { - tBTAPP1_CONTEXT_SWITCH_CBACK *p = (tBTAPP1_CONTEXT_SWITCH_CBACK *) 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_app1_send_msg(void *p_msg) +static void bt_app_send_msg(void *p_msg) { - if (bta_app1_msg_queue) { - fixed_queue_enqueue(bta_app1_msg_queue, p_msg); - //ke_event_set(KE_EVENT_BT_APP1_TASK); - bt_app1_task_post(); + if (bta_app_msg_queue) { + fixed_queue_enqueue(bta_app_msg_queue, p_msg); + //ke_event_set(KE_EVENT_BT_APP_TASK); + bt_app_task_post(); } } -bt_status_t bt_app1_transfer_context (tBTAPP1_CBACK *p_cback, UINT16 event, char* p_params, int param_len, tBTAPP1_COPY_CBACK *p_copy_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) { - tBTAPP1_CONTEXT_SWITCH_CBACK *p_msg; + tBTAPP_CONTEXT_SWITCH_CBACK *p_msg; - LOG_ERROR("btapp1_transfer_context evt %d, len %d", event, param_len); + LOG_ERROR("btapp_transfer_context evt %d, len %d", event, param_len); /* allocate and send message that will be executed in btif context */ - if ((p_msg = (tBTAPP1_CONTEXT_SWITCH_CBACK *) GKI_getbuf(sizeof(tBTAPP1_CONTEXT_SWITCH_CBACK) + param_len)) != NULL) + if ((p_msg = (tBTAPP_CONTEXT_SWITCH_CBACK *) GKI_getbuf(sizeof(tBTAPP_CONTEXT_SWITCH_CBACK) + param_len)) != NULL) { - p_msg->hdr.event = BT_EVT_APP1_CONTEXT_SWITCH; /* internal event */ + p_msg->hdr.event = BT_EVT_APP_CONTEXT_SWITCH; /* internal event */ p_msg->p_cb = p_cback; p_msg->event = event; /* callback event */ @@ -149,7 +149,7 @@ bt_status_t bt_app1_transfer_context (tBTAPP1_CBACK *p_cback, UINT16 event, char memcpy(p_msg->p_param, p_params, param_len); /* callback parameter data */ } - bt_app1_send_msg(p_msg); + bt_app_send_msg(p_msg); return BT_STATUS_SUCCESS; } else @@ -159,53 +159,53 @@ bt_status_t bt_app1_transfer_context (tBTAPP1_CBACK *p_cback, UINT16 event, char } } -void bt_app1_task_start_up(void) +void bt_app_task_start_up(void) { - bta_app1_msg_queue = fixed_queue_new(SIZE_MAX); - if (bta_app1_msg_queue == NULL) + bta_app_msg_queue = fixed_queue_new(SIZE_MAX); + if (bta_app_msg_queue == NULL) goto error_exit; - //ke_event_callback_set(KE_EVENT_BT_APP1_TASK, &bt_app1_task_handler); + //ke_event_callback_set(KE_EVENT_BT_APP_TASK, &bt_app_task_handler); xBtaApp1Queue = xQueueCreate(3, sizeof(void *)); - xTaskCreate(bt_app1_task_handler, "BtaApp1T", 8192, NULL, configMAX_PRIORITIES - 3, xBtaApp1TaskHandle); + xTaskCreate(bt_app_task_handler, "BtaApp1T", 8192, NULL, configMAX_PRIORITIES - 3, xBtaApp1TaskHandle); - fixed_queue_register_dequeue(bta_app1_msg_queue, bta_app1_msg_ready); + fixed_queue_register_dequeue(bta_app_msg_queue, bta_app_msg_ready); - bt_app1_general_alarm_hash_map = hash_map_new(BT_APP1_GENERAL_ALARM_HASH_MAP_SIZE, + bt_app_general_alarm_hash_map = hash_map_new(BT_APP_GENERAL_ALARM_HASH_MAP_SIZE, hash_function_pointer, NULL, (data_free_fn)osi_alarm_free, NULL); - if (bt_app1_general_alarm_hash_map == NULL) + if (bt_app_general_alarm_hash_map == NULL) goto error_exit; - pthread_mutex_init(&bt_app1_general_alarm_lock, NULL); + pthread_mutex_init(&bt_app_general_alarm_lock, NULL); - bt_app1_general_alarm_queue = fixed_queue_new(SIZE_MAX); - if (bt_app1_general_alarm_queue == NULL) + bt_app_general_alarm_queue = fixed_queue_new(SIZE_MAX); + if (bt_app_general_alarm_queue == NULL) goto error_exit; - fixed_queue_register_dequeue(bt_app1_general_alarm_queue, bt_app1_general_alarm_ready); + fixed_queue_register_dequeue(bt_app_general_alarm_queue, bt_app_general_alarm_ready); memset(&main_boot_tle, 0, sizeof(TIMER_LIST_ENT)); return; error_exit: - LOG_ERROR("%s Unable to allocate resources for bt_app1", __func__); - bt_app1_task_shut_down(); + LOG_ERROR("%s Unable to allocate resources for bt_app", __func__); + bt_app_task_shut_down(); } -static void bt_app1_task_shut_down(void) +static void bt_app_task_shut_down(void) { - fixed_queue_unregister_dequeue(bta_app1_msg_queue); - fixed_queue_free(bta_app1_msg_queue, NULL); - bta_app1_msg_queue = NULL; + fixed_queue_unregister_dequeue(bta_app_msg_queue); + fixed_queue_free(bta_app_msg_queue, NULL); + bta_app_msg_queue = NULL; // todo: hash map, pthread_mutex... - fixed_queue_unregister_dequeue(bt_app1_general_alarm_queue); + fixed_queue_unregister_dequeue(bt_app_general_alarm_queue); vTaskDelete(xBtaApp1TaskHandle); vTaskDelete(xBtaApp1Queue); } -static void bt_app1_dm_data_copy(uint16_t event, char *dst, char *src) +static void bt_app_dm_data_copy(uint16_t event, char *dst, char *src) { tBTA_DM_SEC *dst_dm_sec = (tBTA_DM_SEC*)dst; tBTA_DM_SEC *src_dm_sec = (tBTA_DM_SEC*)src; @@ -225,13 +225,13 @@ static void bt_app1_dm_data_copy(uint16_t event, char *dst, char *src) } } -static void bt_app1_dm_data_free(uint16_t event, tBTA_DM_SEC *dm_sec) +static void bt_app_dm_data_free(uint16_t event, tBTA_DM_SEC *dm_sec) { if (event == BTA_DM_BLE_KEY_EVT) osi_free(dm_sec->ble_key.p_key_value); } -static void bt_app1_dm_upstreams_evt(UINT16 event, char *p_param) +static void bt_app_dm_upstreams_evt(UINT16 event, char *p_param) { tBTA_DM_SEC *p_data = (tBTA_DM_SEC*)p_param; switch (event) { @@ -276,49 +276,49 @@ static void bt_app1_dm_upstreams_evt(UINT16 event, char *p_param) break; } - bt_app1_dm_data_free(event, p_data); + bt_app_dm_data_free(event, p_data); } static void bte_dm_evt(tBTA_DM_SEC_EVT event, tBTA_DM_SEC* p_data) { LOG_ERROR("bte_dm_evt: %d\n", (uint16_t)event); - bt_app1_transfer_context(bt_app1_dm_upstreams_evt, (uint16_t)event, - (void *)p_data, sizeof(tBTA_DM_SEC), bt_app1_dm_data_copy); + bt_app_transfer_context(bt_app_dm_upstreams_evt, (uint16_t)event, + (void *)p_data, sizeof(tBTA_DM_SEC), bt_app_dm_data_copy); } -void bt_app1_init_ok(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param) +void bt_app_init_ok(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param) { BTA_EnableBluetooth(bte_dm_evt); vTaskDelay(1000 / portTICK_PERIOD_MS); - bt_app1_start_timer(&main_boot_tle, BT_APP1_TTYPE_MAIN_ENTRY, 8); + bt_app_start_timer(&main_boot_tle, BT_APP_TTYPE_MAIN_ENTRY, 8); } /* Alarm timer */ -static void bt_app1_general_alarm_cb(void *data) { +static void bt_app_general_alarm_cb(void *data) { assert(data != NULL); TIMER_LIST_ENT *p_tle = (TIMER_LIST_ENT *)data; - fixed_queue_enqueue(bt_app1_general_alarm_queue, p_tle); - //ke_event_set(KE_EVENT_BT_APP1_TASK); - bt_app1_task_post(); + fixed_queue_enqueue(bt_app_general_alarm_queue, p_tle); + //ke_event_set(KE_EVENT_BT_APP_TASK); + bt_app_task_post(); } -void bt_app1_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec) { +void bt_app_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec) { osi_alarm_t *alarm = NULL; assert(p_tle != NULL); // Get the alarm for the timer list entry. - pthread_mutex_lock(&bt_app1_general_alarm_lock); - if (!hash_map_has_key(bt_app1_general_alarm_hash_map, p_tle)) { - alarm = osi_alarm_new("bt_app1", bt_app1_general_alarm_cb, (void *)p_tle, 0); - hash_map_set(bt_app1_general_alarm_hash_map, p_tle, alarm); + pthread_mutex_lock(&bt_app_general_alarm_lock); + if (!hash_map_has_key(bt_app_general_alarm_hash_map, p_tle)) { + alarm = osi_alarm_new("bt_app", bt_app_general_alarm_cb, (void *)p_tle, 0); + hash_map_set(bt_app_general_alarm_hash_map, p_tle, alarm); } - pthread_mutex_unlock(&bt_app1_general_alarm_lock); + pthread_mutex_unlock(&bt_app_general_alarm_lock); - pthread_mutex_lock(&bt_app1_general_alarm_lock); - alarm = hash_map_get(bt_app1_general_alarm_hash_map, p_tle); - pthread_mutex_unlock(&bt_app1_general_alarm_lock); + pthread_mutex_lock(&bt_app_general_alarm_lock); + alarm = hash_map_get(bt_app_general_alarm_hash_map, p_tle); + pthread_mutex_unlock(&bt_app_general_alarm_lock); if (alarm == NULL) { LOG_ERROR("%s Unable to create alarm", __func__); @@ -334,7 +334,7 @@ void bt_app1_start_timer(TIMER_LIST_ENT *p_tle, UINT16 type, UINT32 timeout_sec) osi_alarm_set(alarm, (period_ms_t)(timeout_sec * 1000)); } -void bt_app1_stop_timer(TIMER_LIST_ENT *p_tle) +void bt_app_stop_timer(TIMER_LIST_ENT *p_tle) { assert(p_tle != NULL); @@ -343,7 +343,7 @@ void bt_app1_stop_timer(TIMER_LIST_ENT *p_tle) p_tle->in_use = FALSE; // Get the alarm for the timer list entry. - osi_alarm_t *alarm = hash_map_get(bt_app1_general_alarm_hash_map, p_tle); + osi_alarm_t *alarm = hash_map_get(bt_app_general_alarm_hash_map, p_tle); if (alarm == NULL) { LOG_WARN("%s Unable to find expected alarm in hashmap", __func__); return; @@ -351,13 +351,13 @@ void bt_app1_stop_timer(TIMER_LIST_ENT *p_tle) osi_alarm_cancel(alarm); } -static void bt_app1_general_alarm_process(TIMER_LIST_ENT *p_tle) +static void bt_app_general_alarm_process(TIMER_LIST_ENT *p_tle) { assert(p_tle != NULL); LOG_ERROR("general_alarm_process\n"); switch (p_tle->event) { - case BT_APP1_TTYPE_MAIN_ENTRY: - LOG_ERROR("BT_APP1 main boot**********\n"); + case BT_APP_TTYPE_MAIN_ENTRY: + LOG_ERROR("BT_APP main boot**********\n"); // ble_test_conn(); // ble_server_test(); @@ -372,13 +372,17 @@ static void bt_app1_general_alarm_process(TIMER_LIST_ENT *p_tle) } -static void bt_app1_general_alarm_ready(fixed_queue_t *queue) +static void bt_app_general_alarm_ready(fixed_queue_t *queue) { TIMER_LIST_ENT *p_tle; while (!fixed_queue_is_empty(queue)) { p_tle = (TIMER_LIST_ENT *)fixed_queue_dequeue(queue); - bt_app1_general_alarm_process(p_tle); + bt_app_general_alarm_process(p_tle); } } +void bt_app_core_start(void) { + bt_app_transfer_context(bt_app_init_ok, 0, NULL, 0, NULL); +} + diff --git a/components/bt/bluedroid/app/app_profiles/app_sample_button/app_button.c b/examples/05_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c similarity index 100% rename from components/bt/bluedroid/app/app_profiles/app_sample_button/app_button.c rename to examples/05_bluedroid_demos/components/bluedroid_demos/app_profiles/app_sample_button/app_button.c diff --git a/components/bt/bluedroid/app/app_project/SamleServerProject.c b/examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SamleServerProject.c similarity index 99% rename from components/bt/bluedroid/app/app_project/SamleServerProject.c rename to examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SamleServerProject.c index ee589dc15..6b517ec4d 100644 --- a/components/bt/bluedroid/app/app_project/SamleServerProject.c +++ b/examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SamleServerProject.c @@ -20,7 +20,7 @@ #include "bt_trace.h" #include "btm_api.h" #include "bt_types.h" -#include "gatt_profile.h" +#include "dis_api.h" #include "bt_app_common.h" //#include "app_button.h" @@ -66,7 +66,7 @@ BD_ADDR rand_ijiazu_addr = {0x00,0x02,0x5B,0x00,0x32,0x55}; tESP_BLE_ADV_DATA ijiazu_adv_data[ADV_SCAN_IDX_MAX] = { [BLE_ADV_DATA_IDX] = { - .adv_name = "esp_server", + .adv_name = "Espressif_007", { {0,0}, NULL, //no manufature data to be setting in the ijiazu adervetisiing datas diff --git a/components/bt/bluedroid/app/app_project/SampleClientProject.c b/examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c similarity index 100% rename from components/bt/bluedroid/app/app_project/SampleClientProject.c rename to examples/05_bluedroid_demos/components/bluedroid_demos/app_project/SampleClientProject.c diff --git a/examples/05_bluedroid_demos/components/bluedroid_demos/component.mk b/examples/05_bluedroid_demos/components/bluedroid_demos/component.mk new file mode 100644 index 000000000..971743c52 --- /dev/null +++ b/examples/05_bluedroid_demos/components/bluedroid_demos/component.mk @@ -0,0 +1,21 @@ +# +# 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_client_profiles/battery_c \ + app_client_profiles \ + app_profiles/app_sample_button \ + app_profiles \ + 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/components/bt/bluedroid/app/include/app_button.h b/examples/05_bluedroid_demos/components/bluedroid_demos/include/app_button.h similarity index 100% rename from components/bt/bluedroid/app/include/app_button.h rename to examples/05_bluedroid_demos/components/bluedroid_demos/include/app_button.h diff --git a/components/bt/bluedroid/app/include/bt_app_common.h b/examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h similarity index 53% rename from components/bt/bluedroid/app/include/bt_app_common.h rename to examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h index 8983e0c76..80e85f290 100644 --- a/components/bt/bluedroid/app/include/bt_app_common.h +++ b/examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_common.h @@ -3,6 +3,7 @@ #include #include "osi.h" +#include "bt_common_types.h" /** Bluetooth Error Status */ /** originally defined in bluetooth.h */ @@ -21,26 +22,26 @@ typedef enum { } bt_status_t; -/* BT APP1 Events */ -#define BT_EVT_APP1 (0xB000) -#define BT_EVT_APP1_CONTEXT_SWITCH (0x0001 | BT_EVT_APP1) +/* BT APP Events */ +#define BT_EVT_APP (0xB000) +#define BT_EVT_APP_CONTEXT_SWITCH (0x0001 | BT_EVT_APP) -typedef void (tBTAPP1_CBACK) (UINT16 event, char *p_param); -typedef void (tBTAPP1_COPY_CBACK) (UINT16 event, char *p_dest, char *p_src); +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; - tBTAPP1_CBACK* p_cb; /* context switch callback */ + 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 */ -} tBTAPP1_CONTEXT_SWITCH_CBACK; +} tBTAPP_CONTEXT_SWITCH_CBACK; -bt_status_t bt_app1_transfer_context (tBTAPP1_CBACK *p_cback, UINT16 event, char* p_params, int param_len, tBTAPP1_COPY_CBACK *p_copy_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_app1_init_ok(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param); +void bt_app_init_ok(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param); -void bt_app1_task_start_up(void); +void bt_app_task_start_up(void); #endif /* __BT_APP_COMMON_H__ */ diff --git a/components/bt/bluedroid/app/include/bt_app_defs.h b/examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h similarity index 100% rename from components/bt/bluedroid/app/include/bt_app_defs.h rename to examples/05_bluedroid_demos/components/bluedroid_demos/include/bt_app_defs.h diff --git a/components/bt/bluedroid/app/include/gattc_profile.h b/examples/05_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h similarity index 100% rename from components/bt/bluedroid/app/include/gattc_profile.h rename to examples/05_bluedroid_demos/components/bluedroid_demos/include/gattc_profile.h diff --git a/examples/05_bluedroid_demos/main/component.mk b/examples/05_bluedroid_demos/main/component.mk new file mode 100644 index 000000000..24356f23e --- /dev/null +++ b/examples/05_bluedroid_demos/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/05_bluedroid_demos/main/demo_main.c b/examples/05_bluedroid_demos/main/demo_main.c new file mode 100644 index 000000000..b8b629629 --- /dev/null +++ b/examples/05_bluedroid_demos/main/demo_main.c @@ -0,0 +1,23 @@ +#include +#include "freertos/FreeRTOS.h" +#include "freertos/task.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 bt_app_main() +{ + xTaskCreatePinnedToCore(&pingTask, "pingTask", 2048, NULL, 5, NULL, 0); + bt_app_task_start_up(); + bte_main_boot_entry(bt_app_core_start); +} diff --git a/examples/05_bluedroid_demos/sdkconfig b/examples/05_bluedroid_demos/sdkconfig new file mode 100644 index 000000000..3d1d31d0b --- /dev/null +++ b/examples/05_bluedroid_demos/sdkconfig @@ -0,0 +1,123 @@ +# +# Automatically generated file; DO NOT EDIT. +# Espressif IoT Development Framework Configuration +# + +# +# SDK tool configuration +# +CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +CONFIG_PYTHON="python" + +# +# Bootloader config +# +# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set +CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set +CONFIG_LOG_BOOTLOADER_LEVEL=2 + +# +# Serial flasher config +# +CONFIG_ESPTOOLPY_PORT="/dev/tty.usbserial-AK05BX2L" +# CONFIG_ESPTOOLPY_BAUD_115200B is not set +# CONFIG_ESPTOOLPY_BAUD_230400B is not set +CONFIG_ESPTOOLPY_BAUD_921600B=y +# CONFIG_ESPTOOLPY_BAUD_2MB is not set +# CONFIG_ESPTOOLPY_BAUD_OTHER is not set +CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 +CONFIG_ESPTOOLPY_BAUD=921600 +CONFIG_ESPTOOLPY_COMPRESSED=y +# CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +CONFIG_ESPTOOLPY_FLASHMODE_DIO=y +# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASHMODE="dio" +# CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set +CONFIG_ESPTOOLPY_FLASHFREQ_40M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +CONFIG_ESPTOOLPY_FLASHFREQ="40m" + +# +# Partition Table +# +CONFIG_PARTITION_TABLE_SINGLE_APP=y +# CONFIG_PARTITION_TABLE_TWO_OTA is not set +# CONFIG_PARTITION_TABLE_CUSTOM is not set +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_CUSTOM_APP_BIN_OFFSET=0x10000 +CONFIG_PARTITION_TABLE_FILENAME="partitions_singleapp.csv" +CONFIG_APP_OFFSET=0x10000 + +# +# Component config +# + +# +# BT config +# +CONFIG_BT_ENABLED=y + +# +# ESP32-specific config +# +CONFIG_ESP32_DEFAULT_CPU_FREQ_80=y +# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=80 +# CONFIG_ESP32_ENABLE_STACK_WIFI is not set +CONFIG_ESP32_ENABLE_STACK_BT=y +# CONFIG_ESP32_ENABLE_STACK_NONE is not set +CONFIG_MEMMAP_BT=y +CONFIG_MEMMAP_SMP=y +# CONFIG_MEMMAP_TRACEMEM is not set +# CONFIG_MEMMAP_SPISRAM is not set +CONFIG_NEWLIB_STDOUT_ADDCR=y + +# +# FreeRTOS +# +# CONFIG_FREERTOS_UNICORE is not set +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +# CONFIG_FREERTOS_CORETIMER_2 is not set +CONFIG_FREERTOS_HZ=100 +CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE=y +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY is not set +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +# CONFIG_FREERTOS_PANIC_PRINT_HALT is not set +CONFIG_FREERTOS_PANIC_PRINT_REBOOT=y +# CONFIG_FREERTOS_PANIC_SILENT_REBOOT is not set +# CONFIG_FREERTOS_PANIC_GDBSTUB is not set +CONFIG_FREERTOS_DEBUG_OCDAWARE=y +CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y +# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set +# CONFIG_FREERTOS_ASSERT_DISABLE is not set +CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG=y +# CONFIG_ENABLE_MEMORY_DEBUG is not set +# CONFIG_FREERTOS_DEBUG_INTERNALS is not set + +# +# Log output +# +# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set +# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set +# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set +# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set +CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_COLORS=y + +# +# LWIP +# +CONFIG_LWIP_MAX_SOCKETS=4 +CONFIG_LWIP_THREAD_LOCAL_STORAGE_INDEX=0 +# CONFIG_LWIP_SO_REUSE is not set