From ef8c854e72623da809001b6aa1edfb7c5f0be379 Mon Sep 17 00:00:00 2001
From: Rodrigo Garcia <rodrigo.garcia@espressif.com>
Date: Sun, 20 Mar 2022 18:32:38 -0300
Subject: [PATCH] Warns about SSP only available for ESP32

---
 .../examples/SerialToSerialBT/SerialToSerialBT.ino            | 4 ++++
 .../examples/SerialToSerialBTM/SerialToSerialBTM.ino          | 4 ++++
 .../SerialToSerialBT_SSP_pairing.ino                          | 4 ++++
 .../bt_classic_device_discovery.ino                           | 4 ++++
 .../bt_remove_paired_devices/bt_remove_paired_devices.ino     | 4 ++++
 libraries/README.md                                           | 4 +++-
 6 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino b/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino
index d779c6d349e..86cbe168a14 100644
--- a/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino
+++ b/libraries/BluetoothSerial/examples/SerialToSerialBT/SerialToSerialBT.ino
@@ -10,6 +10,10 @@
 #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
 #endif
 
+#if !defined(CONFIG_BT_SPP_ENABLED)
+#error Serial Bluetooth not available or not enabled. It is only available for the ESP32 chip.
+#endif
+
 BluetoothSerial SerialBT;
 
 void setup() {
diff --git a/libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino b/libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino
index 3d17fb9005a..fc650059fb7 100644
--- a/libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino
+++ b/libraries/BluetoothSerial/examples/SerialToSerialBTM/SerialToSerialBTM.ino
@@ -8,6 +8,10 @@
 
 #include "BluetoothSerial.h"
 
+#if !defined(CONFIG_BT_SPP_ENABLED)
+#error Serial Bluetooth not available or not enabled. It is only available for the ESP32 chip.
+#endif
+
 BluetoothSerial SerialBT;
 
 String MACadd = "AA:BB:CC:11:22:33";
diff --git a/libraries/BluetoothSerial/examples/SerialToSerialBT_SSP_pairing/SerialToSerialBT_SSP_pairing.ino b/libraries/BluetoothSerial/examples/SerialToSerialBT_SSP_pairing/SerialToSerialBT_SSP_pairing.ino
index 8791b6c7a02..c440545fcf3 100644
--- a/libraries/BluetoothSerial/examples/SerialToSerialBT_SSP_pairing/SerialToSerialBT_SSP_pairing.ino
+++ b/libraries/BluetoothSerial/examples/SerialToSerialBT_SSP_pairing/SerialToSerialBT_SSP_pairing.ino
@@ -10,6 +10,10 @@
 #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
 #endif
 
+#if !defined(CONFIG_BT_SPP_ENABLED)
+#error Serial Bluetooth not available or not enabled. It is only available for the ESP32 chip.
+#endif
+
 BluetoothSerial SerialBT;
 boolean confirmRequestPending = true;
 
diff --git a/libraries/BluetoothSerial/examples/bt_classic_device_discovery/bt_classic_device_discovery.ino b/libraries/BluetoothSerial/examples/bt_classic_device_discovery/bt_classic_device_discovery.ino
index b3ec78ccf2a..8d44f262174 100644
--- a/libraries/BluetoothSerial/examples/bt_classic_device_discovery/bt_classic_device_discovery.ino
+++ b/libraries/BluetoothSerial/examples/bt_classic_device_discovery/bt_classic_device_discovery.ino
@@ -4,6 +4,10 @@
 #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
 #endif
 
+#if !defined(CONFIG_BT_SPP_ENABLED)
+#error Serial Bluetooth not available or not enabled. It is only available for the ESP32 chip.
+#endif
+
 BluetoothSerial SerialBT;
 
 
diff --git a/libraries/BluetoothSerial/examples/bt_remove_paired_devices/bt_remove_paired_devices.ino b/libraries/BluetoothSerial/examples/bt_remove_paired_devices/bt_remove_paired_devices.ino
index c316a73b2bc..0d49fe46414 100755
--- a/libraries/BluetoothSerial/examples/bt_remove_paired_devices/bt_remove_paired_devices.ino
+++ b/libraries/BluetoothSerial/examples/bt_remove_paired_devices/bt_remove_paired_devices.ino
@@ -15,6 +15,10 @@
 #include"esp_gap_bt_api.h"
 #include "esp_err.h"
 
+#if !defined(CONFIG_BT_SPP_ENABLED)
+#error Serial Bluetooth not available or not enabled. It is only available for the ESP32 chip.
+#endif
+
 #define REMOVE_BONDED_DEVICES 0   // <- Set to 0 to view all bonded devices addresses, set to 1 to remove
 
 #define PAIR_MAX_DEVICES 20
diff --git a/libraries/README.md b/libraries/README.md
index e7c77efbad5..5edeebba424 100644
--- a/libraries/README.md
+++ b/libraries/README.md
@@ -12,7 +12,9 @@ arduino-esp32 includes libraries for Arduino compatibility along with some objec
   Bluetooth Low Energy v4.2 client/server framework
 
 ### BluetoothSerial
-  Serial to Bluetooth redirection server
+  Serial to Bluetooth redirection server\
+  Note: This library depends on Bluetooth Classic which is only available for ESP32\
+  (Bluetoothserial is **not available** for ESP32-S2, ESP32-C3, ESP32-S3).
 
 ### DNSServer
   A basic UDP DNS daemon (includes captive portal demo)