[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:
h2zero
2024-11-02 18:46:04 -06:00
committed by h2zero
parent 877a29a8b1
commit a2fe5b4780
13 changed files with 800 additions and 796 deletions
+2 -2
View File
@@ -310,7 +310,7 @@ bool NimBLEScan::start(uint32_t duration, bool is_continue) {
scan_params.passive = m_scan_params.passive;
scan_params.itvl = m_scan_params.itvl;
scan_params.window = m_scan_params.window;
int rc = ble_gap_ext_disc(NimBLEDevice::m_own_addr_type,
int rc = ble_gap_ext_disc(NimBLEDevice::m_ownAddrType,
duration/10,
0,
m_scan_params.filter_duplicates,
@@ -321,7 +321,7 @@ bool NimBLEScan::start(uint32_t duration, bool is_continue) {
NimBLEScan::handleGapEvent,
NULL);
#else
int rc = ble_gap_disc(NimBLEDevice::m_own_addr_type,
int rc = ble_gap_disc(NimBLEDevice::m_ownAddrType,
duration,
&m_scan_params,
NimBLEScan::handleGapEvent,