Fix comments for doxygen (#16)

* Fix comments for doxygen

* Add documentation and update readme.
This commit is contained in:
h2zero
2020-07-08 19:27:26 -06:00
committed by GitHub
parent 64caf3553e
commit aae2a8f1e3
39 changed files with 1384 additions and 686 deletions

View File

@@ -23,17 +23,17 @@
static const char* LOG_TAG = "NimBLEAddress";
/*************************************************
NOTE: NimBLE addresses are in INVERSE ORDER!
We will accomodate that fact in these methods.
* NOTE: NimBLE address bytes are in INVERSE ORDER!
* We will accomodate that fact in these methods.
*************************************************/
/**
* @brief Create an address from the native ESP32 representation.
* @param [in] address The native representation.
* @brief Create an address from the native NimBLE representation.
* @param [in] address The native NimBLE address.
*/
NimBLEAddress::NimBLEAddress(ble_addr_t address) {
memcpy(m_address, address.val, 6);
} // BLEAddress
} // NimBLEAddress
/**
@@ -45,7 +45,7 @@ NimBLEAddress::NimBLEAddress(ble_addr_t address) {
* ```
* which is 17 characters in length.
*
* @param [in] stringAddress The hex representation of the address.
* @param [in] stringAddress The hex string representation of the address.
*/
NimBLEAddress::NimBLEAddress(const std::string &stringAddress) {
if (stringAddress.length() == 0) {
@@ -72,12 +72,12 @@ NimBLEAddress::NimBLEAddress(const std::string &stringAddress) {
for(size_t index = 0; index < sizeof m_address; index++) {
m_address[index] = data[index];
}
} // BLEAddress
} // NimBLEAddress
/**
* @brief Constructor for compatibility with bluedroid esp library.
* @param [in] uint8_t[6] or esp_bd_addr_t struct containing the address.
* @brief Constructor for compatibility with bluedroid esp library using native ESP representation.
* @param [in] address A uint8_t[6] or esp_bd_addr_t containing the address.
*/
NimBLEAddress::NimBLEAddress(uint8_t address[6]) {
std::reverse_copy(address, address + sizeof m_address, m_address);
@@ -85,8 +85,9 @@ NimBLEAddress::NimBLEAddress(uint8_t address[6]) {
/**
* @brief Constructor for address using a hex value. Use the same byte order, so use 0xa4c1385def16 for "a4:c1:38:5d:ef:16"
* @param [in] uint64_t containing the address.
* @brief Constructor for address using a hex value.\n
* Use the same byte order, so use 0xa4c1385def16 for "a4:c1:38:5d:ef:16"
* @param [in] address uint64_t containing the address.
*/
NimBLEAddress::NimBLEAddress(const uint64_t &address) {
memcpy(m_address, &address, sizeof m_address);
@@ -104,8 +105,8 @@ bool NimBLEAddress::equals(const NimBLEAddress &otherAddress) const {
/**
* @brief Return the native representation of the address.
* @return The native representation of the address.
* @brief Get the native representation of the address.
* @return a pointer to the uint8_t[6] array of the address.
*/
const uint8_t *NimBLEAddress::getNative() const {
return m_address;
@@ -122,30 +123,48 @@ const uint8_t *NimBLEAddress::getNative() const {
* ```
*
* @return The string representation of the address.
* @deprecated Use std::string() operator instead.
*/
std::string NimBLEAddress::toString() const {
return std::string(*this);
} // toString
/**
* @brief Convienience operator to check if this address is equal to another.
*/
bool NimBLEAddress::operator ==(const NimBLEAddress & rhs) const {
return memcmp(rhs.m_address, m_address, sizeof m_address) == 0;
}
} // operator ==
/**
* @brief Convienience operator to check if this address is not equal to another.
*/
bool NimBLEAddress::operator !=(const NimBLEAddress & rhs) const {
return !this->operator==(rhs);
}
} // operator !=
/**
* @brief Convienience operator to convert this address to string representation.
* @details This allows passing NimBLEAddress to functions
* that accept std::string and/or or it's methods as a parameter.
*/
NimBLEAddress::operator std::string() const {
char buffer[18];
sprintf(buffer, "%02x:%02x:%02x:%02x:%02x:%02x", m_address[5], m_address[4], m_address[3], m_address[2], m_address[1], m_address[0]);
return std::string(buffer);
}
} // operator std::string
/**
* @brief Convienience operator to convert the native address representation to uint_64.
*/
NimBLEAddress::operator uint64_t() const {
uint64_t address = 0;
memcpy(&address, m_address, sizeof m_address);
return address;
}
} // operator uint64_t
#endif