Closed boernsen-development closed 1 year ago
@boernsen-development
static esp_err_t init_bt_gap(void)
{
esp_err_t ret;
#if (CONFIG_BT_SSP_ENABLED == true)
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
esp_bt_io_cap_t iocap = ESP_BT_IO_CAP_IO;
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
#endif
/*
* Set default parameters for Legacy Pairing
* Use fixed pin code
*/
esp_bt_pin_type_t pin_type = ESP_BT_PIN_TYPE_VARIABLE;
esp_bt_pin_code_t pin_code;
esp_bt_gap_set_pin(pin_type, 0, pin_code);
if ((ret = esp_bt_gap_register_callback(bt_gap_event_handler)) != ESP_OK) {
ESP_LOGE(TAG, "esp_bt_gap_register_callback failed: %d", ret);
return ret;
}
// Allow BT devices to connect back to us
if ((ret = esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_NON_DISCOVERABLE)) != ESP_OK) {
ESP_LOGE(TAG, "esp_bt_gap_set_scan_mode failed: %d", ret);
return ret;
}
return ret;
}
This can help.
@BetterJincheng That worked, thanks a lot!
Answers checklist.
IDF version.
v5.1-dev-1496-gbd18096cb4
Operating System used.
Linux
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
No response
What is the expected behavior?
I expected the esp_hid_host example to build successfully when CONFIG_BT_SSP_ENABLED=n.
What is the actual behavior?
The esp_hid_host example has build errors when CONFIG_BT_SSP_ENABLED=n.
Steps to reproduce.
Build or installation Logs.
More Information.
No response