2016-10-26 12:19:48 +00:00
|
|
|
|
|
|
|
#ifndef _BT_APP_DEFS_H__
|
|
|
|
#define _BT_APP_DEFS_H__
|
|
|
|
|
|
|
|
|
2016-09-26 13:37:39 +00:00
|
|
|
#include "bta_api.h"
|
|
|
|
#include "btm_ble_api.h"
|
|
|
|
|
2016-10-21 06:16:01 +00:00
|
|
|
#define API_BLE_CONN_PARAM_UNDEF 0xffff /* use this value when a specific value not to be overwritten */
|
|
|
|
|
2016-10-26 12:19:48 +00:00
|
|
|
#define API_BLE_ADV_CHNL_MAP (API_BLE_ADV_CHNL_37|API_BLE_ADV_CHNL_38|API_BLE_ADV_CHNL_39)
|
|
|
|
|
|
|
|
/* advertising channel map */
|
|
|
|
#define API_BLE_ADV_CHNL_37 (0x01 << 0)
|
|
|
|
#define API_BLE_ADV_CHNL_38 (0x01 << 1)
|
|
|
|
#define API_BLE_ADV_CHNL_39 (0x01 << 2)
|
|
|
|
|
2016-10-21 06:16:01 +00:00
|
|
|
|
|
|
|
#define API_BLE_ISVALID_PARAM(x, min, max) (((x) >= (min) && (x) <= (max)) || ((x) == API_BLE_CONN_PARAM_UNDEF))
|
|
|
|
|
|
|
|
|
2016-09-26 13:37:39 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
BLE_ADV_DATA_IDX,
|
|
|
|
BLE_SCAN_RSP_DATA_IDX,
|
|
|
|
ADV_SCAN_IDX_MAX
|
|
|
|
};
|
|
|
|
|
2016-10-21 06:16:01 +00:00
|
|
|
/// Advertising mode
|
|
|
|
enum api_adv_type
|
|
|
|
{
|
|
|
|
/// Mode in non-discoverable
|
|
|
|
API_NON_DISCOVERABLE,
|
|
|
|
/// Mode in general discoverable
|
|
|
|
API_GEN_DISCOVERABLE,
|
|
|
|
/// Mode in limited discoverable
|
|
|
|
API_LIM_DISCOVERABLE,
|
|
|
|
/// Broadcaster mode which is a non discoverable and non connectable mode.
|
|
|
|
API_BROADCASTER_MODE,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum api_adv_filter
|
|
|
|
{
|
|
|
|
/// Start non connectable advertising
|
|
|
|
API_ADV_NON_CONN,
|
|
|
|
/// Start undirected connectable advertising
|
|
|
|
API_ADV_UNDIRECT,
|
|
|
|
/// Start directed connectable advertising
|
|
|
|
API_ADV_DIRECT_LOW_DUTY,
|
|
|
|
/// Start directed connectable advertising
|
|
|
|
API_ADV_DIRECT
|
|
|
|
};
|
|
|
|
|
2016-10-26 12:19:48 +00:00
|
|
|
/// Own BD address source of the device
|
|
|
|
enum api_own_addr_src
|
|
|
|
{
|
|
|
|
/// Public Address
|
|
|
|
API_PUBLIC_ADDR,
|
|
|
|
/// Provided random address
|
|
|
|
API_PROVIDED_RND_ADDR,
|
|
|
|
/// Provided static random address
|
|
|
|
API_GEN_STATIC_RND_ADDR,
|
|
|
|
/// Generated resolvable private random address
|
|
|
|
API_GEN_RSLV_ADDR,
|
|
|
|
/// Generated non-resolvable private random address
|
|
|
|
API_GEN_NON_RSLV_ADDR,
|
|
|
|
/// Provided Reconnection address
|
|
|
|
API_PROVIDED_RECON_ADDR,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-10-21 06:16:01 +00:00
|
|
|
|
2016-09-26 13:37:39 +00:00
|
|
|
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;
|
|
|
|
|
2016-10-21 06:16:01 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT16 adv_int_min;
|
|
|
|
UINT16 adv_int_max;
|
|
|
|
tBLE_BD_ADDR *p_dir_bda;
|
|
|
|
}tESP_BLE_ADV_PARAM;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT16 adv_int_min;
|
|
|
|
UINT16 adv_int_max;
|
|
|
|
UINT8 adv_type;
|
|
|
|
tBLE_ADDR_TYPE addr_type_own;
|
|
|
|
tBTM_BLE_ADV_CHNL_MAP channel_map;
|
|
|
|
tBTM_BLE_AFP adv_filter_policy;
|
|
|
|
tBLE_BD_ADDR *p_dir_bda;
|
|
|
|
}tESP_API_BLE_ADV_PARAMS_ALL;
|
|
|
|
|
2016-10-25 13:12:10 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
UINT8 scan_type;
|
|
|
|
UINT16 scan_intv;
|
|
|
|
UINT16 scan_win;
|
|
|
|
UINT8 addr_type_own;
|
|
|
|
UINT8 scan_fil_policy;
|
|
|
|
}tESP_BLE_SCAN_PARAMS;
|
|
|
|
|
2016-10-21 06:16:01 +00:00
|
|
|
|
2016-09-26 13:37:39 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
|
2016-10-26 12:19:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif ///_BT_APP_DEFS_H__
|