Skip to content

Commit

Permalink
fixed build errors with Secure Simple Paring disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
BetterJincheng committed Nov 23, 2022
1 parent 2302651 commit 11ab440
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/bluetooth/esp_hid_device/main/esp_hid_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,12 @@ static void bt_gap_event_handler(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_para
static esp_err_t init_bt_gap(void)
{
esp_err_t ret;
#if (CONFIG_BT_SSP_ENABLED)
/* Set default parameters for Secure Simple Pairing */
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
esp_bt_io_cap_t iocap = ESP_BT_IO_CAP_NONE;
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
#endif
/*
* Set default parameters for Legacy Pairing
* Use fixed pin code
Expand Down
10 changes: 10 additions & 0 deletions examples/bluetooth/esp_hid_host/main/esp_hid_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,16 @@ static void bt_gap_event_handler(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_para
handle_bt_device_result(&param->disc_res);
break;
}
#if (CONFIG_BT_SSP_ENABLED)
case ESP_BT_GAP_KEY_NOTIF_EVT:
ESP_LOGI(TAG, "BT GAP KEY_NOTIF passkey:%d", param->key_notif.passkey);
break;
case ESP_BT_GAP_CFM_REQ_EVT: {
ESP_LOGI(TAG, "ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d", param->cfm_req.num_val);
esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, true);
break;
}
#endif
case ESP_BT_GAP_MODE_CHG_EVT:
ESP_LOGI(TAG, "BT GAP MODE_CHG_EVT mode:%d", param->mode_chg.mode);
break;
Expand All @@ -421,9 +428,12 @@ static void bt_gap_event_handler(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_para
static esp_err_t init_bt_gap(void)
{
esp_err_t ret;
#if (CONFIG_BT_SSP_ENABLED)
/* Set default parameters for Secure Simple Pairing */
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
Expand Down

0 comments on commit 11ab440

Please sign in to comment.