@@ -120,6 +120,27 @@ bool BLEMIDI_ESP32_NimBLE::begin(const char *deviceName, BLEMIDI_Transport<class
120120
121121 BLEDevice::init (deviceName);
122122
123+ /* *
124+ * Set the IO capabilities of the device, each option will trigger a different pairing method.
125+ * BLE_HS_IO_DISPLAY_ONLY - Passkey pairing
126+ * BLE_HS_IO_DISPLAY_YESNO - Numeric comparison pairing
127+ * BLE_HS_IO_NO_INPUT_OUTPUT - DEFAULT setting - just works pairing
128+ */
129+ // NimBLEDevice::setSecurityIOCap(BLE_HS_IO_DISPLAY_ONLY); // use passkey
130+ // NimBLEDevice::setSecurityIOCap(BLE_HS_IO_DISPLAY_YESNO); //use numeric comparison
131+
132+ /* *
133+ * 2 different ways to set security - both calls achieve the same result.
134+ * no bonding, no man in the middle protection, BLE secure connections.
135+ *
136+ * These are the default values, only shown here for demonstration.
137+ */
138+ // NimBLEDevice::setSecurityAuth(false, false, true);
139+
140+ // NimBLEDevice::setSecurityAuth(/*BLE_SM_PAIR_AUTHREQ_BOND | BLE_SM_PAIR_AUTHREQ_MITM |*/ BLE_SM_PAIR_AUTHREQ_SC);
141+
142+ NimBLEDevice::setSecurityAuth (true , false , false );
143+
123144 // To communicate between the 2 cores.
124145 // Core_0 runs here, core_1 runs the BLE stack
125146 mRxQueue = xQueueCreate (64 , sizeof (uint8_t )); // TODO Settings::MaxBufferSize
@@ -141,9 +162,6 @@ bool BLEMIDI_ESP32_NimBLE::begin(const char *deviceName, BLEMIDI_Transport<class
141162
142163 _characteristic->setCallbacks (new MyCharacteristicCallbacks (this ));
143164
144- auto _security = new NimBLESecurity ();
145- _security->setAuthenticationMode (ESP_LE_AUTH_BOND);
146-
147165 // Start the service
148166 service->start ();
149167
0 commit comments