Merge branch 'feature/btdm_prf_task' into feature/btdm_bluedroid

# Conflicts:
#	components/bt/bluedroid/profiles/core/bt_prf_sys_main.c
#	components/bt/bluedroid/profiles/core/bt_prf_task.c
#	components/bt/bluedroid/profiles/core/include/bt_prf_sys.h
#	components/bt/bluedroid/profiles/core/include/bt_prf_task.h
#	components/bt/bluedroid/profiles/esp/include/wx_airsync_prf.h
#	components/bt/bluedroid/profiles/esp/wechat_AirSync/wx_airsync_prf.c
#	components/bt/bluedroid/stack/btm/btm_sec.c
This commit is contained in:
Tian Hao
2016-11-04 19:32:47 +08:00
57 changed files with 3833 additions and 632 deletions

View File

@@ -17,14 +17,15 @@
#include "btm_api.h"
#include "bt_types.h"
#include "gattc_profile.h"
#include "bt_app_api.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;
esp_gattc_if_t client_if;
tBT_UUID bas_uuid = {LEN_UUID_16, {UUID_SERVCLASS_BATTERY}};
esp_bt_uuid_t bas_uuid = {LEN_UUID_16, {UUID_SERVCLASS_BATTERY}};
uint16_t get_uuid16(tBT_UUID* p_uuid)
uint16_t get_uuid16(esp_bt_uuid_t* p_uuid)
{
if(p_uuid->len == LEN_UUID_16)
{
@@ -52,17 +53,17 @@ void bta_le_fill_16bits_gatt_id(UINT8 inst_id, UINT16 uuid, tBTA_GATT_ID* p_outp
}
/*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)
void bta_le_fill_16bits_srvc_id(bool is_pri, UINT8 inst_id, UINT16 srvc_uuid, esp_gatt_srvc_id_t* p_output)
{
memset((void *)p_output, 0, sizeof(tBTA_GATT_SRVC_ID));
memset((void *)p_output, 0, sizeof(esp_gatt_srvc_id_t));
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)
void bta_le_fill_16bits_char_id(UINT8 inst_id, UINT16 char_uuid, esp_gatt_id_t* p_output)
{
memset((void *)p_output, 0, sizeof(tBTA_GATT_ID));
memset((void *)p_output, 0, sizeof(esp_gatt_id_t));
bta_le_fill_16bits_gatt_id(inst_id, char_uuid, p_output);
}
@@ -71,13 +72,13 @@ void bta_le_fill_16bits_char_id(UINT8 inst_id, UINT16 char_uuid, tBTA_GATT_ID* p
**
** Description battery service register callback function
*******************************************************************************/
static void bas_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data)
static void bas_gattc_callback(esp_gattc_evt_t event, esp_gattc_t* p_data)
{
switch (event)
{
case BTA_GATTC_REG_EVT:
case ESP_GATTC_REG_EVT:
{
tBTA_GATT_STATUS status = p_data->reg_oper.status;
esp_gatt_status_t status = p_data->reg_oper.status;
client_if = p_data->reg_oper.client_if;
LOG_ERROR("BAS register completed: event=%d, status=%d, client_if=%d\n",
event, status, client_if);
@@ -86,7 +87,7 @@ static void bas_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data)
break;
/*connect callback*/
case BTA_GATTC_OPEN_EVT:
case ESP_GATTC_OPEN_EVT:
{
LOG_ERROR("\n%s:device is connected "BT_BD_ADDR_STR", client_if=%d, status=%d, connect_id=%d\n",
@@ -101,12 +102,12 @@ static void bas_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data)
int conn_id = p_data->open.conn_id;
/*discover service*/
BTA_GATTC_ServiceSearchRequest(conn_id, NULL);
esp_ble_gattc_svc_search_req(conn_id, NULL);
}
break;
case BTA_GATTC_SEARCH_RES_EVT:
case ESP_GATTC_SEARCH_RES_EVT:
{
// tBTA_GATTC_SRVC_RES service_result;
LOG_ERROR("find the service,uuid=0x%x, is_primary=%d\n",
@@ -115,7 +116,7 @@ static void bas_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data)
}
break;
case BTA_GATTC_SEARCH_CMPL_EVT:
case ESP_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);
@@ -127,7 +128,7 @@ static void bas_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data)
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,
status = esp_ble_gattc_get_first_char(p_data->search_cmpl.conn_id, &battery_srvc_id, NULL,
&out_char_id, &out_char_prop);
if(status == 0)
{
@@ -139,13 +140,13 @@ static void bas_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data)
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,
esp_ble_gattc_read_char(p_data->search_cmpl.conn_id, &battery_char_id,
BTA_GATT_AUTH_REQ_NONE);
}
}
break;
case BTA_GATTC_READ_CHAR_EVT:
case ESP_GATTC_READ_CHAR_EVT:
{
LOG_ERROR("\nread characteristic:connect_id=%d, status=%d\n",
@@ -179,7 +180,7 @@ static void bas_gattc_callback(tBTA_GATTC_EVT event, tBTA_GATTC* p_data)
****************************************************************/
void bac_register(void)
{
BTA_GATTC_AppRegister(&bas_uuid, bas_gattc_callback);
esp_ble_gattc_app_register(&bas_uuid, bas_gattc_callback);
}

View File

@@ -29,7 +29,7 @@
** Returns None
**
*******************************************************************************/
void ESP_AppBleConfigadvData(tESP_BLE_ADV_DATA *adv_data,
void ble_config_adv_data(esp_ble_adv_data_cfg_t *adv_data,
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback)
{
tBTA_BLE_AD_MASK data_mask = 0;
@@ -112,7 +112,7 @@
** Returns None
**
*******************************************************************************/
void ESP_AppBleSetScanRsp(tESP_BLE_ADV_DATA *scan_rsp_data,
void ble_set_scan_rsp(esp_ble_adv_data_cfg_t *scan_rsp_data,
tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback)
{
tBTA_BLE_AD_MASK data_mask = 0;

View File

@@ -68,13 +68,13 @@ static void bt_app_task_handler(void *arg)
fixed_queue_process(bt_app_general_alarm_queue);
}
#if (BUT_PROFILE_CFG)
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;
button_msg_notify(2,button_msg);
// 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;
// button_msg_notify(2,button_msg);
}
//}
#endif ///BUT_PROFILE_CFG
}
@@ -253,7 +253,7 @@ static void bt_app_dm_upstreams_evt(UINT16 event, char *p_param)
/*set connectable,discoverable, pairable and paired only modes of local device*/
tBTA_DM_DISC disc_mode = BTA_DM_BLE_GENERAL_DISCOVERABLE;
tBTA_DM_CONN conn_mode = BTA_DM_BLE_CONNECTABLE;
BTA_DmSetVisibility(disc_mode, conn_mode, (UINT8)BTA_DM_NON_PAIRABLE, (UINT8)BTA_DM_CONN_ALL);
//BTA_DmSetVisibility(disc_mode, conn_mode, (UINT8)BTA_DM_NON_PAIRABLE, (UINT8)BTA_DM_CONN_ALL);
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
/* Enable local privacy */

View File

@@ -1,108 +0,0 @@
/**
****************************************************************************************
*
* @file bt_app_sec.c
*
* @brief Application entry point
*
* Copyright (C) Espressif 2016
* Created by Yulong at 2016/10/13
*
*
****************************************************************************************
*/
#include "bt_app_sec.h"
#include <stdlib.h> // standard library
#include <string.h>
extern void srand (unsigned int seed);
extern int random (void);
/// Application Security Environment Structure
tAPP_SEC_ENV app_sec_env;
/*******************************************************************************
**
** Function app_ble_sec_gen_tk
**
** Description This function is called to generate the ble tk
**
** Returns the generate tk value
**
*******************************************************************************/
UINT32 app_ble_sec_gen_tk(void)
{
// Generate a PIN Code (Between 100000 and 999999)
return (100000 + (random()%900000));
}
/*******************************************************************************
**
** Function app_ble_sec_gen_ltk
**
** Description This function is called to generate the ble ltk
**
** Returns NULL
**
*******************************************************************************/
void app_ble_sec_gen_ltk(UINT8 key_size)
{
// Counter
UINT8 i;
app_sec_env.key_size = key_size;
// Randomly generate the LTK and the Random Number
for (i = 0; i < RAND_NB_LEN; i++)
{
app_sec_env.rand_nb.nb[i] = random()%256;
}
// Randomly generate the end of the LTK
for (i = 0; i < SEC_KEY_LEN; i++)
{
app_sec_env.ltk.key[i] = (((key_size) < (16 - i)) ? 0 : random()%256);
}
// Randomly generate the EDIV
app_sec_env.ediv = random()%65536;
}
/*******************************************************************************
**
** Function app_ble_sec_init
**
** Description This function is init the security env and function
**
** Returns NULL
**
*******************************************************************************/
void app_ble_sec_init()
{
// Reset Security Environment
memset(&app_sec_env, 0, sizeof(app_sec_env));
}
/*******************************************************************************
**
** Function app_ble_security_start
**
** Description This function is called by the slave when the seurity start
**
** Returns NULL
**
*******************************************************************************/
void app_ble_security_start(void)
{
}

View File

@@ -15,7 +15,13 @@
*******************************************************************************
*********
*/
#if 0
#include "prf_defs.h"
#if (BUT_PROFILE_CFG)
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
@@ -33,6 +39,118 @@
#include "allocator.h"
#include "button_pro.h"
#include "app_button_int.h"
static const tBT_PRF_SYS_REG but_prf_reg =
{
ble_but_prf_hdl_event,
ble_but_prf_disable
};
/*******************************************************************************
**
** Function ble_but_prf_hdl_event
**
** Description button profile main event handling function.
**
**
** Returns BOOLEAN
**
*******************************************************************************/
BOOLEAN ble_but_prf_hdl_event(prf_hdr_evt_t *msg_data)
{
LOG_ERROR("###################ble_but_prf_hdl_event#####################################\n");
UINT16 connid = 0;
switch(msg_data->event)
{
case BLE_BUT_CREATE_DB_REQ_EVT:
Button_CreateService();
break;
case BLE_BUT_VAL_SEND_CFM_EVT:
break;
case BLE_BUT_SET_CHAR_VAL_REQ_EVT:
button_msg_notify(msg_data->len,msg_data->data);
break;
case BLE_BUT_ENABLE_REQ_EVT:
button_init(NULL);
break;
case BLE_BUT_DISABLE_IND_EVT:
button_disable(connid);
break;
case BLE_BUT_CHAR_WRITE_IND_EVT:
break;
case BLE_BUT_ERROR_IND_EVT:
break;
default:
break;
}
}
/*******************************************************************************
**
** Function ble_but_prf_disable
**
** Description This function is called to disable the button profile modlue
**
** Parameters None.
**
** Returns None
**
*******************************************************************************/
void ble_but_prf_disable(void)
{
prf_hdr_evt_t *p_buf;
LOG_ERROR("ble_but_prf_disable\n");
if (bt_prf_sys_is_register(PRF_ID_BUT_LE) == FALSE)
{
APPL_TRACE_WARNING("button profile Module not enabled/already disabled\n");
return;
}
if ((p_buf = (prf_hdr_evt_t *) GKI_getbuf(sizeof(prf_hdr_evt_t))) != NULL)
{
p_buf->event = BLE_BUT_DISABLE_IND_EVT;
bta_sys_sendmsg(p_buf);
}
bta_sys_deregister(PRF_ID_BUT_LE);
}
void ble_but_prf_enable(void)
{
bt_prf_sys_register(PRF_ID_BUT_LE,&but_prf_reg);
}
void ble_but_create_svc(void)
{
prf_hdr_evt_t *p_msg;
LOG_ERROR("ble_but_create_svc\n"); //todo
if ((p_msg = (prf_hdr_evt_t *) GKI_getbuf(sizeof(prf_hdr_evt_t))) != NULL)
{
memset(p_msg, 0, sizeof(prf_hdr_evt_t));
p_msg->event = BLE_BUT_ENABLE_REQ_EVT;
bt_prf_sys_sendmsg(p_msg);
}
}
#endif ///BUT_PROFILE_CFG
#if 0
#define GPIO_INUM 8
#define TABLE_ELEMENT_CNT(table) ((sizeof(table))/(sizeof(table[0])));
app_key_env key_press;

View File

@@ -30,9 +30,11 @@
#include "wx_airsync_prf.h"
#include "button_pro.h"
#include "app_button.h"
#include "hid_le_prf.h"
#include "bt_app_api.h"
//
#include "hcimsgs.h"
@@ -78,9 +80,30 @@ UINT8 wechat_manu[] = {0x00,0x00,0x18,0xfe,0x34,0x6a,0x86,0x2e};
tBTA_BLE_MANU p_ijiazu_manu = {sizeof(ijiazu_manu),ijiazu_manu}; /* manufacturer data */
tBTA_BLE_MANU p_wechat_manu = {sizeof(wechat_manu),wechat_manu};
tBLE_BD_ADDR p_peer_bda = {
.type = API_PUBLIC_ADDR,
.bda = {0}
};
esp_ble_adv_params_all_t adv_params =
{
.adv_int_min = BTM_BLE_ADV_INT_MIN + 0x100,
.adv_int_max = BTM_BLE_ADV_INT_MIN + 0x100,
.adv_type = API_NON_DISCOVERABLE,
.addr_type_own = API_PUBLIC_ADDR,
.channel_map = ESP_BLE_ADV_CHNL_MAP,
.adv_filter_policy = ADV_ALLOW_SCAN_ANY_CON_ANY,
.p_dir_bda = &p_peer_bda
};
BD_ADDR rand_ijiazu_addr = {0x00,0x02,0x5B,0x00,0x32,0x55};
tESP_BLE_ADV_DATA ijiazu_adv_data[ADV_SCAN_IDX_MAX] =
esp_ble_adv_data_cfg_t ijiazu_adv_data[ADV_SCAN_IDX_MAX] =
{
[BLE_ADV_DATA_IDX] = {
.adv_name = "Espressif_007",
@@ -121,7 +144,7 @@ tESP_BLE_ADV_DATA ijiazu_adv_data[ADV_SCAN_IDX_MAX] =
}
};
tESP_BLE_ADV_DATA wechat_adv_data[ADV_SCAN_IDX_MAX] =
esp_ble_adv_data_cfg_t wechat_adv_data[ADV_SCAN_IDX_MAX] =
{
[BLE_ADV_DATA_IDX] = {
.adv_name = NULL,
@@ -163,7 +186,7 @@ tESP_BLE_ADV_DATA wechat_adv_data[ADV_SCAN_IDX_MAX] =
};
#if (BUT_PROFILE_CFG)
static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data);
static void SimpleDataCallBack(uint8_t app_id, uint8_t event, uint16_t len, uint8_t *p_data);
#endif
int uuidType(unsigned char* p_uuid)
@@ -222,6 +245,8 @@ void btif_to_bta_uuid(tBT_UUID *p_dest, bt_uuid_t *p_src)
break;
}
}
/*set advertising config callback*/
static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status)
{
@@ -233,13 +258,14 @@ static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status)
DIS_ATTR_IEEE_DATA_BIT | DIS_ATTR_PNP_ID_BIT;
DIS_SrInit(dis_attr_mask);
*/
//ble_but_create_svc();
/*instantiate a battery service*/
//bas_register();
bas_register();
/*instantiate the driver for button profile*/
//app_button_init();
#if (BUT_PROFILE_CFG)
/*instantiate a button service*/
button_init(SimpleDataCallBack);
//button_init(SimpleDataCallBack);
#endif ///BUT_PROFILE_CFG
#if (HIDD_LE_PROFILE_CFG)
@@ -250,6 +276,8 @@ static void bta_gatts_set_adv_data_cback(tBTA_STATUS call_status)
#if (WX_AIRSYNC_CFG)
AirSync_Init(NULL);
#endif ///WX_AIRSYNC_CFG
esp_ble_start_advertising(&adv_params);
//API_Ble_AppStartAdvertising(&adv_params);
/*start advetising*/
// BTA_GATTS_Listen(server_if, true, NULL);
}
@@ -268,16 +296,16 @@ void bta_gatts_callback(tBTA_GATTS_EVT event, tBTA_GATTS* p_data)
LOG_ERROR("set advertising parameters\n");
//set the advertising data to the btm layer
ESP_AppBleConfigadvData(&wechat_adv_data[BLE_ADV_DATA_IDX],
esp_ble_config_adv_data(&wechat_adv_data[BLE_ADV_DATA_IDX],
bta_gatts_set_adv_data_cback);
//set the adversting data to the btm layer
ESP_AppBleSetScanRsp(&wechat_adv_data[BLE_SCAN_RSP_DATA_IDX],NULL);
}
break;
/*connect callback*/
case BTA_GATTS_CONNECT_EVT:
{
///Stop the advertising when the connection is establish
esp_ble_stop_advertising();
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);
@@ -286,7 +314,11 @@ void bta_gatts_callback(tBTA_GATTS_EVT event, tBTA_GATTS* p_data)
LOG_ERROR("is_connected=%d\n",is_connected);
}
break;
case BTA_GATTS_DISCONNECT_EVT:
///start the advertising again when lose the connection
esp_ble_start_advertising(&adv_params);
break;
default:
LOG_ERROR("unsettled event: %d\n", event);
}
@@ -294,7 +326,7 @@ void bta_gatts_callback(tBTA_GATTS_EVT event, tBTA_GATTS* p_data)
}
#if (BUT_PROFILE_CFG)
static void SimpleDataCallBack(UINT8 app_id, UINT8 event, UINT8 len, UINT8 *p_data)
static void SimpleDataCallBack(uint8_t app_id, uint8_t event, uint16_t len, uint8_t *p_data)
{
LOG_ERROR("the event value is:%x\n",event);
switch(event)
@@ -321,7 +353,10 @@ static void ble_server_appRegister(void)
btif_to_bta_uuid(&t_uuid, &uuid);
LOG_ERROR("register gatts application\n");
BTA_GATTS_AppRegister(&t_uuid, bta_gatts_callback);
esp_ble_gatts_app_register(&t_uuid, bta_gatts_callback);
bt_prf_sys_init();
ble_but_prf_enable();
}
void gatts_server_test(void)

View File

@@ -57,6 +57,9 @@ extern app_key_env key_press;
uint8_t check_sum(uint8_t *check_array,uint8_t len);
void ble_but_prf_enable(void);
void ble_but_create_svc(void);

View File

@@ -0,0 +1,131 @@
/**
*******************************************************************************
*********
*
* @file app_button_int.h
*
* @brief button Service Application entry point
*
* Copyright (C) ESPRESSSIF 2016
* Created by Yulong at 2016/10/17
*
*******************************************************************************
**********/
#include "prf_defs.h"
#include "bt_prf_sys.h"
#include "bt_types.h"
#if (BUT_PROFILE_CFG)
/// Messages for Device Information Service Server
enum
{
///Add a BUTTON instance into the database
BLE_BUT_CREATE_DB_REQ_EVT = BT_PRF_SYS_EVT_START(PRF_ID_BUT_LE),
///Send key value confirm to APP so stable values can be erased
///if correctly sent.
BLE_BUT_VAL_SEND_CFM_EVT,
///Set the value of an attribute
BLE_BUT_SET_CHAR_VAL_REQ_EVT,
///Start the button notify Service Task - at connection
BLE_BUT_ENABLE_REQ_EVT,
/// Inform the application that the profile service role task has been disabled after a disconnection
BLE_BUT_DISABLE_IND_EVT,
/// Inform the application that the profile service has been reiceivd the charateristic write commamd from Client
BLE_BUT_CHAR_WRITE_IND_EVT,
///Error indication to Host
BLE_BUT_ERROR_IND_EVT,
};
/// Parameters of the @ref KEY_CREATE_DB_REQ message
typedef struct
{
///Database configuration
uint16_t features;
}tBUT_CRT_DB_REQ;
/// Parameters of the @ref KEY_CREATE_DB_CFM message
typedef struct
{
///Status
uint8_t status;
}tBUT_CRT_DB_CFM;
///Parameters of the @ref key_CFG_INDNTF_IND message
typedef struct
{
///Connection handle
uint16_t conhdl;
///Stop/notify/indicate value to configure into the peer characteristic
uint16_t cfg_val;
/// characteristics
uint8_t char_code;
}tBUT_CFG_NTF_IND;
/// Parameters of the @ref KEY_SET_CHAR_VAL_REQ message - shall be dynamically allocated
typedef struct
{
/// Characteristic Code
//uint8_t char_code;
uint8_t conhdl;
uint8_t key_val_len;
uint8_t key_val[2];
}tBUT_SND_CHAR_VAL_REQ;
/// Parameters of the @ref KEY_ENABLE_REQ message
typedef struct
{
///Connection handle
uint16_t conhdl;
/// security level: b0= nothing, b1=unauthenticated, b2=authenticated, b3=authorized; b1 or b2 and b3 can go together
uint8_t sec_lvl;
///Type of connection
uint8_t con_type;
}tBUT_ENABLE_REQ;
///Parameters of the @ref KEY_VAL_SEND_CFM message
typedef struct
{
///Connection handle
uint16_t conhdl;
///Status
uint8_t status;
}tBUT_VAL_SND_CFM;
/// Parameters of the @ref KEY_DISABLE_IND message
typedef struct
{
///Connection handle
uint16_t conhdl;
}tBUT_DISABLE_IND;
typedef union
{
uint16_t conhdl;
tBUT_CRT_DB_REQ but_crt_db_req;
tBUT_CRT_DB_CFM but_crt_db_cfm;
tBUT_CFG_NTF_IND but_cfg_ntf_ind;
tBUT_SND_CHAR_VAL_REQ but_snd_char_val_req;
tBUT_ENABLE_REQ but_enable_req;
tBUT_VAL_SND_CFM but_val_snd_cfm;
tBUT_DISABLE_IND but_disable_ind;
}tBUT_PRF_MSG;
BOOLEAN ble_but_prf_hdl_event(prf_hdr_evt_t *msg_data);
void ble_but_prf_disable(void);
#endif ///BUT_PROFILE_CFG

View File

@@ -2,7 +2,7 @@
#define __APP_WECHAT_UTIL_H__
#include "prf_defs.h"
if (WX_AIRSYNC_CFG)
#if (WX_AIRSYNC_CFG)
#include <stdint.h>
#include <string.h>

View File

@@ -1,18 +0,0 @@
/**
****************************************************************************************
*
* @file bt_app_api.h
*
* @brief Application entry point
*
* Copyright (C) Espressif 2016
* Created by Yulong at 2016/10/13
*
*
****************************************************************************************
*/

View File

@@ -1,31 +0,0 @@
#ifndef __BT_APP_COMMON_H__
#define __BT_APP_COMMON_H__
#include <stdint.h>
#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__ */

View File

@@ -1,23 +0,0 @@
#include "bta_api.h"
#include "btm_ble_api.h"
enum
{
BLE_ADV_DATA_IDX,
BLE_SCAN_RSP_DATA_IDX,
ADV_SCAN_IDX_MAX
};
typedef struct
{
char *adv_name; //set the device name to be sent on the advertising
tBTA_BLE_ADV_DATA ble_adv_data;
}tESP_BLE_ADV_DATA;
extern void ESP_AppBleConfigadvData(tESP_BLE_ADV_DATA *adv_data,
tBTA_SET_ADV_DATA_CMPL_CBACK *p_adv_data_cback);
extern void ESP_AppBleSetScanRsp(tESP_BLE_ADV_DATA *scan_rsp_data,
tBTA_SET_ADV_DATA_CMPL_CBACK *p_scan_rsp_data_cback);

View File

@@ -1,78 +0,0 @@
/**
****************************************************************************************
*
* @file bt_app_sec.h
*
* @brief Application entry point
*
* Copyright (C) Espressif 2016
* Created by Yulong at 2016/10/13
*
*
****************************************************************************************
*/
#include "bt_types.h"
#define APP_SEC_IRK_FLAG (0)
#define RAND_NB_LEN 0x08
#define SEC_KEY_LEN 0x10
/*
* STRUCTURES DEFINITIONS
****************************************************************************************
*/
/// Generic Security key structure
typedef struct
{
/// Key value MSB -> LSB
UINT8 key[SEC_KEY_LEN];
}smp_sec_key;
///Random number structure
typedef struct
{
///8-byte array for random number
UINT8 nb[RAND_NB_LEN];
}rand_nb;
typedef struct
{
// LTK
smp_sec_key ltk;
// Random Number
rand_nb rand_nb;
// EDIV
UINT16 ediv;
// LTK key size
UINT8 key_size;
// Last paired peer address type
UINT8 peer_addr_type;
// Last paired peer address
BD_ADDR peer_addr;
// authentication level
UINT8 auth;
}tAPP_SEC_ENV;
extern tAPP_SEC_ENV app_sec_env;
/*
* GLOBAL FUNCTIONS DECLARATIONS
****************************************************************************************
*/
void app_ble_sec_init(void);
void app_ble_sec_pairing_cmp_evt_send(UINT8);
UINT32 app_ble_sec_gen_tk(void);
void app_ble_sec_gen_ltk(UINT8 key_size);
void app_ble_security_start(void);

View File

@@ -15,7 +15,7 @@ void pingTask(void *pvParameters)
{
while (1) {
vTaskDelay(1000 / portTICK_PERIOD_MS);
printf("ping\n");
//printf("ping\n");
}
}