mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2026-01-29 09:40:10 +01:00
[BREAKING] Refactor NimBLEDevice
* General code cleanup
* `NimBLEDevice::getInitialized` renamed to `NimBLEDevice::isInitialized`.
* `NimBLEDevice::setPower` no longer takes the `esp_power_level_t` and `esp_ble_power_type_t`, instead only an integer value in dbm units is accepted.
* `NimBLEDevice::setPower` now returns a bool value, true = success.
* `NimBLEDevice::setMTU` now returns a bool value, true = success.
* `NimBLEDevice::injectConfirmPIN` renamed to `NimBLEDevice::injectConfirmPasskey` to use Bluetooth naming.
* Fixes crash if `NimBLEDevice::deinit` is called when the stack has not been initialized.
* Reverts 73f0277 as it would cause a crash when the NimBLEServer instance has a connection.
* `NimBLEDevice::getAddress` will now return the address currently in use.
* `NimBLEDevice::init` now returns a bool with `true` indicating success.
* `NimBLEDevice::deinit` now returns a bool with `true` inidicating success.
* `NimBLEDevice::setDeviceName` now returns a bool with `true` indicating success.
* `NimBLEDevice::setCustomGapHandler` now returns a bool with `true` indicating success.
* `NimBLEDevice::setOwnAddrType` now returns a bool with `true` indicating success.
* `NimBLEDevice::setOwnAddrType` will now correctly apply the provided address type for all devices.
* `NimBLEDevice::setOwnAddrType` no longer takes a `bool nrpa` parameter.
This commit is contained in:
@@ -62,7 +62,7 @@ class MyClientCallback : public BLEClientCallbacks {
|
||||
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
|
||||
/** Inject false if passkeys don't match. */
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
NimBLEDevice::injectConfirmPasskey(connInfo, true);
|
||||
};
|
||||
|
||||
/** Pairing process complete, we can check the results in connInfo */
|
||||
@@ -70,7 +70,7 @@ class MyClientCallback : public BLEClientCallbacks {
|
||||
if(!connInfo.isEncrypted()) {
|
||||
printf("Encrypt connection failed - disconnecting\n");
|
||||
/** Find the client with the connection handle provided in desc */
|
||||
NimBLEDevice::getClientByID(connInfo.getConnHandle())->disconnect();
|
||||
NimBLEDevice::getClientByHandle(connInfo.getConnHandle())->disconnect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class MyServerCallbacks: public BLEServerCallbacks {
|
||||
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
|
||||
/** Inject false if passkeys don't match. */
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
NimBLEDevice::injectConfirmPasskey(connInfo, true);
|
||||
};
|
||||
|
||||
void onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
|
||||
@@ -70,7 +70,7 @@ class MyServerCallbacks: public BLEServerCallbacks {
|
||||
void onConfirmPIN(NimBLEConnInfo& connInfo, uint32_t pass_key){
|
||||
printf("The passkey YES/NO number: %" PRIu32 "\n", pass_key);
|
||||
/** Inject false if passkeys don't match. */
|
||||
NimBLEDevice::injectConfirmPIN(connInfo, true);
|
||||
NimBLEDevice::injectConfirmPasskey(connInfo, true);
|
||||
};
|
||||
|
||||
void onAuthenticationComplete(NimBLEConnInfo& connInfo){
|
||||
|
||||
Reference in New Issue
Block a user