Skip to content

Commit bd52952

Browse files
committed
NimBLEAddress: New constructor added to create blank addresses
* Docuement NimBLEAddress::getNative in migration docs.
1 parent 4b91721 commit bd52952

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

docs/Migration_guide.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ For example `BLEAddress addr(11:22:33:44:55:66, 1)` will create the address obje
4747

4848
As this paramameter is optional no changes to existing code are needed, it is mentioned here for information.
4949
<br/>
50+
`BLEAddress::getNative` (`NimBLEAddress::getNative`) returns a uint8_t pointer to the native address byte array.
51+
In this library the address bytes are stored in reverse order from the original library. This is due to the way
52+
the NimBLE stack expects addresses to be presented to it. All other functions such as `toString` are
53+
not affected as the endian change is made within them.
54+
<br/>
55+
5056
<a name="server-api"></a>
5157
## Server API
5258
Creating a `BLEServer` instance is the same as original, no changes required.

src/NimBLEAddress.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ NimBLEAddress::NimBLEAddress(ble_addr_t address) {
3737
} // NimBLEAddress
3838

3939

40+
/**
41+
* @brief Create a blank address, i.e. 00:00:00:00:00:00, type 0.
42+
*/
43+
NimBLEAddress::NimBLEAddress() {
44+
NimBLEAddress("");
45+
} // NimBLEAddress
46+
47+
4048
/**
4149
* @brief Create an address from a hex string
4250
*

src/NimBLEAddress.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
*/
3434
class NimBLEAddress {
3535
public:
36+
NimBLEAddress();
3637
NimBLEAddress(ble_addr_t address);
3738
NimBLEAddress(uint8_t address[6], uint8_t type = BLE_ADDR_PUBLIC);
3839
NimBLEAddress(const std::string &stringAddress, uint8_t type = BLE_ADDR_PUBLIC);

0 commit comments

Comments
 (0)