@@ -71,11 +71,9 @@ static esp_bd_addr_t _peer_bd_addr;
71
71
static char _remote_name[ESP_BT_GAP_MAX_BDNAME_LEN + 1 ];
72
72
static bool _isRemoteAddressSet;
73
73
static bool _isMaster;
74
- #ifdef CONFIG_BT_SSP_ENABLED
75
74
static bool _enableSSP;
76
75
static bool _IO_CAP_INPUT;
77
76
static bool _IO_CAP_OUTPUT;
78
- #endif
79
77
esp_bt_pin_code_t _pin_code = {0 };
80
78
uint8_t _pin_code_len = 0 ; // Number of valid Bytes in the esp_bt_pin_code_t array
81
79
static esp_spp_sec_t _sec_mask;
@@ -538,7 +536,6 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
538
536
esp_bt_gap_pin_reply (param->pin_req .bda , true , _pin_code_len, _pin_code);
539
537
}
540
538
break ;
541
- #ifdef CONFIG_BT_SSP_ENABLED
542
539
case ESP_BT_GAP_CFM_REQ_EVT: // Enum 6 - Security Simple Pairing User Confirmation request.
543
540
log_i (" ESP_BT_GAP_CFM_REQ_EVT Please compare the numeric value: %d" , param->cfm_req .num_val );
544
541
if (confirm_request_callback) {
@@ -549,13 +546,10 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
549
546
esp_bt_gap_ssp_confirm_reply (param->cfm_req .bda , false );
550
547
}
551
548
break ;
552
- #endif
553
549
554
550
case ESP_BT_GAP_KEY_NOTIF_EVT: // Enum 7 - Security Simple Pairing Passkey Notification
555
551
log_i (" ESP_BT_GAP_KEY_NOTIF_EVT passkey:%d" , param->key_notif .passkey );
556
552
break ;
557
-
558
- #ifdef CONFIG_BT_SSP_ENABLED
559
553
case ESP_BT_GAP_KEY_REQ_EVT: // Enum 8 - Security Simple Pairing Passkey request
560
554
log_i (" ESP_BT_GAP_KEY_REQ_EVT Please enter passkey!" );
561
555
if (key_request_callback) {
@@ -566,7 +560,6 @@ static void esp_bt_gap_cb(esp_bt_gap_cb_event_t event, esp_bt_gap_cb_param_t *pa
566
560
esp_bt_gap_ssp_confirm_reply (param->cfm_req .bda , false );
567
561
}
568
562
break ;
569
- #endif
570
563
571
564
case ESP_BT_GAP_READ_RSSI_DELTA_EVT: // Enum 9 - Read rssi event
572
565
log_i (" ESP_BT_GAP_READ_RSSI_DELTA_EVT Read rssi event" );
@@ -707,7 +700,6 @@ static bool _init_bt(const char *deviceName, bt_mode mode) {
707
700
log_i (" device name set" );
708
701
esp_bt_dev_set_device_name (deviceName);
709
702
710
- #ifdef CONFIG_BT_SSP_ENABLED
711
703
if (_enableSSP) {
712
704
log_i (" Simple Secure Pairing" );
713
705
esp_bt_sp_param_t param_type = ESP_BT_SP_IOCAP_MODE;
@@ -723,7 +715,6 @@ static bool _init_bt(const char *deviceName, bt_mode mode) {
723
715
}
724
716
esp_bt_gap_set_security_param (param_type, &iocap, sizeof (uint8_t ));
725
717
}
726
- #endif
727
718
728
719
// the default BTA_DM_COD_LOUDSPEAKER does not work with the macOS BT stack
729
720
esp_bt_cod_t cod;
@@ -894,7 +885,6 @@ void BluetoothSerial::memrelease() {
894
885
esp_bt_mem_release (ESP_BT_MODE_BTDM);
895
886
}
896
887
897
- #ifdef CONFIG_BT_SSP_ENABLED
898
888
void BluetoothSerial::onConfirmRequest (ConfirmRequestCb cb) {
899
889
confirm_request_callback = cb;
900
890
}
@@ -906,7 +896,6 @@ void BluetoothSerial::onKeyRequest(KeyRequestCb cb) {
906
896
void BluetoothSerial::respondPasskey (uint32_t passkey) {
907
897
esp_bt_gap_ssp_passkey_reply (current_bd_addr, true , passkey);
908
898
}
909
- #endif
910
899
911
900
void BluetoothSerial::onAuthComplete (AuthCompleteCb cb) {
912
901
auth_complete_callback = cb;
@@ -921,7 +910,6 @@ esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t callback) {
921
910
return ESP_OK;
922
911
}
923
912
924
- #ifdef CONFIG_BT_SSP_ENABLED
925
913
// Enable Simple Secure Pairing (using generated PIN)
926
914
// This must be called before calling begin, otherwise has no effect!
927
915
void BluetoothSerial::enableSSP () {
@@ -957,8 +945,6 @@ void BluetoothSerial::disableSSP() {
957
945
_enableSSP = false ;
958
946
}
959
947
960
- #else
961
-
962
948
bool BluetoothSerial::setPin (const char *pin, uint8_t pin_code_len) {
963
949
if (pin_code_len == 0 || pin_code_len > 16 ) {
964
950
log_e (" PIN code must be 1-16 Bytes long! Called with length %d" , pin_code_len);
@@ -968,7 +954,6 @@ bool BluetoothSerial::setPin(const char *pin, uint8_t pin_code_len) {
968
954
memcpy (_pin_code, pin, pin_code_len);
969
955
return (esp_bt_gap_set_pin (ESP_BT_PIN_TYPE_FIXED, _pin_code_len, _pin_code) == ESP_OK);
970
956
}
971
- #endif
972
957
973
958
bool BluetoothSerial::connect (String remoteName) {
974
959
bool retval = false ;
0 commit comments