Skip to content

Commit fecd97a

Browse files
author
Nishanth Samala
committed
remove deprecated NimBLESecurityCallbacks
1 parent 5ae78ac commit fecd97a

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

main/include/hal/ble.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
static const char* BLE_TAG = "ble";
2020

21-
class BluetoothLE : public LifecycleBase, public TouchListener, public NimBLEServerCallbacks, public NimBLESecurityCallbacks {
21+
class BluetoothLE : public LifecycleBase, public TouchListener, public NimBLEServerCallbacks {
2222
NimBLEAdvertising *advertising;
2323
NimBLEAdvertisementData advertisementData;
2424
TaskHandle_t bleTaskHandle;
@@ -43,13 +43,7 @@ class BluetoothLE : public LifecycleBase, public TouchListener, public NimBLESer
4343
void onConnect(NimBLEServer *server) { }
4444
void onConnect(NimBLEServer *server, ble_gap_conn_desc *desc);
4545
void onDisconnect(NimBLEServer *server);
46-
47-
// NimBLESecurityCallbacks
48-
uint32_t onPassKeyRequest() { return 123456; }
49-
void onPassKeyNotify(uint32_t passkey) { ESP_LOGD(BLE_TAG, "Passkey notification: %d", passkey); }
50-
bool onSecurityRequest() { return publicAdvertising; }
5146
void onAuthenticationComplete(ble_gap_conn_desc *conn);
52-
bool onConfirmPIN(uint32_t pin) { ESP_LOGD(BLE_TAG, "On confirm PIN called"); return publicAdvertising && pin == NimBLEDevice::getSecurityPasskey(); }
5347

5448
// TouchListener
5549
void onTouchEvent(std::vector<TouchType> *touches);

main/src/hal/ble.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ void BluetoothLE::startServer(void *params) {
3535

3636
NimBLEDevice::init("");
3737
NimBLEDevice::setSecurityAuth(false, true, true);
38-
NimBLEDevice::setSecurityCallbacks(ble);
3938
NimBLEDevice::setSecurityInitKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID);
4039
NimBLEDevice::setSecurityRespKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID);
4140
NimBLEDevice::setMTU(512);
@@ -58,8 +57,6 @@ NimBLEService* BluetoothLE::createService(std::string uuid) {
5857

5958
void BluetoothLE::onAuthenticationComplete(ble_gap_conn_desc *conn) {
6059
ESP_LOGD(BLE_TAG, "Authentication Complete - bonded: %s authenticated: %s", conn->sec_state.bonded ? "yes" : "no", conn->sec_state.authenticated ? "yes" : "no");
61-
if (!conn->sec_state.bonded)
62-
server->disconnect(conn->conn_handle);
6360
}
6461

6562
void BluetoothLE::startAdvertising() {

0 commit comments

Comments
 (0)