Skip to content

Commit d2d6331

Browse files
committed
Renamed SerialToSerialBT_SSP_pairing
1 parent 7568c69 commit d2d6331

File tree

6 files changed

+12
-7
lines changed

6 files changed

+12
-7
lines changed
Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
//This example code is in the Public Domain (or CC0 licensed, at your option.)
2-
//By Richard Li - 2020
1+
// This example code is in the Public Domain (or CC0 licensed, at your option.)
2+
// By Richard Li - 2020
33
//
4-
//This example creates a bridge between Serial and Classical Bluetooth (SPP with authentication)
5-
//and also demonstrate that SerialBT have the same functionalities of a normal Serial
4+
// This example creates a bridge between Serial and Classical Bluetooth (SPP with authentication)
5+
// and also demonstrate that SerialBT have the same functionalities of a normal Serial
6+
// SSP - Simple Secure Pairing - The device (ESP32) will display random number and the user is responsible of comparing it to the number
7+
// displayed on the other device (for example phone).
8+
// If the numbers match the user authenticates the pairing.
69

710
#include "BluetoothSerial.h"
811

@@ -14,13 +17,15 @@
1417
#error Serial Bluetooth not available or not enabled. It is only available for the ESP32 chip.
1518
#endif
1619

20+
const char * deviceName = "ESP32_SSP_example";
21+
1722
BluetoothSerial SerialBT;
1823
boolean confirmRequestPending = true;
1924

2025
void BTConfirmRequestCallback(uint32_t numVal)
2126
{
2227
confirmRequestPending = true;
23-
Serial.println(numVal);
28+
Serial.printf("The PIN is: %lu\n", numVal);
2429
}
2530

2631
void BTAuthCompleteCallback(boolean success)
@@ -43,8 +48,8 @@ void setup()
4348
SerialBT.enableSSP();
4449
SerialBT.onConfirmRequest(BTConfirmRequestCallback);
4550
SerialBT.onAuthComplete(BTAuthCompleteCallback);
46-
SerialBT.begin("ESP32test"); //Bluetooth device name
47-
Serial.println("The device started, now you can pair it with bluetooth!");
51+
SerialBT.begin(deviceName); //Bluetooth device name
52+
Serial.printf("The device started with name \"%s\", now you can pair it with Bluetooth!\n", deviceName);
4853
}
4954

5055
void loop()

0 commit comments

Comments
 (0)