diff --git a/components/bt/host/bluedroid/api/esp_gap_bt_api.c b/components/bt/host/bluedroid/api/esp_gap_bt_api.c index f096b0fd0..98bf81353 100644 --- a/components/bt/host/bluedroid/api/esp_gap_bt_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_bt_api.c @@ -380,4 +380,21 @@ esp_err_t esp_bt_gap_ssp_confirm_reply(esp_bd_addr_t bd_addr, bool accept) #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 */ diff --git a/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h b/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h index 9e9ab235d..7270c6cf7 100644 --- a/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h +++ b/components/bt/host/bluedroid/api/include/api/esp_gap_bt_api.h @@ -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; } 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] 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 } #endif diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c index 978edbf0f..22d2b1cba 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_act.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_act.c @@ -663,6 +663,23 @@ void bta_dm_set_dev_name (tBTA_DM_MSG *p_data) #endif /// CLASSIC_BT_INCLUDED } +/******************************************************************************* +** +** 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_config_eir (tBTA_DM_MSG *p_data) { tBTA_DM_API_CONFIG_EIR *config_eir = &p_data->config_eir; diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c index 141d9ce2d..d868f77e6 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_api.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_api.c @@ -225,6 +225,35 @@ void BTA_DmConfigEir(tBTA_DM_EIR_CONF *eir_config) } } +#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 + #if (BLE_INCLUDED == TRUE) void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBLE_ADDR_TYPE addr_type, tBTA_ADD_WHITELIST_CBACK *add_wl_cb) { diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c index aa4b3250d..ec1d3235a 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -57,6 +57,7 @@ const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = { bta_dm_disable, /* BTA_DM_API_DISABLE_EVT */ bta_dm_set_dev_name, /* BTA_DM_API_SET_NAME_EVT */ bta_dm_config_eir, /* BTA_DM_API_CONFIG_EIR_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_acl_change, /* BTA_DM_ACL_CHANGE_EVT */ bta_dm_add_device, /* BTA_DM_API_ADD_DEVICE_EVT */ diff --git a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h index c87708e35..74fe5c586 100644 --- a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h +++ b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h @@ -53,6 +53,7 @@ enum { BTA_DM_API_DISABLE_EVT, BTA_DM_API_SET_NAME_EVT, BTA_DM_API_CONFIG_EIR_EVT, + BTA_DM_API_SET_AFH_CHANNELS_EVT, BTA_DM_API_SET_VISIBILITY_EVT, BTA_DM_ACL_CHANGE_EVT, @@ -205,6 +206,13 @@ typedef struct { UINT8 data[]; }tBTA_DM_API_CONFIG_EIR; +/* 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; + #if (BLE_INCLUDED == TRUE) typedef struct { BT_HDR hdr; @@ -805,6 +813,8 @@ typedef union { tBTA_DM_API_SET_NAME set_name; tBTA_DM_API_CONFIG_EIR config_eir; + tBTA_DM_API_SET_AFH_CHANNELS set_afh_channels; + #if (BLE_INCLUDED == TRUE) tBTA_DM_API_UPDATE_WHITE_LIST white_list; tBTA_DM_API_READ_ADV_TX_POWER read_tx_power; @@ -1262,6 +1272,7 @@ extern void bta_dm_enable (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_config_eir (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_ble_read_adv_tx_power(tBTA_DM_MSG *p_data); extern void bta_dm_ble_read_rssi(tBTA_DM_MSG *p_data); diff --git a/components/bt/host/bluedroid/bta/include/bta/bta_api.h b/components/bt/host/bluedroid/bta/include/bta/bta_api.h index c9349e80e..7f767366a 100644 --- a/components/bt/host/bluedroid/bta/include/bta/bta_api.h +++ b/components/bt/host/bluedroid/bta/include/bta/bta_api.h @@ -433,6 +433,8 @@ typedef tBTM_TX_POWER_RESULTS tBTA_TX_POWER_RESULTS; typedef tBTM_RSSI_RESULTS tBTA_RSSI_RESULTS; +typedef tBTM_SET_AFH_CHANNELS_RESULTS tBTA_SET_AFH_CHANNELS_RESULTS; + /* advertising channel map */ #define BTA_BLE_ADV_CHNL_37 BTM_BLE_ADV_CHNL_37 #define BTA_BLE_ADV_CHNL_38 BTM_BLE_ADV_CHNL_38 @@ -1473,6 +1475,18 @@ extern void BTA_DmSetDeviceName(const char *p_name); *******************************************************************************/ extern void BTA_DmConfigEir(tBTA_DM_EIR_CONF *eir_config); +/******************************************************************************* +** +** 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); + #if (BLE_INCLUDED == TRUE) extern void BTA_DmUpdateWhiteList(BOOLEAN add_remove, BD_ADDR remote_addr, tBLE_ADDR_TYPE addr_type, tBTA_ADD_WHITELIST_CBACK *add_wl_cb); diff --git a/components/bt/host/bluedroid/btc/core/btc_util.c b/components/bt/host/bluedroid/btc/core/btc_util.c index 4174a1152..6e808634b 100644 --- a/components/bt/host/bluedroid/btc/core/btc_util.c +++ b/components/bt/host/bluedroid/btc/core/btc_util.c @@ -225,6 +225,9 @@ esp_bt_status_t btc_btm_status_to_esp_status (uint8_t btm_status) case BTM_NO_RESOURCES: esp_status = ESP_BT_STATUS_NOMEM; break; + case BTM_ILLEGAL_VALUE: + esp_status = ESP_BT_STATUS_PARM_INVALID; + break; case BTM_ERR_PROCESSING: esp_status = ESP_BT_STATUS_PENDING; break; diff --git a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c index af2cfd206..2284338cd 100644 --- a/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c +++ b/components/bt/host/bluedroid/btc/profile/std/gap/btc_gap_bt.c @@ -708,6 +708,31 @@ static void btc_gap_bt_config_eir(btc_gap_bt_args_t *arg) BTA_DmConfigEir(&eir_config); } +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) { switch (msg->act) { @@ -873,6 +898,12 @@ void btc_gap_bt_call_handler(btc_msg_t *msg) btc_gap_bt_config_eir(arg); break; } + + case BTC_GAP_BT_ACT_SET_AFH_CHANNELS: { + btc_gap_bt_set_afh_channels(arg); + break; + } + default: break; } @@ -908,6 +939,7 @@ void btc_gap_bt_cb_deep_free(btc_msg_t *msg) case BTC_GAP_BT_CONFIG_EIR_DATA_EVT: case BTC_GAP_BT_AUTH_CMPL_EVT: case BTC_GAP_BT_PIN_REQ_EVT: + case BTC_GAP_BT_SET_AFH_CHANNELS_EVT: #if (BT_SSP_INCLUDED == TRUE) case BTC_GAP_BT_CFM_REQ_EVT: case BTC_GAP_BT_KEY_NOTIF_EVT: @@ -965,6 +997,10 @@ void btc_gap_bt_cb_handler(btc_msg_t *msg) break; } #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: BTC_TRACE_ERROR("%s: Unhandled event (%d)!\n", __FUNCTION__, msg->act); break; diff --git a/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_bt.h b/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_bt.h index 7214da877..fd38959ec 100644 --- a/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_bt.h +++ b/components/bt/host/bluedroid/btc/profile/std/include/btc_gap_bt.h @@ -34,6 +34,7 @@ typedef enum { BTC_GAP_BT_KEY_REQ_EVT, BTC_GAP_BT_READ_RSSI_DELTA_EVT, BTC_GAP_BT_CONFIG_EIR_DATA_EVT, + BTC_GAP_BT_SET_AFH_CHANNELS_EVT, }btc_gap_bt_evt_t; typedef enum { @@ -51,6 +52,7 @@ typedef enum { BTC_GAP_BT_ACT_PASSKEY_REPLY, BTC_GAP_BT_ACT_CONFIRM_REPLY, BTC_GAP_BT_ACT_CONFIG_EIR, + BTC_GAP_BT_ACT_SET_AFH_CHANNELS, } btc_gap_bt_act_t; /* btc_bt_gap_args_t */ @@ -132,6 +134,11 @@ typedef union { struct config_eir_args { esp_bt_eir_data_t eir_data; } config_eir; + + // 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; void btc_gap_bt_call_handler(btc_msg_t *msg); diff --git a/components/bt/host/bluedroid/stack/btm/btm_devctl.c b/components/bt/host/bluedroid/stack/btm/btm_devctl.c index 437a3cd1a..12e83de90 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_devctl.c +++ b/components/bt/host/bluedroid/stack/btm/btm_devctl.c @@ -1003,4 +1003,75 @@ 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 \ No newline at end of file diff --git a/components/bt/host/bluedroid/stack/btm/include/btm_int.h b/components/bt/host/bluedroid/stack/btm/include/btm_int.h index 4ef728508..81211c382 100644 --- a/components/bt/host/bluedroid/stack/btm/include/btm_int.h +++ b/components/bt/host/bluedroid/stack/btm/include/btm_int.h @@ -163,6 +163,12 @@ tBTM_CMPL_CB *p_switch_role_cb; /* Callback function to be called when TIMER_LIST_ENT tx_power_timer; 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 */ #if BLE_INCLUDED == TRUE @@ -1067,7 +1073,7 @@ void btm_inq_db_reset (void); void btm_vendor_specific_evt (UINT8 *p, UINT8 evt_len); void btm_delete_stored_link_key_complete (UINT8 *p); void btm_report_device_status (tBTM_DEV_STATUS status); - +void btm_set_afh_channels_complete (UINT8 *p); /* Internal functions provided by btm_dev.c ********************************************** diff --git a/components/bt/host/bluedroid/stack/btu/btu_hcif.c b/components/bt/host/bluedroid/stack/btu/btu_hcif.c index de7693ee8..e3402d3d9 100644 --- a/components/bt/host/bluedroid/stack/btu/btu_hcif.c +++ b/components/bt/host/bluedroid/stack/btu/btu_hcif.c @@ -911,6 +911,11 @@ static void btu_hcif_hdl_command_complete (UINT16 opcode, UINT8 *p, UINT16 evt_l case HCI_READ_INQ_TX_POWER_LEVEL: btm_read_linq_tx_power_complete (p); break; +#if (CLASSIC_BT_INCLUDED == TRUE) + case HCI_SET_AFH_CHANNELS: + btm_set_afh_channels_complete(p); + break; +#endif #if (BLE_INCLUDED == TRUE) /* BLE Commands sComplete*/ diff --git a/components/bt/host/bluedroid/stack/hcic/hcicmds.c b/components/bt/host/bluedroid/stack/hcic/hcicmds.c index 69944315e..6e6691624 100644 --- a/components/bt/host/bluedroid/stack/hcic/hcicmds.c +++ b/components/bt/host/bluedroid/stack/hcic/hcicmds.c @@ -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); } + +#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 \ No newline at end of file diff --git a/components/bt/host/bluedroid/stack/include/stack/bt_types.h b/components/bt/host/bluedroid/stack/include/stack/bt_types.h index fb49e18b1..50edb6c12 100644 --- a/components/bt/host/bluedroid/stack/include/stack/bt_types.h +++ b/components/bt/host/bluedroid/stack/include/stack/bt_types.h @@ -354,6 +354,9 @@ typedef UINT8 ACO[ACO_LEN]; /* Authenticated ciphering offset */ #define COF_LEN 12 typedef UINT8 COF[COF_LEN]; /* ciphering offset number */ +#define AFH_CHANNELS_LEN 10 +typedef UINT8 AFH_CHANNELS[AFH_CHANNELS_LEN]; + typedef struct { UINT8 qos_flags; /* TBD */ UINT8 service_type; /* see below */ @@ -687,6 +690,8 @@ typedef void (BT_LOG_FUNC) (int trace_type, const char *fmt_str, ...); typedef uint8_t BD_ADDR[BD_ADDR_LEN]; #endif +/* */ + // From bd.c /***************************************************************************** diff --git a/components/bt/host/bluedroid/stack/include/stack/btm_api.h b/components/bt/host/bluedroid/stack/include/stack/btm_api.h index 641dd93f5..fa2e98189 100644 --- a/components/bt/host/bluedroid/stack/include/stack/btm_api.h +++ b/components/bt/host/bluedroid/stack/include/stack/btm_api.h @@ -798,6 +798,14 @@ typedef struct { BD_ADDR rem_bda; } 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) ** in response to BTM_ReadInquiryRspTxPower call. */ @@ -4098,6 +4106,18 @@ void BTM_PCM2Setup_Write (BOOLEAN clk_master, tBTM_VSC_CMPL_CB *p_arc_cb); *******************************************************************************/ //extern 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 } diff --git a/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h b/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h index 6a86dc624..f5002d967 100644 --- a/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h +++ b/components/bt/host/bluedroid/stack/include/stack/hcimsgs.h @@ -520,6 +520,8 @@ BOOLEAN btsnd_hcic_change_name(BD_NAME name); #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 BOOLEAN btsnd_hcic_write_pin_type(UINT8 type); /* Write PIN Type */