Merge branch 'feature/btdm_add_api_to_set_channel_classification' into 'master'

Feature/btdm add api to set channel classification

Closes BT-450

See merge request espressif/esp-idf!6229
This commit is contained in:
Jiang Jiang Jian
2019-10-26 20:42:58 +08:00
22 changed files with 590 additions and 25 deletions
@@ -143,31 +143,36 @@ typedef enum {
ESP_GAP_BLE_SCAN_RESULT_EVT, /*!< When one scan result ready, the event comes each time */
ESP_GAP_BLE_ADV_DATA_RAW_SET_COMPLETE_EVT, /*!< When raw advertising data set complete, the event comes */
ESP_GAP_BLE_SCAN_RSP_DATA_RAW_SET_COMPLETE_EVT, /*!< When raw advertising data set complete, the event comes */
ESP_GAP_BLE_ADV_START_COMPLETE_EVT, /*!< When start advertising complete, the event comes */
ESP_GAP_BLE_SCAN_START_COMPLETE_EVT, /*!< When start scan complete, the event comes */
ESP_GAP_BLE_AUTH_CMPL_EVT, /* Authentication complete indication. */
ESP_GAP_BLE_KEY_EVT, /* BLE key event for peer device keys */
ESP_GAP_BLE_SEC_REQ_EVT, /* BLE security request */
ESP_GAP_BLE_PASSKEY_NOTIF_EVT, /* passkey notification event */
ESP_GAP_BLE_PASSKEY_REQ_EVT, /* passkey request event */
ESP_GAP_BLE_OOB_REQ_EVT, /* OOB request event */
ESP_GAP_BLE_LOCAL_IR_EVT, /* BLE local IR event */
ESP_GAP_BLE_LOCAL_ER_EVT, /* BLE local ER event */
ESP_GAP_BLE_NC_REQ_EVT, /* Numeric Comparison request event */
ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT, /*!< When stop adv complete, the event comes */
ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT, /*!< When stop scan complete, the event comes */
ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT, /*!< When set the static rand address complete, the event comes */
ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT, /*!< When update connection parameters complete, the event comes */
ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT, /*!< When set pkt length complete, the event comes */
ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT, /*!< When Enable/disable privacy on the local device complete, the event comes */
ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< When remove the bond device complete, the event comes */
ESP_GAP_BLE_CLEAR_BOND_DEV_COMPLETE_EVT, /*!< When clear the bond device clear complete, the event comes */
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When get the bond device list complete, the event comes */
ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT, /*!< When read the rssi complete, the event comes */
ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT, /*!< When add or remove whitelist complete, the event comes */
ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT, /*!< When update duplicate exceptional list complete, the event comes */
ESP_GAP_BLE_ADV_START_COMPLETE_EVT, /*!< When starting advertising complete, the event comes */
ESP_GAP_BLE_SCAN_START_COMPLETE_EVT, /*!< When starting scan complete, the event comes */
ESP_GAP_BLE_AUTH_CMPL_EVT, /*!< Authentication complete indication. */
ESP_GAP_BLE_KEY_EVT, /*!< BLE key event for peer device keys */
ESP_GAP_BLE_SEC_REQ_EVT, /*!< BLE security request */
ESP_GAP_BLE_PASSKEY_NOTIF_EVT, /*!< passkey notification event */
ESP_GAP_BLE_PASSKEY_REQ_EVT, /*!< passkey request event */
ESP_GAP_BLE_OOB_REQ_EVT, /*!< OOB request event */
ESP_GAP_BLE_LOCAL_IR_EVT, /*!< BLE local IR event */
ESP_GAP_BLE_LOCAL_ER_EVT, /*!< BLE local ER event */
ESP_GAP_BLE_NC_REQ_EVT, /*!< Numeric Comparison request event */
ESP_GAP_BLE_ADV_STOP_COMPLETE_EVT, /*!< When stopping adv complete, the event comes */
ESP_GAP_BLE_SCAN_STOP_COMPLETE_EVT, /*!< When stopping scan complete, the event comes */
ESP_GAP_BLE_SET_STATIC_RAND_ADDR_EVT, /*!< When setting the static rand address complete, the event comes */
ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT, /*!< When updating connection parameters complete, the event comes */
ESP_GAP_BLE_SET_PKT_LENGTH_COMPLETE_EVT, /*!< When setting pkt length complete, the event comes */
ESP_GAP_BLE_SET_LOCAL_PRIVACY_COMPLETE_EVT, /*!< When enabling/disabling privacy on the local device complete, the event comes */
ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT, /*!< When removing the bond device complete, the event comes */
ESP_GAP_BLE_CLEAR_BOND_DEV_COMPLETE_EVT, /*!< When clearing the bond device clear complete, the event comes */
ESP_GAP_BLE_GET_BOND_DEV_COMPLETE_EVT, /*!< When getting the bond device list complete, the event comes */
ESP_GAP_BLE_READ_RSSI_COMPLETE_EVT, /*!< When reading the rssi complete, the event comes */
ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT, /*!< When adding or removing whitelist complete, the event comes */
ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT, /*!< When updating duplicate exceptional list complete, the event comes */
ESP_GAP_BLE_SET_CHANNELS_EVT, /*!< When setting BLE channels complete, the event comes */
ESP_GAP_BLE_EVT_MAX,
} esp_gap_ble_cb_event_t;
#define ESP_GAP_BLE_CHANNELS_LEN 5
typedef uint8_t esp_gap_ble_channels[ESP_GAP_BLE_CHANNELS_LEN];
/// This is the old name, just for backwards compatibility
#define ESP_GAP_BLE_ADD_WHITELIST_COMPLETE_EVT ESP_GAP_BLE_UPDATE_WHITELIST_COMPLETE_EVT
@@ -780,6 +785,12 @@ typedef union {
uint16_t length; /*!< The length of device_info */
esp_duplicate_info_t device_info; /*!< device information, when subcode is ESP_BLE_DUPLICATE_EXCEPTIONAL_LIST_CLEAN, the value is invalid */
} update_duplicate_exceptional_list_cmpl; /*!< Event parameter of ESP_GAP_BLE_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_COMPLETE_EVT */
/**
* @brief ESP_GAP_BLE_SET_CHANNELS_EVT
*/
struct ble_set_channels_evt_param {
esp_bt_status_t stat; /*!< BLE set channel status */
} ble_set_channels; /*!< Event parameter of ESP_GAP_BLE_SET_CHANNELS_EVT */
} esp_ble_gap_cb_param_t;
/**
@@ -1266,6 +1277,22 @@ esp_err_t esp_ble_gap_disconnect(esp_bd_addr_t remote_device);
*/
esp_err_t esp_ble_get_current_conn_params(esp_bd_addr_t bd_addr, esp_gap_conn_params_t *conn_params);
/**
* @brief BLE set channels
*
* @param[in] channels : The n th such field (in the range 0 to 36) contains the value for the link layer channel index n.
* 0 means channel n is bad.
* 1 means channel n is unknown.
* The most significant bits are reserved and shall be set to 0.
* At least one channel 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_gap_ble_set_channels(esp_gap_ble_channels channels);
#ifdef __cplusplus
}
#endif
@@ -45,6 +45,10 @@ typedef enum {
ESP_BT_INIT_COD = 0x0a, /*!< overwrite major, minor, and service class */
} 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
typedef enum {
ESP_BT_NON_CONNECTABLE, /*!< Non-connectable */
@@ -202,6 +206,7 @@ typedef enum {
ESP_BT_GAP_KEY_REQ_EVT, /*!< Simple Pairing Passkey request */
ESP_BT_GAP_READ_RSSI_DELTA_EVT, /*!< read rssi event */
ESP_BT_GAP_CONFIG_EIR_DATA_EVT, /*!< config EIR data event */
ESP_BT_GAP_SET_AFH_CHANNELS_EVT, /*!< set AFH channels event */
ESP_BT_GAP_EVT_MAX,
} esp_bt_gap_cb_event_t;
@@ -312,6 +317,13 @@ typedef union {
struct key_req_param {
esp_bd_addr_t bda; /*!< remote bluetooth device address*/
} 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; /*!< set AFH channel parameter struct */
} esp_bt_gap_cb_param_t;
/**
@@ -637,6 +649,22 @@ esp_err_t esp_bt_gap_ssp_confirm_reply(esp_bd_addr_t bd_addr, bool accept);
#endif /*(BT_SSP_INCLUDED == TRUE)*/
/**
* @brief Set the AFH channels
*
* @param[in] channels : The n th such field (in the range 0 to 78) contains the value for channel n :
* 0 means channel n is bad.
* 1 means channel n is unknown.
* 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 channels);
#ifdef __cplusplus
}
#endif