diff --git a/main/include/hal/ble.h b/main/include/hal/ble.h index efc9254..ed7ba07 100644 --- a/main/include/hal/ble.h +++ b/main/include/hal/ble.h @@ -18,7 +18,7 @@ static const char* BLE_TAG = "ble"; -class BluetoothLE : public LifecycleBase, public TouchListener, public NimBLEServerCallbacks, public NimBLESecurityCallbacks { +class BluetoothLE : public LifecycleBase, public TouchListener, public NimBLEServerCallbacks { NimBLEAdvertising *advertising; NimBLEAdvertisementData advertisementData; TaskHandle_t bleTaskHandle; @@ -43,13 +43,7 @@ class BluetoothLE : public LifecycleBase, public TouchListener, public NimBLESer void onConnect(NimBLEServer *server) { } void onConnect(NimBLEServer *server, ble_gap_conn_desc *desc); void onDisconnect(NimBLEServer *server); - - // NimBLESecurityCallbacks - uint32_t onPassKeyRequest() { return 123456; } - void onPassKeyNotify(uint32_t passkey) { ESP_LOGD(BLE_TAG, "Passkey notification: %d", passkey); } - bool onSecurityRequest() { return publicAdvertising; } void onAuthenticationComplete(ble_gap_conn_desc *conn); - bool onConfirmPIN(uint32_t pin) { ESP_LOGD(BLE_TAG, "On confirm PIN called"); return publicAdvertising && pin == NimBLEDevice::getSecurityPasskey(); } // TouchListener void onTouchEvent(std::vector *touches); diff --git a/main/src/hal/ble.cpp b/main/src/hal/ble.cpp index 37b24f7..72d6635 100644 --- a/main/src/hal/ble.cpp +++ b/main/src/hal/ble.cpp @@ -35,7 +35,6 @@ void BluetoothLE::startServer(void *params) { NimBLEDevice::init(""); NimBLEDevice::setSecurityAuth(false, true, true); - NimBLEDevice::setSecurityCallbacks(ble); NimBLEDevice::setSecurityInitKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID); NimBLEDevice::setSecurityRespKey(BLE_SM_PAIR_KEY_DIST_ENC | BLE_SM_PAIR_KEY_DIST_ID); NimBLEDevice::setMTU(512); @@ -58,8 +57,6 @@ NimBLEService* BluetoothLE::createService(std::string uuid) { void BluetoothLE::onAuthenticationComplete(ble_gap_conn_desc *conn) { ESP_LOGD(BLE_TAG, "Authentication Complete - bonded: %s authenticated: %s", conn->sec_state.bonded ? "yes" : "no", conn->sec_state.authenticated ? "yes" : "no"); - if (!conn->sec_state.bonded) - server->disconnect(conn->conn_handle); } void BluetoothLE::startAdvertising() {