From 4ea38327b6f2c081bbb95df3e6fcbaaa860670ae Mon Sep 17 00:00:00 2001 From: Tian Hao Date: Fri, 4 Nov 2016 17:50:40 +0800 Subject: [PATCH] component:bt delete old demo trash --- .../app_project/SampleClientProject.c | 377 ------------------ .../app_project/SampleServerProject.c | 295 -------------- .../bluedroid_demos/include/bt_app_common.h | 31 -- 3 files changed, 703 deletions(-) delete mode 100644 examples/07_blufi/components/bluedroid_demos/app_project/SampleClientProject.c delete mode 100644 examples/07_blufi/components/bluedroid_demos/app_project/SampleServerProject.c delete mode 100644 examples/07_blufi/components/bluedroid_demos/include/bt_app_common.h diff --git a/examples/07_blufi/components/bluedroid_demos/app_project/SampleClientProject.c b/examples/07_blufi/components/bluedroid_demos/app_project/SampleClientProject.c deleted file mode 100644 index be179f501f..0000000000 --- a/examples/07_blufi/components/bluedroid_demos/app_project/SampleClientProject.c +++ /dev/null @@ -1,377 +0,0 @@ -/**************************************************************************** -* -* This file is for gatt client. It can scan ble device, connect one device, -* -****************************************************************************/ - -#include -#include -#include -#include - -#include "bta_api.h" -#include "bta_gatt_api.h" -#include "controller.h" - -#include "bt_trace.h" -#include "btm_api.h" -#include "bt_types.h" -#include "gattc_profile.h" - -#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x" -#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] - -tBTA_GATTC_IF client_if; -BD_ADDR obj_addr; -static unsigned char BASE_UUID[16] = { - 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - -int uuidType(unsigned char* p_uuid) -{ - int i = 0; - int match = 0; - int all_zero = 1; - - for(i = 0; i != 16; ++i) - { - if (i == 12 || i == 13) - continue; - - if (p_uuid[i] == BASE_UUID[i]) - ++match; - - if (p_uuid[i] != 0) - all_zero = 0; - } - if (all_zero) - return 0; - if (match == 12) - return LEN_UUID_32; - if (match == 14) - return LEN_UUID_16; - return LEN_UUID_128; -} - -static void btif_to_bta_uuid(tBT_UUID *p_dest, bt_uuid_t *p_src) -{ - char *p_byte = (char*)p_src; - - int i = 0; - - p_dest->len = uuidType(p_src->uu); - - switch (p_dest->len) - { - case LEN_UUID_16: - p_dest->uu.uuid16 = (p_src->uu[13] << 8) + p_src->uu[12]; - break; - - case LEN_UUID_32: - p_dest->uu.uuid32 = (p_src->uu[13] << 8) + p_src->uu[12]; - p_dest->uu.uuid32 += (p_src->uu[15] << 24) + (p_src->uu[14] << 16); - break; - - case LEN_UUID_128: - for(i = 0; i != 16; ++i) - p_dest->uu.uuid128[i] = p_byte[i]; - break; - - default: - LOG_ERROR("%s: Unknown UUID length %d!", __FUNCTION__, p_dest->len); - break; - } -} -/* -uint16_t get_uuid16(tBT_UUID* p_uuid) -{ - if(p_uuid->len == LEN_UUID_16) - { - return p_uuid->uu.uuid16; - } - else if(p_uuid->len == LEN_UUID_128) - { - UINT16 u16; - UINT8 *p = &p_uuid->uu.uuid128[LEN_UUID_128 - 4]; - STREAM_TO_UINT16(u16, p); - return u16; - } - else - { - return (UINT16)p_uuid->uu.uuid32; - } -} - -//fill a GATT ID structure -void bta_le_fill_16bits_gatt_id(UINT8 inst_id, UINT16 uuid, tBTA_GATT_ID* p_output) -{ - p_output->inst_id = inst_id; - p_output->uuid.len = LEN_UUID_16; - p_output->uuid.uu.uuid16 = uuid; -} - -//fill a service ID structure with a 16 bits service UUID -void bta_le_fill_16bits_srvc_id(bool is_pri, UINT8 inst_id, UINT16 srvc_uuid, tBTA_GATT_SRVC_ID* p_output) -{ - memset((void *)p_output, 0, sizeof(tBTA_GATT_SRVC_ID)); - p_output->is_primary = is_pri; - bta_le_fill_16bits_gatt_id(inst_id, srvc_uuid, &p_output->id); -} - -//fill a char ID structure with a 16 bits char UUID -void bta_le_fill_16bits_char_id(UINT8 inst_id, UINT16 char_uuid, tBTA_GATT_ID* p_output) -{ - memset((void *)p_output, 0, sizeof(tBTA_GATT_ID)); - bta_le_fill_16bits_gatt_id(inst_id, char_uuid, p_output); -} -*/ -/*get remote name*/ -static bool check_remote_name(tBTA_DM_INQ_RES* result, uint8_t* rmt_name, uint8_t* rmt_name_len) -{ - uint8_t *p_rmt_name = NULL; - uint8_t remote_name_len = 0; - - if (result->p_eir) { - p_rmt_name = BTM_CheckEirData(result->p_eir, - BTM_EIR_COMPLETE_LOCAL_NAME_TYPE, - &remote_name_len); - if (!p_rmt_name) - p_rmt_name = BTM_CheckEirData(result->p_eir, - BTM_EIR_SHORTENED_LOCAL_NAME_TYPE, - &remote_name_len); - if (p_rmt_name) { - if (remote_name_len > BD_NAME_LEN) - remote_name_len = BD_NAME_LEN; - if (rmt_name && rmt_name_len) { - memcpy(rmt_name, p_rmt_name, remote_name_len); - *(rmt_name + remote_name_len) = 0; - *rmt_name_len = remote_name_len; - } - return true; - } - } - return false; -} - -/************************************************************************************ -* * Function bta_scan_recult_callback -* * -* * Description scan result.it will be called when device scaned a peer device -* * -* * Return NULL -**************************************************************************************/ -static void bta_scan_result_callback(tBTA_DM_SEARCH_EVT event, tBTA_DM_SEARCH* p_data) -{ - uint8_t len; - BD_ADDR bd_addr; - char dev_name[32]; - tBTA_GATT_TRANSPORT transport = BTA_GATT_TRANSPORT_LE; - //char obj_name[] = "Find Me"; - char obj_name[] = "SimpleBLEPeripheral"; - uint8_t dev_name_len; - - switch (event) - { - case BTA_DM_INQ_RES_EVT: - { - LOG_ERROR("scan result: event=%d, "BT_BD_ADDR_STR", device_type=%d\n", - event, BT_BD_ADDR_HEX(p_data->inq_res.bd_addr), p_data->inq_res.device_type); - - bdcpy(bd_addr, p_data->inq_res.bd_addr); - if (p_data->inq_res.p_eir) - { - if (BTM_CheckEirData(p_data->inq_res.p_eir, BTM_EIR_COMPLETE_LOCAL_NAME_TYPE, &len)) - { - p_data->inq_res.remt_name_not_required = TRUE; - } - } - - if(check_remote_name(&(p_data->inq_res), dev_name, &dev_name_len)) - { - LOG_ERROR("scan device name len=%d, name = %s\n", dev_name_len, dev_name); - } - - if(strcmp(dev_name, obj_name) == 0) - { - bdcpy(obj_addr, bd_addr); - LOG_ERROR("find the device, obj_addr="BT_BD_ADDR_STR"\n", BT_BD_ADDR_HEX(obj_addr)); -// BTA_GATTC_Open(client_if, obj_addr, true, transport); - } - } - break; - - case BTA_DM_INQ_CMPL_EVT: - { - LOG_ERROR("%s-BLE observe complete. Num Resp %d\n", __FUNCTION__, p_data->inq_cmpl.num_resps); - - LOG_ERROR("connect the device "BT_BD_ADDR_STR", client_if=%d\n", - BT_BD_ADDR_HEX(obj_addr), client_if); - -/* scan complete, start connect*/ - BTA_GATTC_Open(client_if, obj_addr, true, transport); - } - break; - - default: - LOG_ERROR("%s : unknown event 0x%x", __FUNCTION__, event); - } -} - -/************************************************************************************ -* * Function bta_scan_param_setup_cback -* * -* * Description set scan param callback.it will be called after setting scan parameter -* * -* * Return NULL -**************************************************************************************/ -static void bta_scan_param_setup_cback(tGATT_IF c_client_if, tBTM_STATUS status) -{ - client_if = c_client_if; - LOG_ERROR("\nset scan params complete: status=%d, client_if=%d\n", status, client_if); - /*start scan*/ - BTA_DmBleObserve(true, 8, bta_scan_result_callback); -} - -/************************************************************************************ -* * Function bta_gattc_callback -* * -* * Description app register callback -* * -* * Return NULL -**************************************************************************************/ -static void bta_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data) -{ - switch (event) - { - case BTA_GATTC_REG_EVT: - { - tBTA_GATT_STATUS status = p_data->reg_oper.status; - client_if = p_data->reg_oper.client_if; - LOG_ERROR("%s:register complete: event=%d, status=%d, client_if=%d\n", __FUNCTION__, event, status, client_if); - UINT8 scan_interval = 0x50; - UINT8 scan_window = 0x30; - tBLE_SCAN_MODE scan_mode = BTM_BLE_SCAN_MODE_ACTI; - - bac_register(); - /*register complete,set scan parameter*/ - BTA_DmSetBleScanParams(client_if, scan_interval, scan_window, scan_mode, - bta_scan_param_setup_cback); - - } - break; - - /*connect callback*/ - case BTA_GATTC_OPEN_EVT: - { - - LOG_ERROR("\n%s:device is connected "BT_BD_ADDR_STR", client_if=%d, status=%d, connect_id=%d\n", - __FUNCTION__, BT_BD_ADDR_HEX(p_data->open.remote_bda), p_data->open.client_if, - p_data->open.status, p_data->open.conn_id); - /*return whether the remote device is currently connected*/ - int is_connected = BTA_DmGetConnectionState(p_data->open.remote_bda); - LOG_ERROR("is_connected=%d\n",is_connected); - /*get the energy info of the controller*/ - - /*read battery level*/ - int conn_id = p_data->open.conn_id; - - /*discover service*/ - // BTA_GATTC_ServiceSearchRequest(conn_id, NULL); - - } - break; -/* - case BTA_GATTC_SEARCH_RES_EVT: - { - // tBTA_GATTC_SRVC_RES service_result; - LOG_ERROR("find the service,uuid=0x%x, is_primary=%d\n", - get_uuid16(&p_data->srvc_res.service_uuid.id.uuid), - p_data->srvc_res.service_uuid.is_primary); - } - break; - - case BTA_GATTC_SEARCH_CMPL_EVT: - { - LOG_ERROR("search service complete, conn_id=%d,status=%d\n", p_data->search_cmpl.conn_id, - p_data->search_cmpl.status); - - //get first characteristic of battey service - LOG_ERROR("get first characteristic of battery service\n"); - tBTA_GATT_STATUS status; - tBTA_GATT_SRVC_ID battery_srvc_id; - tBTA_GATTC_CHAR_ID out_char_id; - tGATT_CHAR_PROP out_char_prop; - bta_le_fill_16bits_srvc_id(TRUE, 0, UUID_SERVCLASS_BATTERY, &battery_srvc_id); - status = BTA_GATTC_GetFirstChar(p_data->search_cmpl.conn_id, &battery_srvc_id, NULL, - &out_char_id, &out_char_prop); - if(status == 0) - { - LOG_ERROR("the first char:srvc_id=0x%x,char_id=0x%x, property = %d\n", - get_uuid16(&out_char_id.srvc_id.id.uuid), get_uuid16(&out_char_id.char_id.uuid), - out_char_prop); - //read battery level - tBTA_GATTC_CHAR_ID battery_char_id; - bta_le_fill_16bits_srvc_id(TRUE, 0, UUID_SERVCLASS_BATTERY, &battery_char_id.srvc_id); - bta_le_fill_16bits_char_id(0, GATT_UUID_BATTERY_LEVEL, &battery_char_id.char_id); - - BTA_GATTC_ReadCharacteristic(p_data->search_cmpl.conn_id, &battery_char_id, - BTA_GATT_AUTH_REQ_NONE); - } - } - break; - - case BTA_GATTC_READ_CHAR_EVT: - { - - LOG_ERROR("\nread characteristic:connect_id=%d, status=%d\n", - p_data->read.conn_id, p_data->read.status); - LOG_ERROR("srvc_id=0x%x,char_id=0x%x,descr_type=0x%x\n", - get_uuid16(&p_data->read.srvc_id.id.uuid), - get_uuid16(&p_data->read.char_id.uuid), - get_uuid16(&p_data->read.descr_type.uuid)); - if(get_uuid16(&p_data->read.descr_type.uuid) != GATT_UUID_CHAR_AGG_FORMAT - && p_data->read.p_value->unformat.len > 0 - && p_data->read.p_value->unformat.p_value != NULL) - { - LOG_ERROR("read the value: len=%d, value=%d\n", p_data->read.p_value->unformat.len, - *(p_data->read.p_value->unformat.p_value)); - } - } - break; -*/ - default: - LOG_ERROR("%s:unknown event: %d\n", __FUNCTION__, event); - } - -} - -/************************************************************************************ -* * Function ble_client_appRegister -* * -* * Description app register function -* * -* * Return NULL -**************************************************************************************/ -void ble_client_appRegister(void) -{ - - bt_uuid_t uuid; - tBT_UUID t_uuid; - memcpy(&uuid, BASE_UUID, sizeof(bt_uuid_t)); - btif_to_bta_uuid(&t_uuid, &uuid); - - LOG_ERROR("register application\n"); - BTA_GATTC_AppRegister(&t_uuid, bta_gattc_callback); - - /*battery service register*/ -// bac_register(); - -} - -void gattc_client_test(void) -{ - BTM_SetTraceLevel(BT_TRACE_LEVEL_DEBUG); - - ble_client_appRegister(); -} diff --git a/examples/07_blufi/components/bluedroid_demos/app_project/SampleServerProject.c b/examples/07_blufi/components/bluedroid_demos/app_project/SampleServerProject.c deleted file mode 100644 index 8ed96b04c4..0000000000 --- a/examples/07_blufi/components/bluedroid_demos/app_project/SampleServerProject.c +++ /dev/null @@ -1,295 +0,0 @@ -/*************************************************************** -* -* This file is for gatt server device. It instantiates BATTERY -* sevice. It can be scanned and connected by central device, -* and the client will get the BAS value. It calls the API bta -* layer provides. -* -****************************************************************/ - -#include -#include -#include -#include - -#include "prf_defs.h" - -#include "bta_api.h" -#include "bta_gatt_api.h" -#include "controller.h" - -#include "gatt_int.h" -#include "bt_trace.h" -#include "btm_api.h" -#include "bt_types.h" -#include "dis_api.h" -#include "bt_app_common.h" - -//#include "app_button.h" -#include "button_pro.h" -#include "hid_le_prf.h" - -#include "hcimsgs.h" -#include "bt_app_defs.h" - - -#define BT_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x" -#define BT_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5] -tBTA_GATTS_IF server_if; - -static unsigned char DIS_UUID[16] = { - 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0x0a, 0x18, 0x00, 0x00 - }; -static unsigned char BASE_UUID[16] = { - 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; - -UINT16 ijiazu_uuid = 0xffff; -tBTA_BLE_SERVICE ijiazu_service = { - 0x01, //only one service in the ijiazu button profile - false, - &ijiazu_uuid - }; /* 16 bits services */ - - -UINT8 beacon_manu[25] = {0x4c, 0x00,0x02, 0x15, 0xfd, 0xa5, 0x06, 0x93, 0xa4, 0xe2, - 0x4f, 0xb1, 0xaf, 0xcf, 0xc6, 0xeb, 0x07, 0x64, 0x78, 0x25, - 0x27, 0x32, 0xe6, 0x08, 0xc5}; - -//UINT8 ijiazu_manu[17] = {0xff,0x20,0x14,0x07,0x22,0x00,0x02,0x5B,0x00,0x33,0x49,0x31,0x30,0x4a,0x30,0x30,0x31}; -UINT8 ijiazu_manu[17] = {0xff,0x20,0x14,0x07,0x22,0x00,0x02,0x5B,0x00,0x33,0x49,0x31,0x30,0x4a,0x30,0x30,0x31}; -tBTA_BLE_MANU p_ijiazu_manu = {sizeof(ijiazu_manu),ijiazu_manu}; /* manufacturer data */ - - -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 = "Espressif_008", - { - {0,0}, - NULL, //no manufature data to be setting in the ijiazu adervetisiing datas - &ijiazu_service, - NULL, //the 128 bits service uuid set to null(not used) - NULL, //the 32 bits Service UUID set to null(not used) - NULL, //16 bits services Solicitation UUIDs set to null(not used) - NULL, //List of 32 bit Service Solicitation UUIDs set to null(not used) - NULL, //List of 128 bit Service Solicitation UUIDs set to null(not used) - NULL, //proprietary data set to null(not used) - NULL, //service data set not null(no service data to be sent) - 0x0200, //device type : generic display - BTA_DM_GENERAL_DISC, // General discoverable. - 0xFE //the tx power value,defult value is 0 - }, - - }, - [BLE_SCAN_RSP_DATA_IDX] = { - .adv_name = NULL, - { - {0,0}, - &p_ijiazu_manu, - NULL, - NULL, //the 128 bits service uuid set to null(not used) - NULL, //the 32 bits Service UUID set to null(not used) - NULL, //16 bits services Solicitation UUIDs set to null(not used) - NULL, //List of 32 bit Service Solicitation UUIDs set to null(not used) - NULL, //List of 128 bit Service Solicitation UUIDs set to null(not used) - NULL, //proprietary data set to null(not used) - NULL, //service data set not null(no service data to be sent) - 0x0000, //device type : generic display - 0x00, // General discoverable. - 0x00}, //the tx power value,defult value is 0 - - } -}; - -#if (BUT_PROFILE_CFG) -static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data); -#endif - -int uuidType(unsigned char* p_uuid) -{ - int i = 0; - int match = 0; - int all_zero = 1; - - for(i = 0; i != 16; ++i) - { - if (i == 12 || i == 13) - continue; - - if (p_uuid[i] == BASE_UUID[i]) - ++match; - - if (p_uuid[i] != 0) - all_zero = 0; - } - if (all_zero) - return 0; - if (match == 12) - return LEN_UUID_32; - if (match == 14) - return LEN_UUID_16; - return LEN_UUID_128; -} - -/*16-bits uuid to the structure of holding any type of UUID*/ -void btif_to_bta_uuid(tBT_UUID *p_dest, bt_uuid_t *p_src) -{ - char *p_byte = (char*)p_src; - - int i = 0; - - p_dest->len = uuidType(p_src->uu); - - switch (p_dest->len) - { - case LEN_UUID_16: - p_dest->uu.uuid16 = (p_src->uu[13] << 8) + p_src->uu[12]; - break; - - case LEN_UUID_32: - p_dest->uu.uuid32 = (p_src->uu[13] << 8) + p_src->uu[12]; - p_dest->uu.uuid32 += (p_src->uu[15] << 24) + (p_src->uu[14] << 16); - break; - - case LEN_UUID_128: - for(i = 0; i != 16; ++i) - p_dest->uu.uuid128[i] = p_byte[i]; - break; - - default: - LOG_ERROR("%s: Unknown UUID length %d!", __FUNCTION__, p_dest->len); - break; - } -} -/*set advertising config callback*/ -static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status) -{ - LOG_ERROR("set advertising config:status=%d\n", call_status); - /*dis init*/ -/* tDIS_ATTR_MASK dis_attr_mask; - dis_attr_mask = DIS_ATTR_SYS_ID_BIT | DIS_ATTR_MODEL_NUM_BIT | DIS_ATTR_SERIAL_NUM_BIT | - DIS_ATTR_FW_NUM_BIT | DIS_ATTR_HW_NUM_BIT | DIS_ATTR_SW_NUM_BIT | DIS_ATTR_MANU_NAME_BIT | - DIS_ATTR_IEEE_DATA_BIT | DIS_ATTR_PNP_ID_BIT; - DIS_SrInit(dis_attr_mask); -*/ - /*instantiate a battery service*/ - //bas_register(); - /*instantiate the driver for button profile*/ - //app_button_init(); -#if (BUT_PROFILE_CFG) - /*instantiate a button service*/ - button_init(SimpleDataCallBack); -#endif ///BUT_PROFILE_CFG - - /*instantiate a hid device service*/ - //hidd_le_init(); - /*start advetising*/ - //BTA_GATTS_Listen(server_if, true, NULL); -} - -/*register callback*/ -void bta_gatts_callback(tBTA_GATTS_EVT event, tBTA_GATTS* p_data) -{ - switch (event) - { - case BTA_GATTS_REG_EVT: - { - tBTA_GATT_STATUS status = p_data->reg_oper.status; - server_if = p_data->reg_oper.server_if; - LOG_ERROR("register complete: event=%d, status=%d, server_if=%d\n", - event, status, server_if); - - LOG_ERROR("set advertising parameters\n"); - //set the advertising data to the btm layer - ESP_AppBleConfigadvData(&ijiazu_adv_data[BLE_ADV_DATA_IDX], - bta_gatts_set_adv_data_cback); - //set the adversting data to the btm layer - ESP_AppBleSetScanRsp(&ijiazu_adv_data[BLE_SCAN_RSP_DATA_IDX],NULL); - BTA_GATTS_Listen(server_if, true, NULL); - } - break; - /*connect callback*/ - case BTA_GATTS_CONNECT_EVT: - { - LOG_ERROR("\ndevice is connected "BT_BD_ADDR_STR", server_if=%d,reason=0x%x,connect_id=%d\n", - BT_BD_ADDR_HEX(p_data->conn.remote_bda), p_data->conn.server_if, - p_data->conn.reason, p_data->conn.conn_id); - /*return whether the remote device is currently connected*/ - int is_connected = BTA_DmGetConnectionState(p_data->conn.remote_bda); - LOG_ERROR("is_connected=%d\n",is_connected); - } - break; - - default: - LOG_ERROR("unsettled event: %d\n", event); - } - -} - -#if (BUT_PROFILE_CFG) -#define HEADER_SSID "ssid" -#define HEADER_PASSWD "passwd" -#define HEADER_CONFIRM "confirm" -extern void wifi_set_blue_config(char *ssid, char *passwd); -static char tmp_ssid[33]; -static char tmp_passwd[33]; - -static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data) -{ - char *p = NULL; - LOG_ERROR("the data is:%s\n", p_data); -#if 0 - switch(event) - { - case RECEIVE_NET_PASSWD_EVT: - LOG_ERROR("Received the network passwork"); - break; - case RECEIVE_NET_SSD_EVT: - LOG_ERROR("Received the network SSID"); - break; - default: - break; - } -#endif - p = strstr(p_data, HEADER_SSID); - if (p) { - ets_printf("SSID: %s\n", p+strlen(HEADER_SSID)+1); - strcpy(tmp_ssid, p+strlen(HEADER_SSID)+1); - } - p = strstr(p_data, HEADER_PASSWD); - if (p) { - ets_printf("PASSWORD: %s\n", p+strlen(HEADER_PASSWD)+1); - strcpy(tmp_passwd, p+strlen(HEADER_PASSWD)+1); - } - p = strstr(p_data, HEADER_CONFIRM); - if (p) { - ets_printf("CONFIRM\n"); - wifi_set_blue_config(tmp_ssid, tmp_passwd); - } - -} -#endif ///BUT_PROFILE_CFG - -static void ble_server_appRegister(void) -{ - bt_uuid_t uuid; - tBT_UUID t_uuid; - memcpy(&uuid, BASE_UUID, sizeof(bt_uuid_t)); - //memcpy(&uuid, DIS_UUID, sizeof(bt_uuid_t)); - btif_to_bta_uuid(&t_uuid, &uuid); - - LOG_ERROR("register gatts application\n"); - BTA_GATTS_AppRegister(&t_uuid, bta_gatts_callback); -} - -void gatts_server_test(void) -{ - BTM_SetTraceLevel(BT_TRACE_LEVEL_DEBUG); - - ble_server_appRegister(); -} diff --git a/examples/07_blufi/components/bluedroid_demos/include/bt_app_common.h b/examples/07_blufi/components/bluedroid_demos/include/bt_app_common.h deleted file mode 100644 index d0eb314bb1..0000000000 --- a/examples/07_blufi/components/bluedroid_demos/include/bt_app_common.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef __BT_APP_COMMON_H__ -#define __BT_APP_COMMON_H__ - -#include -#include "osi.h" -#include "bt_common_types.h" -#include "bt_defs.h" - -/* BT APP Events */ -#define BT_EVT_APP (0xB000) -#define BT_EVT_APP_CONTEXT_SWITCH (0x0001 | BT_EVT_APP) - -typedef void (tBTAPP_CBACK) (uint16_t event, char *p_param); -typedef void (tBTAPP_COPY_CBACK) (uint16_t event, char *p_dest, char *p_src); - -typedef struct -{ - BT_HDR hdr; - tBTAPP_CBACK* p_cb; /* context switch callback */ - - /* parameters passed to callback */ - UINT16 event; /* message event id */ - char p_param[0]; /* parameter area needs to be last */ -} tBTAPP_CONTEXT_SWITCH_CBACK; - -bt_status_t bt_app_transfer_context (tBTAPP_CBACK *p_cback, UINT16 event, char* p_params, int param_len, tBTAPP_COPY_CBACK *p_copy_cback); - -void bt_app_init_ok(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param); - -void bt_app_task_start_up(void); -#endif /* __BT_APP_COMMON_H__ */ -- 2.40.0