forked from espressif/esp-idf
Merge branch 'bugfix/btdm_configure_ssp_in_menuconfig' into 'master'
components/bt: Configure SSP in menuconfig and fix two bugs See merge request idf/esp-idf!3892
This commit is contained in:
@@ -351,6 +351,13 @@ config HFP_AUDIO_DATA_PATH_HCI
|
|||||||
This enables the Serial Port Profile
|
This enables the Serial Port Profile
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
config BT_SSP_ENABLED
|
||||||
|
bool "Secure Simple Pairing"
|
||||||
|
depends on CLASSIC_BT_ENABLED
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
This enables the Secure Simple Pairing. If disable this option, Bluedroid will only support Legacy Pairing
|
||||||
|
|
||||||
config GATTS_ENABLE
|
config GATTS_ENABLE
|
||||||
bool "Include GATT server module(GATTS)"
|
bool "Include GATT server module(GATTS)"
|
||||||
depends on BLUEDROID_ENABLED && (BTDM_CONTROLLER_MODE_BTDM || BTDM_CONTROLLER_MODE_BLE_ONLY)
|
depends on BLUEDROID_ENABLED && (BTDM_CONTROLLER_MODE_BTDM || BTDM_CONTROLLER_MODE_BLE_ONLY)
|
||||||
|
@@ -2681,9 +2681,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (BT_SSP_INCLUDED == TRUE)
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
** Function bta_dm_pinname_cback
|
** Function bta_dm_pinname_cback
|
||||||
@@ -2740,6 +2738,7 @@ static UINT8 bta_dm_authorize_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NA
|
|||||||
bta_dm_cb.p_sec_cback(event, &sec_event);
|
bta_dm_cb.p_sec_cback(event, &sec_event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif /// BT_SSP_INCLUDED == TRUE
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
**
|
**
|
||||||
@@ -2759,18 +2758,6 @@ static UINT8 bta_dm_pin_cback (BD_ADDR bd_addr, DEV_CLASS dev_class, BD_NAME bd_
|
|||||||
return BTM_NOT_AUTHORIZED;
|
return BTM_NOT_AUTHORIZED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the device name is not known, save bdaddr and devclass and initiate a name request */
|
|
||||||
if (bd_name[0] == 0) {
|
|
||||||
bta_dm_cb.pin_evt = BTA_DM_PIN_REQ_EVT;
|
|
||||||
bdcpy(bta_dm_cb.pin_bd_addr, bd_addr);
|
|
||||||
BTA_COPY_DEVICE_CLASS(bta_dm_cb.pin_dev_class, dev_class);
|
|
||||||
if ((BTM_ReadRemoteDeviceName(bd_addr, bta_dm_pinname_cback, BT_TRANSPORT_BR_EDR)) == BTM_CMD_STARTED) {
|
|
||||||
return BTM_CMD_STARTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
APPL_TRACE_WARNING(" bta_dm_pin_cback() -> Failed to start Remote Name Request ");
|
|
||||||
}
|
|
||||||
|
|
||||||
bdcpy(sec_event.pin_req.bd_addr, bd_addr);
|
bdcpy(sec_event.pin_req.bd_addr, bd_addr);
|
||||||
BTA_COPY_DEVICE_CLASS(sec_event.pin_req.dev_class, dev_class);
|
BTA_COPY_DEVICE_CLASS(sec_event.pin_req.dev_class, dev_class);
|
||||||
BCM_STRNCPY_S((char *)sec_event.pin_req.bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
|
BCM_STRNCPY_S((char *)sec_event.pin_req.bd_name, sizeof(BD_NAME), (char *)bd_name, (BD_NAME_LEN - 1));
|
||||||
|
@@ -750,7 +750,7 @@ void btc_gap_bt_arg_deep_free(btc_msg_t *msg)
|
|||||||
break;
|
break;
|
||||||
#endif ///BT_SSP_INCLUDED == TRUE
|
#endif ///BT_SSP_INCLUDED == TRUE
|
||||||
default:
|
default:
|
||||||
BTC_TRACE_ERROR("Unhandled deep copy %d\n", msg->act);
|
BTC_TRACE_ERROR("Unhandled deep copy %d, arg: %p\n", msg->act, arg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -52,7 +52,6 @@
|
|||||||
#define BTA_SDP_INCLUDED TRUE
|
#define BTA_SDP_INCLUDED TRUE
|
||||||
#define BTA_DM_PM_INCLUDED TRUE
|
#define BTA_DM_PM_INCLUDED TRUE
|
||||||
#define SDP_INCLUDED TRUE
|
#define SDP_INCLUDED TRUE
|
||||||
#define BT_SSP_INCLUDED TRUE
|
|
||||||
|
|
||||||
#if CONFIG_A2DP_ENABLE
|
#if CONFIG_A2DP_ENABLE
|
||||||
#define BTA_AR_INCLUDED TRUE
|
#define BTA_AR_INCLUDED TRUE
|
||||||
@@ -89,6 +88,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif /* CONFIG_HFP_HF_ENABLE */
|
#endif /* CONFIG_HFP_HF_ENABLE */
|
||||||
|
|
||||||
|
#if CONFIG_BT_SSP_ENABLED
|
||||||
|
#define BT_SSP_INCLUDED TRUE
|
||||||
|
#endif /* CONFIG_BT_SSP_ENABLED */
|
||||||
|
|
||||||
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
|
#endif /* #if CONFIG_CLASSIC_BT_ENABLED */
|
||||||
|
|
||||||
#ifndef CLASSIC_BT_INCLUDED
|
#ifndef CLASSIC_BT_INCLUDED
|
||||||
|
@@ -149,7 +149,11 @@ static void start_up(void)
|
|||||||
// it told us it supports. We need to do this first before we request the
|
// it told us it supports. We need to do this first before we request the
|
||||||
// next page, because the controller's response for page 1 may be
|
// next page, because the controller's response for page 1 may be
|
||||||
// dependent on what we configure from page 0
|
// dependent on what we configure from page 0
|
||||||
|
#if (BT_SSP_INCLUDED == TRUE)
|
||||||
simple_pairing_supported = HCI_SIMPLE_PAIRING_SUPPORTED(features_classic[0].as_array);
|
simple_pairing_supported = HCI_SIMPLE_PAIRING_SUPPORTED(features_classic[0].as_array);
|
||||||
|
#else
|
||||||
|
simple_pairing_supported = false;
|
||||||
|
#endif
|
||||||
if (simple_pairing_supported) {
|
if (simple_pairing_supported) {
|
||||||
response = AWAIT_COMMAND(packet_factory->make_write_simple_pairing_mode(HCI_SP_MODE_ENABLED));
|
response = AWAIT_COMMAND(packet_factory->make_write_simple_pairing_mode(HCI_SP_MODE_ENABLED));
|
||||||
packet_parser->parse_generic_command_complete(response);
|
packet_parser->parse_generic_command_complete(response);
|
||||||
@@ -250,10 +254,10 @@ static void start_up(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (simple_pairing_supported) {
|
|
||||||
response = AWAIT_COMMAND(packet_factory->make_set_event_mask(&CLASSIC_EVENT_MASK));
|
response = AWAIT_COMMAND(packet_factory->make_set_event_mask(&CLASSIC_EVENT_MASK));
|
||||||
packet_parser->parse_generic_command_complete(response);
|
packet_parser->parse_generic_command_complete(response);
|
||||||
}
|
|
||||||
|
|
||||||
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
#if (BTM_SCO_HCI_INCLUDED == TRUE)
|
||||||
response = AWAIT_COMMAND(packet_factory->make_write_sync_flow_control_enable(1));
|
response = AWAIT_COMMAND(packet_factory->make_write_sync_flow_control_enable(1));
|
||||||
|
@@ -5030,14 +5030,7 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
|
|||||||
memcpy (p_cb->connecting_bda, p_bda, BD_ADDR_LEN);
|
memcpy (p_cb->connecting_bda, p_bda, BD_ADDR_LEN);
|
||||||
memcpy (p_cb->connecting_dc, p_dev_rec->dev_class, DEV_CLASS_LEN);
|
memcpy (p_cb->connecting_dc, p_dev_rec->dev_class, DEV_CLASS_LEN);
|
||||||
|
|
||||||
/* Check if the name is known */
|
|
||||||
/* Even if name is not known we might not be able to get one */
|
|
||||||
/* this is the case when we are already getting something from the */
|
|
||||||
/* device, so HCI level is flow controlled */
|
|
||||||
/* Also cannot send remote name request while paging, i.e. connection is not completed */
|
|
||||||
if (p_dev_rec->sec_flags & BTM_SEC_NAME_KNOWN) {
|
|
||||||
BTM_TRACE_EVENT ("btm_sec_pin_code_request going for callback\n");
|
BTM_TRACE_EVENT ("btm_sec_pin_code_request going for callback\n");
|
||||||
|
|
||||||
btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
|
btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
|
||||||
if (p_cb->api.p_pin_callback) {
|
if (p_cb->api.p_pin_callback) {
|
||||||
(*p_cb->api.p_pin_callback) (p_bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name,
|
(*p_cb->api.p_pin_callback) (p_bda, p_dev_rec->dev_class, p_dev_rec->sec_bd_name,
|
||||||
@@ -5045,28 +5038,6 @@ void btm_sec_pin_code_request (UINT8 *p_bda)
|
|||||||
: (p_dev_rec->p_cur_service->security_flags
|
: (p_dev_rec->p_cur_service->security_flags
|
||||||
& BTM_SEC_IN_MIN_16_DIGIT_PIN));
|
& BTM_SEC_IN_MIN_16_DIGIT_PIN));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
BTM_TRACE_EVENT ("btm_sec_pin_code_request going for remote name\n");
|
|
||||||
|
|
||||||
/* We received PIN code request for the device with unknown name */
|
|
||||||
/* it is not user friendly just to ask for the PIN without name */
|
|
||||||
/* try to get name at first */
|
|
||||||
if (!btsnd_hcic_rmt_name_req (p_dev_rec->bd_addr,
|
|
||||||
HCI_PAGE_SCAN_REP_MODE_R1,
|
|
||||||
HCI_MANDATARY_PAGE_SCAN_MODE, 0)) {
|
|
||||||
p_dev_rec->sec_flags |= BTM_SEC_NAME_KNOWN;
|
|
||||||
p_dev_rec->sec_bd_name[0] = 'f';
|
|
||||||
p_dev_rec->sec_bd_name[1] = '0';
|
|
||||||
BTM_TRACE_ERROR ("can not send rmt_name_req?? fake a name and call callback\n");
|
|
||||||
|
|
||||||
btm_cb.pairing_flags |= BTM_PAIR_FLAGS_PIN_REQD;
|
|
||||||
if (p_cb->api.p_pin_callback)
|
|
||||||
(*p_cb->api.p_pin_callback) (p_bda, p_dev_rec->dev_class,
|
|
||||||
p_dev_rec->sec_bd_name, (p_dev_rec->p_cur_service == NULL) ? FALSE
|
|
||||||
: (p_dev_rec->p_cur_service->security_flags
|
|
||||||
& BTM_SEC_IN_MIN_16_DIGIT_PIN));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -114,10 +114,12 @@ void app_main()
|
|||||||
/* Bluetooth device name, connection mode and profile set up */
|
/* Bluetooth device name, connection mode and profile set up */
|
||||||
bt_app_work_dispatch(bt_av_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL);
|
bt_app_work_dispatch(bt_av_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL);
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
/* Set default parameters for Secure Simple Pairing */
|
/* Set default parameters for Secure Simple Pairing */
|
||||||
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
|
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_io_cap_t iocap = ESP_BT_IO_CAP_IO;
|
||||||
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set default parameters for Legacy Pairing
|
* Set default parameters for Legacy Pairing
|
||||||
@@ -144,6 +146,8 @@ void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
case ESP_BT_GAP_CFM_REQ_EVT:
|
case ESP_BT_GAP_CFM_REQ_EVT:
|
||||||
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d", param->cfm_req.num_val);
|
ESP_LOGI(BT_AV_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);
|
esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, true);
|
||||||
@@ -154,6 +158,8 @@ void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
|||||||
case ESP_BT_GAP_KEY_REQ_EVT:
|
case ESP_BT_GAP_KEY_REQ_EVT:
|
||||||
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
ESP_LOGI(BT_AV_TAG, "event: %d", event);
|
ESP_LOGI(BT_AV_TAG, "event: %d", event);
|
||||||
break;
|
break;
|
||||||
|
@@ -136,10 +136,12 @@ void app_main()
|
|||||||
/* Bluetooth device name, connection mode and profile set up */
|
/* Bluetooth device name, connection mode and profile set up */
|
||||||
bt_app_work_dispatch(bt_av_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL);
|
bt_app_work_dispatch(bt_av_hdl_stack_evt, BT_APP_EVT_STACK_UP, NULL, 0, NULL);
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
/* Set default parameters for Secure Simple Pairing */
|
/* Set default parameters for Secure Simple Pairing */
|
||||||
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
|
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_io_cap_t iocap = ESP_BT_IO_CAP_IO;
|
||||||
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set default parameters for Legacy Pairing
|
* Set default parameters for Legacy Pairing
|
||||||
@@ -286,6 +288,8 @@ void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
case ESP_BT_GAP_CFM_REQ_EVT:
|
case ESP_BT_GAP_CFM_REQ_EVT:
|
||||||
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d", param->cfm_req.num_val);
|
ESP_LOGI(BT_AV_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);
|
esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, true);
|
||||||
@@ -296,6 +300,8 @@ void bt_app_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
|||||||
case ESP_BT_GAP_KEY_REQ_EVT:
|
case ESP_BT_GAP_KEY_REQ_EVT:
|
||||||
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
ESP_LOGI(BT_AV_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
ESP_LOGI(BT_AV_TAG, "event: %d", event);
|
ESP_LOGI(BT_AV_TAG, "event: %d", event);
|
||||||
break;
|
break;
|
||||||
|
@@ -132,6 +132,8 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
case ESP_BT_GAP_CFM_REQ_EVT:
|
case ESP_BT_GAP_CFM_REQ_EVT:
|
||||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d", param->cfm_req.num_val);
|
ESP_LOGI(SPP_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);
|
esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, true);
|
||||||
@@ -142,6 +144,8 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
|||||||
case ESP_BT_GAP_KEY_REQ_EVT:
|
case ESP_BT_GAP_KEY_REQ_EVT:
|
||||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
ESP_LOGI(SPP_TAG, "event: %d", event);
|
ESP_LOGI(SPP_TAG, "event: %d", event);
|
||||||
break;
|
break;
|
||||||
@@ -197,10 +201,12 @@ void app_main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
/* Set default parameters for Secure Simple Pairing */
|
/* Set default parameters for Secure Simple Pairing */
|
||||||
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
|
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_io_cap_t iocap = ESP_BT_IO_CAP_IO;
|
||||||
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set default parameters for Legacy Pairing
|
* Set default parameters for Legacy Pairing
|
||||||
|
@@ -216,6 +216,8 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
case ESP_BT_GAP_CFM_REQ_EVT:
|
case ESP_BT_GAP_CFM_REQ_EVT:
|
||||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d", param->cfm_req.num_val);
|
ESP_LOGI(SPP_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);
|
esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, true);
|
||||||
@@ -226,6 +228,8 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
|||||||
case ESP_BT_GAP_KEY_REQ_EVT:
|
case ESP_BT_GAP_KEY_REQ_EVT:
|
||||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -282,10 +286,12 @@ void app_main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
/* Set default parameters for Secure Simple Pairing */
|
/* Set default parameters for Secure Simple Pairing */
|
||||||
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
|
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_io_cap_t iocap = ESP_BT_IO_CAP_IO;
|
||||||
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set default parameters for Legacy Pairing
|
* Set default parameters for Legacy Pairing
|
||||||
|
@@ -137,6 +137,8 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
case ESP_BT_GAP_CFM_REQ_EVT:
|
case ESP_BT_GAP_CFM_REQ_EVT:
|
||||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d", param->cfm_req.num_val);
|
ESP_LOGI(SPP_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);
|
esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, true);
|
||||||
@@ -147,6 +149,8 @@ void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *param)
|
|||||||
case ESP_BT_GAP_KEY_REQ_EVT:
|
case ESP_BT_GAP_KEY_REQ_EVT:
|
||||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
ESP_LOGI(SPP_TAG, "event: %d", event);
|
ESP_LOGI(SPP_TAG, "event: %d", event);
|
||||||
break;
|
break;
|
||||||
@@ -204,10 +208,12 @@ void app_main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
/* Set default parameters for Secure Simple Pairing */
|
/* Set default parameters for Secure Simple Pairing */
|
||||||
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
|
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_io_cap_t iocap = ESP_BT_IO_CAP_IO;
|
||||||
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set default parameters for Legacy Pairing
|
* Set default parameters for Legacy Pairing
|
||||||
|
@@ -199,6 +199,8 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
case ESP_BT_GAP_CFM_REQ_EVT:
|
case ESP_BT_GAP_CFM_REQ_EVT:
|
||||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d", param->cfm_req.num_val);
|
ESP_LOGI(SPP_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);
|
esp_bt_gap_ssp_confirm_reply(param->cfm_req.bda, true);
|
||||||
@@ -209,6 +211,8 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
|
|||||||
case ESP_BT_GAP_KEY_REQ_EVT:
|
case ESP_BT_GAP_KEY_REQ_EVT:
|
||||||
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
ESP_LOGI(SPP_TAG, "ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -271,10 +275,12 @@ void app_main()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (CONFIG_BT_SSP_ENABLED == true)
|
||||||
/* Set default parameters for Secure Simple Pairing */
|
/* Set default parameters for Secure Simple Pairing */
|
||||||
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
|
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_io_cap_t iocap = ESP_BT_IO_CAP_IO;
|
||||||
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
esp_bt_gap_set_security_param(param_type, &iocap, sizeof(uint8_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set default parameters for Legacy Pairing
|
* Set default parameters for Legacy Pairing
|
||||||
|
Reference in New Issue
Block a user