mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
components/bt: Add API and EVT for set AFH channels(BR/EDR)
This commit is contained in:
parent
143d26aa49
commit
3b704d2f3a
@ -347,4 +347,22 @@ esp_err_t esp_bt_gap_ssp_confirm_reply(esp_bd_addr_t bd_addr, bool accept)
|
|||||||
|
|
||||||
#endif /*(BT_SSP_INCLUDED == TRUE)*/
|
#endif /*(BT_SSP_INCLUDED == TRUE)*/
|
||||||
|
|
||||||
|
esp_err_t esp_bt_gap_set_afh_channels(esp_bt_gap_afh_channels channels)
|
||||||
|
{
|
||||||
|
btc_msg_t msg;
|
||||||
|
btc_gap_bt_args_t arg;
|
||||||
|
|
||||||
|
if (esp_bluedroid_get_status() != ESP_BLUEDROID_STATUS_ENABLED) {
|
||||||
|
return ESP_ERR_INVALID_STATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.sig = BTC_SIG_API_CALL;
|
||||||
|
msg.pid = BTC_PID_GAP_BT;
|
||||||
|
msg.act = BTC_GAP_BT_ACT_SET_AFH_CHANNELS;
|
||||||
|
|
||||||
|
memcpy(&arg.set_afh_channels.channels, channels, ESP_BT_GAP_AFH_CHANNELS_LEN);
|
||||||
|
arg.set_afh_channels.channels[ESP_BT_GAP_AFH_CHANNELS_LEN -1] &= 0x7F;
|
||||||
|
return (btc_transfer_context(&msg, &arg, sizeof(btc_gap_bt_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* #if BTC_GAP_BT_INCLUDED == TRUE */
|
#endif /* #if BTC_GAP_BT_INCLUDED == TRUE */
|
||||||
|
@ -45,6 +45,9 @@ typedef enum {
|
|||||||
ESP_BT_INIT_COD = 0x0a, /*!< overwrite major, minor, and service class */
|
ESP_BT_INIT_COD = 0x0a, /*!< overwrite major, minor, and service class */
|
||||||
} esp_bt_cod_mode_t;
|
} esp_bt_cod_mode_t;
|
||||||
|
|
||||||
|
#define ESP_BT_GAP_AFH_CHANNELS_LEN 10
|
||||||
|
typedef uint8_t esp_bt_gap_afh_channels[ESP_BT_GAP_AFH_CHANNELS_LEN];
|
||||||
|
|
||||||
/// Discoverability and Connectability mode
|
/// Discoverability and Connectability mode
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ESP_BT_SCAN_MODE_NONE = 0, /*!< Neither discoverable nor connectable */
|
ESP_BT_SCAN_MODE_NONE = 0, /*!< Neither discoverable nor connectable */
|
||||||
@ -174,6 +177,7 @@ typedef enum {
|
|||||||
ESP_BT_GAP_KEY_NOTIF_EVT, /*!< Simple Pairing Passkey Notification */
|
ESP_BT_GAP_KEY_NOTIF_EVT, /*!< Simple Pairing Passkey Notification */
|
||||||
ESP_BT_GAP_KEY_REQ_EVT, /*!< Simple Pairing Passkey request */
|
ESP_BT_GAP_KEY_REQ_EVT, /*!< Simple Pairing Passkey request */
|
||||||
ESP_BT_GAP_READ_RSSI_DELTA_EVT, /*!< read rssi event */
|
ESP_BT_GAP_READ_RSSI_DELTA_EVT, /*!< read rssi event */
|
||||||
|
ESP_BT_GAP_SET_AFH_CHANNELS_EVT, /*!< set AFH channels event */
|
||||||
ESP_BT_GAP_EVT_MAX,
|
ESP_BT_GAP_EVT_MAX,
|
||||||
} esp_bt_gap_cb_event_t;
|
} esp_bt_gap_cb_event_t;
|
||||||
|
|
||||||
@ -271,6 +275,13 @@ typedef union {
|
|||||||
struct key_req_param {
|
struct key_req_param {
|
||||||
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
|
||||||
} key_req; /*!< passkey request parameter struct */
|
} key_req; /*!< passkey request parameter struct */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief ESP_BT_GAP_SET_AFH_CHANNELS_EVT
|
||||||
|
*/
|
||||||
|
struct set_afh_channels_param {
|
||||||
|
esp_bt_status_t stat; /*!< set AFH channel status */
|
||||||
|
} set_afh_channels;
|
||||||
} esp_bt_gap_cb_param_t;
|
} esp_bt_gap_cb_param_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -581,6 +592,22 @@ esp_err_t esp_bt_gap_ssp_confirm_reply(esp_bd_addr_t bd_addr, bool accept);
|
|||||||
|
|
||||||
#endif /*(BT_SSP_INCLUDED == TRUE)*/
|
#endif /*(BT_SSP_INCLUDED == TRUE)*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the AFH channels
|
||||||
|
*
|
||||||
|
* @param[in] channles : The n th such field (in the range 0 to 78) contains the value for channel n :
|
||||||
|
* Channel n is bad = 0
|
||||||
|
* Channel n is unknown = 1
|
||||||
|
* The most significant bit is reserved and shall be set to 0
|
||||||
|
* At least 20 channels shall be marked as unknown
|
||||||
|
*
|
||||||
|
* @return - ESP_OK : success
|
||||||
|
* - ESP_ERR_INVALID_STATE: if bluetooth stack is not yet enabled
|
||||||
|
* - other : failed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
esp_err_t esp_bt_gap_set_afh_channels(esp_bt_gap_afh_channels channles);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -593,6 +593,23 @@ void bta_dm_set_dev_name (tBTA_DM_MSG *p_data)
|
|||||||
bta_dm_set_eir ((char *)p_data->set_name.name);
|
bta_dm_set_eir ((char *)p_data->set_name.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function bta_dm_set_afh_channels
|
||||||
|
**
|
||||||
|
** Description Sets AFH channels
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Returns void
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
void bta_dm_set_afh_channels (tBTA_DM_MSG *p_data)
|
||||||
|
{
|
||||||
|
#if CLASSIC_BT_INCLUDED
|
||||||
|
BTM_SetAfhChannels (p_data->set_afh_channels.channels, p_data->set_afh_channels.set_afh_cb);
|
||||||
|
#endif /// CLASSIC_BT_INCLUDED
|
||||||
|
}
|
||||||
|
|
||||||
void bta_dm_update_white_list(tBTA_DM_MSG *p_data)
|
void bta_dm_update_white_list(tBTA_DM_MSG *p_data)
|
||||||
{
|
{
|
||||||
BTM_BleUpdateAdvWhitelist(p_data->white_list.add_remove, p_data->white_list.remote_addr, p_data->white_list.add_wl_cb);
|
BTM_BleUpdateAdvWhitelist(p_data->white_list.add_remove, p_data->white_list.remote_addr, p_data->white_list.add_wl_cb);
|
||||||
|
@ -183,6 +183,35 @@ void BTA_DmSetDeviceName(const char *p_name)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTA_DmSetAfhChannels
|
||||||
|
**
|
||||||
|
** Description This function sets the AFH channels
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Returns void
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
void BTA_DmSetAfhChannels(const uint8_t *channels, tBTA_CMPL_CB *set_afh_cb)
|
||||||
|
{
|
||||||
|
|
||||||
|
tBTA_DM_API_SET_AFH_CHANNELS *p_msg;
|
||||||
|
|
||||||
|
if ((p_msg = (tBTA_DM_API_SET_AFH_CHANNELS *) osi_malloc(sizeof(tBTA_DM_API_SET_AFH_CHANNELS))) != NULL) {
|
||||||
|
p_msg->hdr.event = BTA_DM_API_SET_AFH_CHANNELS_EVT;
|
||||||
|
|
||||||
|
p_msg->set_afh_cb = set_afh_cb;
|
||||||
|
memcpy(p_msg->channels, channels, AFH_CHANNELS_LEN);
|
||||||
|
|
||||||
|
bta_sys_sendmsg(p_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif /// CLASSIC_BT_INCLUDED == TRUE
|
||||||
|
|
||||||
void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBTA_ADD_WHITELIST_CBACK *add_wl_cb)
|
void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBTA_ADD_WHITELIST_CBACK *add_wl_cb)
|
||||||
{
|
{
|
||||||
tBTA_DM_API_UPDATE_WHITE_LIST *p_msg;
|
tBTA_DM_API_UPDATE_WHITE_LIST *p_msg;
|
||||||
|
@ -56,6 +56,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
|
|||||||
bta_dm_enable, /* BTA_DM_API_ENABLE_EVT */
|
bta_dm_enable, /* BTA_DM_API_ENABLE_EVT */
|
||||||
bta_dm_disable, /* BTA_DM_API_DISABLE_EVT */
|
bta_dm_disable, /* BTA_DM_API_DISABLE_EVT */
|
||||||
bta_dm_set_dev_name, /* BTA_DM_API_SET_NAME_EVT */
|
bta_dm_set_dev_name, /* BTA_DM_API_SET_NAME_EVT */
|
||||||
|
bta_dm_set_afh_channels, /* BTA_DM_API_SET_AFH_CHANNELS_EVT */
|
||||||
bta_dm_set_visibility, /* BTA_DM_API_SET_VISIBILITY_EVT */
|
bta_dm_set_visibility, /* BTA_DM_API_SET_VISIBILITY_EVT */
|
||||||
bta_dm_acl_change, /* BTA_DM_ACL_CHANGE_EVT */
|
bta_dm_acl_change, /* BTA_DM_ACL_CHANGE_EVT */
|
||||||
bta_dm_add_device, /* BTA_DM_API_ADD_DEVICE_EVT */
|
bta_dm_add_device, /* BTA_DM_API_ADD_DEVICE_EVT */
|
||||||
|
@ -52,6 +52,7 @@ enum {
|
|||||||
BTA_DM_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_DM),
|
BTA_DM_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_DM),
|
||||||
BTA_DM_API_DISABLE_EVT,
|
BTA_DM_API_DISABLE_EVT,
|
||||||
BTA_DM_API_SET_NAME_EVT,
|
BTA_DM_API_SET_NAME_EVT,
|
||||||
|
BTA_DM_API_SET_AFH_CHANNELS_EVT,
|
||||||
BTA_DM_API_SET_VISIBILITY_EVT,
|
BTA_DM_API_SET_VISIBILITY_EVT,
|
||||||
|
|
||||||
BTA_DM_ACL_CHANGE_EVT,
|
BTA_DM_ACL_CHANGE_EVT,
|
||||||
@ -188,6 +189,13 @@ typedef struct {
|
|||||||
BD_NAME name; /* max 248 bytes name, plus must be Null terminated */
|
BD_NAME name; /* max 248 bytes name, plus must be Null terminated */
|
||||||
} tBTA_DM_API_SET_NAME;
|
} tBTA_DM_API_SET_NAME;
|
||||||
|
|
||||||
|
/* data type for BTA_DM_API_SET_AFH_CHANNELS_EVT */
|
||||||
|
typedef struct {
|
||||||
|
BT_HDR hdr;
|
||||||
|
AFH_CHANNELS channels;
|
||||||
|
tBTA_CMPL_CB *set_afh_cb;
|
||||||
|
}tBTA_DM_API_SET_AFH_CHANNELS;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BT_HDR hdr;
|
BT_HDR hdr;
|
||||||
BOOLEAN add_remove;
|
BOOLEAN add_remove;
|
||||||
@ -477,7 +485,7 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BT_HDR hdr;
|
BT_HDR hdr;
|
||||||
BOOLEAN add;
|
BOOLEAN add;
|
||||||
UINT32 static_passkey;
|
UINT32 static_passkey;
|
||||||
} tBTA_DM_API_SET_DEFAULT_PASSKEY;
|
} tBTA_DM_API_SET_DEFAULT_PASSKEY;
|
||||||
|
|
||||||
@ -784,6 +792,8 @@ typedef union {
|
|||||||
|
|
||||||
tBTA_DM_API_SET_NAME set_name;
|
tBTA_DM_API_SET_NAME set_name;
|
||||||
|
|
||||||
|
tBTA_DM_API_SET_AFH_CHANNELS set_afh_channels;
|
||||||
|
|
||||||
tBTA_DM_API_UPDATE_WHITE_LIST white_list;
|
tBTA_DM_API_UPDATE_WHITE_LIST white_list;
|
||||||
tBTA_DM_API_READ_ADV_TX_POWER read_tx_power;
|
tBTA_DM_API_READ_ADV_TX_POWER read_tx_power;
|
||||||
tBTA_DM_API_READ_RSSI rssi;
|
tBTA_DM_API_READ_RSSI rssi;
|
||||||
@ -1221,6 +1231,7 @@ extern void bta_dm_search_sm_disable( void );
|
|||||||
extern void bta_dm_enable (tBTA_DM_MSG *p_data);
|
extern void bta_dm_enable (tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_disable (tBTA_DM_MSG *p_data);
|
extern void bta_dm_disable (tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_set_dev_name (tBTA_DM_MSG *p_data);
|
extern void bta_dm_set_dev_name (tBTA_DM_MSG *p_data);
|
||||||
|
extern void bta_dm_set_afh_channels (tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_update_white_list(tBTA_DM_MSG *p_data);
|
extern void bta_dm_update_white_list(tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data);
|
extern void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data);
|
||||||
extern void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data);
|
extern void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data);
|
||||||
|
@ -422,6 +422,8 @@ typedef tBTM_TX_POWER_RESULTS tBTA_TX_POWER_RESULTS;
|
|||||||
|
|
||||||
typedef tBTM_RSSI_RESULTS tBTA_RSSI_RESULTS;
|
typedef tBTM_RSSI_RESULTS tBTA_RSSI_RESULTS;
|
||||||
|
|
||||||
|
typedef tBTM_SET_AFH_CHANNELS_RESULTS tBTA_SET_AFH_CHANNELS_RESULTS;
|
||||||
|
|
||||||
/* advertising channel map */
|
/* advertising channel map */
|
||||||
#define BTA_BLE_ADV_CHNL_37 BTM_BLE_ADV_CHNL_37
|
#define BTA_BLE_ADV_CHNL_37 BTM_BLE_ADV_CHNL_37
|
||||||
#define BTA_BLE_ADV_CHNL_38 BTM_BLE_ADV_CHNL_38
|
#define BTA_BLE_ADV_CHNL_38 BTM_BLE_ADV_CHNL_38
|
||||||
@ -1450,6 +1452,18 @@ extern void BTA_DisableTestMode(void);
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
extern void BTA_DmSetDeviceName(const char *p_name);
|
extern void BTA_DmSetDeviceName(const char *p_name);
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTA_DmSetAfhChannels
|
||||||
|
**
|
||||||
|
** Description This function sets the AFH channels
|
||||||
|
**
|
||||||
|
**
|
||||||
|
** Returns void
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
void BTA_DmSetAfhChannels(const uint8_t *channels, tBTA_CMPL_CB *set_afh_cb);
|
||||||
|
|
||||||
extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBTA_ADD_WHITELIST_CBACK *add_wl_cb);
|
extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBTA_ADD_WHITELIST_CBACK *add_wl_cb);
|
||||||
|
|
||||||
extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb);
|
extern void BTA_DmBleReadAdvTxPower(tBTA_CMPL_CB *cmpl_cb);
|
||||||
@ -2292,8 +2306,8 @@ extern void BTA_DmBleSetScanRspRaw (UINT8 *p_raw_scan_rsp, UINT32 raw_scan_rsp_l
|
|||||||
** Returns None
|
** Returns None
|
||||||
**
|
**
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
|
extern void BTA_DmUpdateDuplicateExceptionalList(UINT8 subcode, UINT32 type,
|
||||||
BD_ADDR device_info,
|
BD_ADDR device_info,
|
||||||
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback);
|
tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK p_update_duplicate_exceptional_list_cback);
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -224,6 +224,9 @@ esp_bt_status_t btc_btm_status_to_esp_status (uint8_t btm_status)
|
|||||||
case BTM_NO_RESOURCES:
|
case BTM_NO_RESOURCES:
|
||||||
esp_status = ESP_BT_STATUS_NOMEM;
|
esp_status = ESP_BT_STATUS_NOMEM;
|
||||||
break;
|
break;
|
||||||
|
case BTM_ILLEGAL_VALUE:
|
||||||
|
esp_status = ESP_BT_STATUS_PARM_INVALID;
|
||||||
|
break;
|
||||||
case BTM_ERR_PROCESSING:
|
case BTM_ERR_PROCESSING:
|
||||||
esp_status = ESP_BT_STATUS_PENDING;
|
esp_status = ESP_BT_STATUS_PENDING;
|
||||||
break;
|
break;
|
||||||
|
@ -686,6 +686,31 @@ static void btc_gap_bt_ssp_confirm(btc_gap_bt_args_t *arg)
|
|||||||
|
|
||||||
#endif ///BT_SSP_INCLUDED == TRUE
|
#endif ///BT_SSP_INCLUDED == TRUE
|
||||||
|
|
||||||
|
static void btc_gap_bt_set_afh_channels_cmpl_callback(void *p_data)
|
||||||
|
{
|
||||||
|
tBTA_SET_AFH_CHANNELS_RESULTS *result = (tBTA_SET_AFH_CHANNELS_RESULTS *)p_data;
|
||||||
|
esp_bt_gap_cb_param_t param;
|
||||||
|
bt_status_t ret;
|
||||||
|
btc_msg_t msg;
|
||||||
|
msg.sig = BTC_SIG_API_CB;
|
||||||
|
msg.pid = BTC_PID_GAP_BT;
|
||||||
|
msg.act = BTC_GAP_BT_SET_AFH_CHANNELS_EVT;
|
||||||
|
|
||||||
|
param.set_afh_channels.stat = btc_btm_status_to_esp_status(result->status);
|
||||||
|
|
||||||
|
ret = btc_transfer_context(&msg, ¶m,
|
||||||
|
sizeof(esp_bt_gap_cb_param_t), NULL);
|
||||||
|
|
||||||
|
if (ret != BT_STATUS_SUCCESS) {
|
||||||
|
BTC_TRACE_ERROR("%s btc_transfer_context failed\n", __func__);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void btc_gap_bt_set_afh_channels(btc_gap_bt_args_t *arg)
|
||||||
|
{
|
||||||
|
BTA_DmSetAfhChannels(arg->set_afh_channels.channels, btc_gap_bt_set_afh_channels_cmpl_callback);
|
||||||
|
}
|
||||||
|
|
||||||
void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
void btc_gap_bt_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||||
{
|
{
|
||||||
switch (msg->act) {
|
switch (msg->act) {
|
||||||
@ -740,6 +765,7 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
|
|||||||
case BTC_GAP_BT_ACT_REMOVE_BOND_DEVICE:
|
case BTC_GAP_BT_ACT_REMOVE_BOND_DEVICE:
|
||||||
case BTC_GAP_BT_ACT_PIN_REPLY:
|
case BTC_GAP_BT_ACT_PIN_REPLY:
|
||||||
case BTC_GAP_BT_ACT_SET_PIN_TYPE:
|
case BTC_GAP_BT_ACT_SET_PIN_TYPE:
|
||||||
|
case BTC_GAP_BT_ACT_SET_AFH_CHANNELS:
|
||||||
break;
|
break;
|
||||||
#if (BT_SSP_INCLUDED == TRUE)
|
#if (BT_SSP_INCLUDED == TRUE)
|
||||||
case BTC_GAP_BT_ACT_PASSKEY_REPLY:
|
case BTC_GAP_BT_ACT_PASSKEY_REPLY:
|
||||||
@ -815,6 +841,11 @@ void btc_gap_bt_call_handler(btc_msg_t *msg)
|
|||||||
}
|
}
|
||||||
#endif ///BT_SSP_INCLUDED == TRUE
|
#endif ///BT_SSP_INCLUDED == TRUE
|
||||||
|
|
||||||
|
case BTC_GAP_BT_ACT_SET_AFH_CHANNELS: {
|
||||||
|
btc_gap_bt_set_afh_channels(arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -849,6 +880,7 @@ void btc_gap_bt_cb_deep_free(btc_msg_t *msg)
|
|||||||
case BTC_GAP_BT_READ_RSSI_DELTA_EVT:
|
case BTC_GAP_BT_READ_RSSI_DELTA_EVT:
|
||||||
case BTC_GAP_BT_AUTH_CMPL_EVT:
|
case BTC_GAP_BT_AUTH_CMPL_EVT:
|
||||||
case BTC_GAP_BT_PIN_REQ_EVT:
|
case BTC_GAP_BT_PIN_REQ_EVT:
|
||||||
|
case BTC_GAP_BT_SET_AFH_CHANNELS_EVT:
|
||||||
#if (BT_SSP_INCLUDED == TRUE)
|
#if (BT_SSP_INCLUDED == TRUE)
|
||||||
case BTC_GAP_BT_CFM_REQ_EVT:
|
case BTC_GAP_BT_CFM_REQ_EVT:
|
||||||
case BTC_GAP_BT_KEY_NOTIF_EVT:
|
case BTC_GAP_BT_KEY_NOTIF_EVT:
|
||||||
@ -902,6 +934,10 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif ///BT_SSP_INCLUDED == TRUE
|
#endif ///BT_SSP_INCLUDED == TRUE
|
||||||
|
case BTC_GAP_BT_SET_AFH_CHANNELS_EVT:{
|
||||||
|
btc_gap_bt_cb_to_app(ESP_BT_GAP_SET_AFH_CHANNELS_EVT, (esp_bt_gap_cb_param_t *)msg->arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
|
BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act);
|
||||||
break;
|
break;
|
||||||
|
@ -32,6 +32,7 @@ typedef enum {
|
|||||||
BTC_GAP_BT_KEY_NOTIF_EVT,
|
BTC_GAP_BT_KEY_NOTIF_EVT,
|
||||||
BTC_GAP_BT_KEY_REQ_EVT,
|
BTC_GAP_BT_KEY_REQ_EVT,
|
||||||
BTC_GAP_BT_READ_RSSI_DELTA_EVT,
|
BTC_GAP_BT_READ_RSSI_DELTA_EVT,
|
||||||
|
BTC_GAP_BT_SET_AFH_CHANNELS_EVT,
|
||||||
}btc_gap_bt_evt_t;
|
}btc_gap_bt_evt_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -48,6 +49,7 @@ typedef enum {
|
|||||||
BTC_GAP_BT_ACT_SET_SECURITY_PARAM,
|
BTC_GAP_BT_ACT_SET_SECURITY_PARAM,
|
||||||
BTC_GAP_BT_ACT_PASSKEY_REPLY,
|
BTC_GAP_BT_ACT_PASSKEY_REPLY,
|
||||||
BTC_GAP_BT_ACT_CONFIRM_REPLY,
|
BTC_GAP_BT_ACT_CONFIRM_REPLY,
|
||||||
|
BTC_GAP_BT_ACT_SET_AFH_CHANNELS,
|
||||||
} btc_gap_bt_act_t;
|
} btc_gap_bt_act_t;
|
||||||
|
|
||||||
/* btc_bt_gap_args_t */
|
/* btc_bt_gap_args_t */
|
||||||
@ -123,6 +125,11 @@ typedef union {
|
|||||||
bt_bdaddr_t bda;
|
bt_bdaddr_t bda;
|
||||||
bool accept;
|
bool accept;
|
||||||
} confirm_reply;
|
} confirm_reply;
|
||||||
|
|
||||||
|
// BTC_GAP_BT_ACT_SET_AFH_CHANNELS
|
||||||
|
struct set_afh_channels_args {
|
||||||
|
esp_bt_gap_afh_channels channels;
|
||||||
|
} set_afh_channels;
|
||||||
} btc_gap_bt_args_t;
|
} btc_gap_bt_args_t;
|
||||||
|
|
||||||
void btc_gap_bt_call_handler(btc_msg_t *msg);
|
void btc_gap_bt_call_handler(btc_msg_t *msg);
|
||||||
|
@ -1001,4 +1001,76 @@ void btm_report_device_status (tBTM_DEV_STATUS status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTM_SetAfhChannels
|
||||||
|
**
|
||||||
|
** Description This function is called to set AFH channels
|
||||||
|
**
|
||||||
|
** Returns status of the operation
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
tBTM_STATUS BTM_SetAfhChannels (AFH_CHANNELS channels, tBTM_CMPL_CB *p_afh_channels_cmpl_cback)
|
||||||
|
{
|
||||||
|
if (!controller_get_interface()->get_is_ready()) {
|
||||||
|
return (BTM_DEV_RESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if set afh already in progress */
|
||||||
|
if (btm_cb.devcb.p_afh_channels_cmpl_cb) {
|
||||||
|
return (BTM_NO_RESOURCES);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Save callback */
|
||||||
|
btm_cb.devcb.p_afh_channels_cmpl_cb = p_afh_channels_cmpl_cback;
|
||||||
|
|
||||||
|
if (!btsnd_hcic_set_afh_channels (channels)) {
|
||||||
|
return (BTM_NO_RESOURCES);
|
||||||
|
}
|
||||||
|
|
||||||
|
btu_start_timer (&btm_cb.devcb.afh_channels_timer, BTU_TTYPE_BTM_ACL, BTM_DEV_REPLY_TIMEOUT);
|
||||||
|
|
||||||
|
return BTM_CMD_STARTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function btm_set_afh_channels_complete
|
||||||
|
**
|
||||||
|
** Description This function is called when set AFH channels complete.
|
||||||
|
** message is received from the HCI.
|
||||||
|
**
|
||||||
|
** Returns void
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
void btm_set_afh_channels_complete (UINT8 *p)
|
||||||
|
{
|
||||||
|
tBTM_CMPL_CB *p_cb = btm_cb.devcb.p_afh_channels_cmpl_cb;
|
||||||
|
tBTM_SET_AFH_CHANNELS_RESULTS results;
|
||||||
|
|
||||||
|
btu_free_timer (&btm_cb.devcb.afh_channels_timer);
|
||||||
|
|
||||||
|
/* If there was a callback address for set AFH channels, call it */
|
||||||
|
btm_cb.devcb.p_afh_channels_cmpl_cb = NULL;
|
||||||
|
|
||||||
|
if (p_cb) {
|
||||||
|
STREAM_TO_UINT8 (results.hci_status, p);
|
||||||
|
|
||||||
|
switch (results.hci_status){
|
||||||
|
case HCI_SUCCESS:
|
||||||
|
results.status = BTM_SUCCESS;
|
||||||
|
break;
|
||||||
|
case HCI_ERR_UNSUPPORTED_VALUE:
|
||||||
|
case HCI_ERR_ILLEGAL_PARAMETER_FMT:
|
||||||
|
results.status = BTM_ILLEGAL_VALUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
results.status = BTM_ERR_PROCESSING;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
(*p_cb)(&results);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif /// CLASSIC_BT_INCLUDED == TRUE
|
||||||
|
|
||||||
|
@ -162,6 +162,12 @@ tBTM_CMPL_CB *p_switch_role_cb; /* Callback function to be called when
|
|||||||
TIMER_LIST_ENT tx_power_timer;
|
TIMER_LIST_ENT tx_power_timer;
|
||||||
tBTM_CMPL_CB *p_tx_power_cmpl_cb;/* Callback function to be called */
|
tBTM_CMPL_CB *p_tx_power_cmpl_cb;/* Callback function to be called */
|
||||||
|
|
||||||
|
#if CLASSIC_BT_INCLUDED == TRUE
|
||||||
|
TIMER_LIST_ENT afh_channels_timer;
|
||||||
|
tBTM_CMPL_CB *p_afh_channels_cmpl_cb; /* Callback function to be called When */
|
||||||
|
/* set AFH channels is completed */
|
||||||
|
#endif
|
||||||
|
|
||||||
DEV_CLASS dev_class; /* Local device class */
|
DEV_CLASS dev_class; /* Local device class */
|
||||||
|
|
||||||
#if BLE_INCLUDED == TRUE
|
#if BLE_INCLUDED == TRUE
|
||||||
@ -1057,7 +1063,7 @@ void btm_inq_db_reset (void);
|
|||||||
void btm_vendor_specific_evt (UINT8 *p, UINT8 evt_len);
|
void btm_vendor_specific_evt (UINT8 *p, UINT8 evt_len);
|
||||||
void btm_delete_stored_link_key_complete (UINT8 *p);
|
void btm_delete_stored_link_key_complete (UINT8 *p);
|
||||||
void btm_report_device_status (tBTM_DEV_STATUS status);
|
void btm_report_device_status (tBTM_DEV_STATUS status);
|
||||||
|
void btm_set_afh_channels_complete (UINT8 *p);
|
||||||
|
|
||||||
/* Internal functions provided by btm_dev.c
|
/* Internal functions provided by btm_dev.c
|
||||||
**********************************************
|
**********************************************
|
||||||
|
@ -912,6 +912,13 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l
|
|||||||
btm_read_linq_tx_power_complete (p);
|
btm_read_linq_tx_power_complete (p);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||||
|
case HCI_SET_AFH_CHANNELS:
|
||||||
|
btm_set_afh_channels_complete(p);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if (BLE_INCLUDED == TRUE)
|
#if (BLE_INCLUDED == TRUE)
|
||||||
/* BLE Commands sComplete*/
|
/* BLE Commands sComplete*/
|
||||||
case HCI_BLE_ADD_WHITE_LIST:
|
case HCI_BLE_ADD_WHITE_LIST:
|
||||||
|
@ -1876,3 +1876,28 @@ void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode, UINT8 len,
|
|||||||
|
|
||||||
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CLASSIC_BT_INCLUDED == TRUE)
|
||||||
|
BOOLEAN btsnd_hcic_set_afh_channels (AFH_CHANNELS channels)
|
||||||
|
{
|
||||||
|
BT_HDR *p;
|
||||||
|
UINT8 *pp;
|
||||||
|
|
||||||
|
if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SET_AFH_CHANNELS)) == NULL) {
|
||||||
|
return (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
pp = (UINT8 *)(p + 1);
|
||||||
|
|
||||||
|
p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_AFH_CHANNELS;
|
||||||
|
p->offset = 0;
|
||||||
|
|
||||||
|
UINT16_TO_STREAM (pp, HCI_SET_AFH_CHANNELS);
|
||||||
|
UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_AFH_CHANNELS);
|
||||||
|
|
||||||
|
ARRAY_TO_STREAM (pp, channels, HCIC_PARAM_SIZE_SET_AFH_CHANNELS);
|
||||||
|
|
||||||
|
btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p);
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
#endif /// CLASSIC_BT_INCLUDED == TRUE
|
||||||
|
@ -361,6 +361,9 @@ typedef UINT8 ACO[ACO_LEN]; /* Authenticated ciphering offset */
|
|||||||
#define COF_LEN 12
|
#define COF_LEN 12
|
||||||
typedef UINT8 COF[COF_LEN]; /* ciphering offset number */
|
typedef UINT8 COF[COF_LEN]; /* ciphering offset number */
|
||||||
|
|
||||||
|
#define AFH_CHANNELS_LEN 10
|
||||||
|
typedef UINT8 AFH_CHANNELS[AFH_CHANNELS_LEN];
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
UINT8 qos_flags; /* TBD */
|
UINT8 qos_flags; /* TBD */
|
||||||
UINT8 service_type; /* see below */
|
UINT8 service_type; /* see below */
|
||||||
|
@ -795,6 +795,14 @@ typedef struct {
|
|||||||
BD_ADDR rem_bda;
|
BD_ADDR rem_bda;
|
||||||
} tBTM_LINK_QUALITY_RESULTS;
|
} tBTM_LINK_QUALITY_RESULTS;
|
||||||
|
|
||||||
|
/* Structure returned with set AFH channels event (in tBTM_CMPL_CB callback function)
|
||||||
|
** in response to BTM_SetAfhChannels call.
|
||||||
|
*/
|
||||||
|
typedef struct {
|
||||||
|
tBTM_STATUS status;
|
||||||
|
UINT8 hci_status;
|
||||||
|
} tBTM_SET_AFH_CHANNELS_RESULTS;
|
||||||
|
|
||||||
/* Structure returned with read inq tx power quality event (in tBTM_CMPL_CB callback function)
|
/* Structure returned with read inq tx power quality event (in tBTM_CMPL_CB callback function)
|
||||||
** in response to BTM_ReadInquiryRspTxPower call.
|
** in response to BTM_ReadInquiryRspTxPower call.
|
||||||
*/
|
*/
|
||||||
@ -4093,6 +4101,19 @@ void BTM_PCM2Setup_Write (BOOLEAN clk_master, tBTM_VSC_CMPL_CB *p_arc_cb);
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
//extern
|
//extern
|
||||||
tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void);
|
tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void);
|
||||||
|
|
||||||
|
/*******************************************************************************
|
||||||
|
**
|
||||||
|
** Function BTM_SetAfhChannels
|
||||||
|
**
|
||||||
|
** Description This function is called to set AFH channels
|
||||||
|
**
|
||||||
|
** Returns status of the operation
|
||||||
|
**
|
||||||
|
*******************************************************************************/
|
||||||
|
tBTM_STATUS BTM_SetAfhChannels (AFH_CHANNELS channels, tBTM_CMPL_CB *p_afh_channels_cmpl_cback);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -520,6 +520,8 @@ BOOLEAN btsnd_hcic_change_name(BD_NAME name);
|
|||||||
|
|
||||||
#define HCIC_WRITE_PARAM3_PARAM_OFF 0
|
#define HCIC_WRITE_PARAM3_PARAM_OFF 0
|
||||||
|
|
||||||
|
/* set AFH channels */
|
||||||
|
BOOLEAN btsnd_hcic_set_afh_channels (AFH_CHANNELS channels);
|
||||||
#define HCIC_PARAM_SIZE_SET_AFH_CHANNELS 10
|
#define HCIC_PARAM_SIZE_SET_AFH_CHANNELS 10
|
||||||
|
|
||||||
BOOLEAN btsnd_hcic_write_pin_type(UINT8 type); /* Write PIN Type */
|
BOOLEAN btsnd_hcic_write_pin_type(UINT8 type); /* Write PIN Type */
|
||||||
|
Loading…
Reference in New Issue
Block a user