NimBLEAddress: New constructor added to create blank addresses

* Docuement NimBLEAddress::getNative in migration docs.
This commit is contained in:
h2zero 2020-09-02 14:52:34 -06:00
parent 9cdf60d360
commit 10acb004dc
3 changed files with 15 additions and 0 deletions

View file

@ -47,6 +47,12 @@ For example `BLEAddress addr(11:22:33:44:55:66, 1)` will create the address obje
As this paramameter is optional no changes to existing code are needed, it is mentioned here for information.
<br/>
`BLEAddress::getNative` (`NimBLEAddress::getNative`) returns a uint8_t pointer to the native address byte array.
In this library the address bytes are stored in reverse order from the original library. This is due to the way
the NimBLE stack expects addresses to be presented to it. All other functions such as `toString` are
not affected as the endian change is made within them.
<br/>
<a name="server-api"></a>
## Server API
Creating a `BLEServer` instance is the same as original, no changes required.

View file

@ -37,6 +37,14 @@ NimBLEAddress::NimBLEAddress(ble_addr_t address) {
} // NimBLEAddress
/**
* @brief Create a blank address, i.e. 00:00:00:00:00:00, type 0.
*/
NimBLEAddress::NimBLEAddress() {
NimBLEAddress("");
} // NimBLEAddress
/**
* @brief Create an address from a hex string
*

View file

@ -33,6 +33,7 @@
*/
class NimBLEAddress {
public:
NimBLEAddress();
NimBLEAddress(ble_addr_t address);
NimBLEAddress(uint8_t address[6], uint8_t type = BLE_ADDR_PUBLIC);
NimBLEAddress(const std::string &stringAddress, uint8_t type = BLE_ADDR_PUBLIC);