mirror of
https://github.com/h2zero/esp-nimble-cpp.git
synced 2026-01-29 09:40:10 +01:00
[BREAKING] Refactor NimBLEAddress - use NimBLE core representation.
This simplifies the NimBLEAddress code by directly using the NimBLE core `ble_addr_t` type to hold the address and allows using NimBLE core functions and macros to replace code in some methods. * `getNative()` replaced with `getBase()` and now returns a pointer to `const ble_addr_t` instead of a pointer to the address value. * Adds `isNrpa()` method to test if an address is random non-resolvable. * Adds `isStatic()` method to test if an address is random static. * Adds `isPublic()` method to test if an address is a public address. * Adds `isNull()` methods to test if an address is NULL. * Adds `getValue()` method which returns a read-only pointer to the address value. * Adds `reverseByteOrder()` method which will reverse the byte order of the address value. * `equals()` method and == operator will now also test if the address types are the same. * Code cleanup.
This commit is contained in:
@@ -643,15 +643,9 @@ bool NimBLEAdvertising::start(uint32_t duration, advCompleteCB_t advCompleteCB,
|
||||
m_advDataSet = true;
|
||||
}
|
||||
|
||||
ble_addr_t peerAddr;
|
||||
if (dirAddr != nullptr) {
|
||||
memcpy(&peerAddr.val, dirAddr->getNative(), 6);
|
||||
peerAddr.type = dirAddr->getType();
|
||||
}
|
||||
|
||||
#if defined(CONFIG_BT_NIMBLE_ROLE_PERIPHERAL)
|
||||
rc = ble_gap_adv_start(NimBLEDevice::m_own_addr_type,
|
||||
(dirAddr != nullptr) ? &peerAddr : NULL,
|
||||
(dirAddr != nullptr) ? dirAddr->getBase() : NULL,
|
||||
duration,
|
||||
&m_advParams,
|
||||
(pServer != nullptr) ? NimBLEServer::handleGapEvent :
|
||||
|
||||
Reference in New Issue
Block a user