Fix comments and add Address_t empty constructor
Add an empty constructor to BLEProtocol::Address_t and fixed comments with regards to BLEProtocol::Address_t.
This commit is contained in:
parent
42a202e047
commit
819a0ca799
|
@ -26,15 +26,19 @@
|
|||
* A common namespace for types and constants used everywhere in BLE API.
|
||||
*/
|
||||
namespace BLEProtocol {
|
||||
/**< Address-type for Protocol addresses. */
|
||||
struct AddressType { /* Adding a struct to encapsulate the contained enumeration
|
||||
* prevents polluting the BLEProtocol namespace with the
|
||||
* enumerated values. It also allows type-aliases for the
|
||||
* enumeration while retaining the enumerated values. i.e.
|
||||
/**<
|
||||
* A simple container for the enumeration of address-types for Protocol addresses.
|
||||
*
|
||||
* doing:
|
||||
* typedef AddressType_t AliasedType_t;
|
||||
* would allow the use of AliasedType_t::PUBLIC in code. */
|
||||
* Adding a struct to encapsulate the contained enumeration prevents
|
||||
* polluting the BLEProtocol namespace with the enumerated values. It also
|
||||
* allows type-aliases for the enumeration while retaining the enumerated
|
||||
* values. i.e. doing:
|
||||
* typedef AddressType AliasedType;
|
||||
*
|
||||
* would allow the use of AliasedType::PUBLIC in code.
|
||||
*/
|
||||
struct AddressType {
|
||||
/**< Address-types for Protocol addresses. */
|
||||
enum Type {
|
||||
PUBLIC = 0,
|
||||
RANDOM_STATIC,
|
||||
|
@ -58,16 +62,7 @@ namespace BLEProtocol {
|
|||
std::copy(addressIn, addressIn + ADDR_LEN, address);
|
||||
}
|
||||
|
||||
Address_t(void) : type(AddressType::PUBLIC), address() {
|
||||
}
|
||||
|
||||
bool operator<(const Address_t &rhs) const {
|
||||
if (type < rhs.type) {
|
||||
return true;
|
||||
} else if (type > rhs.type) {
|
||||
return false;
|
||||
}
|
||||
return (memcmp(address, rhs.address, sizeof(AddressBytes_t)) < 0) ? true : false;
|
||||
Address_t() : type(), address() {
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -66,8 +66,8 @@ public:
|
|||
};
|
||||
|
||||
static const unsigned ADDR_LEN = BLEProtocol::ADDR_LEN; /**< Length (in octets) of the BLE MAC address. */
|
||||
typedef BLEProtocol::AddressBytes_t Address_t; /**< 48-bit address, LSB format. @Note: Deprecated. Use BLEProtocol::Address_t instead. */
|
||||
typedef BLEProtocol::AddressBytes_t address_t; /**< 48-bit address, LSB format. @Note: Deprecated. Use BLEProtocol::Address_t instead. */
|
||||
typedef BLEProtocol::AddressBytes_t Address_t; /**< 48-bit address, LSB format. @Note: Deprecated. Use BLEProtocol::AddressBytes_t instead. */
|
||||
typedef BLEProtocol::AddressBytes_t address_t; /**< 48-bit address, LSB format. @Note: Deprecated. Use BLEProtocol::AddressBytes_t instead. */
|
||||
|
||||
public:
|
||||
enum TimeoutSource_t {
|
||||
|
@ -226,7 +226,7 @@ public:
|
|||
public:
|
||||
/**
|
||||
* Set the BTLE MAC address and type. Please note that the address format is
|
||||
* least significant byte first (LSB). Please refer to BLEProtocol::Address_t.
|
||||
* least significant byte first (LSB). Please refer to BLEProtocol::AddressBytes_t.
|
||||
*
|
||||
* @return BLE_ERROR_NONE on success.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue