forked from h2zero/esp-nimble-cpp
Fix comments for doxygen (#16)
* Fix comments for doxygen * Add documentation and update readme.
This commit is contained in:
+62
-1
@@ -22,6 +22,10 @@
|
||||
|
||||
static const char* LOG_TAG = "NimBLEBeacon";
|
||||
|
||||
|
||||
/**
|
||||
* @brief Construct a default beacon object.
|
||||
*/
|
||||
NimBLEBeacon::NimBLEBeacon() {
|
||||
m_beaconData.manufacturerId = 0x4c00;
|
||||
m_beaconData.subType = 0x02;
|
||||
@@ -32,32 +36,64 @@ NimBLEBeacon::NimBLEBeacon() {
|
||||
memset(m_beaconData.proximityUUID, 0, sizeof(m_beaconData.proximityUUID));
|
||||
} // NimBLEBeacon
|
||||
|
||||
|
||||
/**
|
||||
* @brief Retrieve the data that is being advertised.
|
||||
* @return The advertised data.
|
||||
*/
|
||||
std::string NimBLEBeacon::getData() {
|
||||
return std::string((char*) &m_beaconData, sizeof(m_beaconData));
|
||||
} // getData
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the major value being advertised.
|
||||
* @return The major value advertised.
|
||||
*/
|
||||
uint16_t NimBLEBeacon::getMajor() {
|
||||
return m_beaconData.major;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the manufacturer ID being advertised.
|
||||
* @return The manufacturer ID value advertised.
|
||||
*/
|
||||
uint16_t NimBLEBeacon::getManufacturerId() {
|
||||
return m_beaconData.manufacturerId;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the minor value being advertised.
|
||||
* @return minor value advertised.
|
||||
*/
|
||||
uint16_t NimBLEBeacon::getMinor() {
|
||||
return m_beaconData.minor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the proximity UUID being advertised.
|
||||
* @return The UUID advertised.
|
||||
*/
|
||||
NimBLEUUID NimBLEBeacon::getProximityUUID() {
|
||||
return NimBLEUUID(m_beaconData.proximityUUID, 16, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get the signal power being advertised.
|
||||
* @return signal power level advertised.
|
||||
*/
|
||||
int8_t NimBLEBeacon::getSignalPower() {
|
||||
return m_beaconData.signalPower;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the raw data for the beacon record.
|
||||
* @brief Set the raw data for the beacon record.
|
||||
* @param [in] data The raw beacon data.
|
||||
*/
|
||||
void NimBLEBeacon::setData(const std::string &data) {
|
||||
if (data.length() != sizeof(m_beaconData)) {
|
||||
@@ -68,24 +104,49 @@ void NimBLEBeacon::setData(const std::string &data) {
|
||||
memcpy(&m_beaconData, data.data(), sizeof(m_beaconData));
|
||||
} // setData
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the major value.
|
||||
* @param [in] major The major value.
|
||||
*/
|
||||
void NimBLEBeacon::setMajor(uint16_t major) {
|
||||
m_beaconData.major = ENDIAN_CHANGE_U16(major);
|
||||
} // setMajor
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the manufacturer ID.
|
||||
* @param [in] manufacturerId The manufacturer ID value.
|
||||
*/
|
||||
void NimBLEBeacon::setManufacturerId(uint16_t manufacturerId) {
|
||||
m_beaconData.manufacturerId = ENDIAN_CHANGE_U16(manufacturerId);
|
||||
} // setManufacturerId
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the minor value.
|
||||
* @param [in] minor The minor value.
|
||||
*/
|
||||
void NimBLEBeacon::setMinor(uint16_t minor) {
|
||||
m_beaconData.minor = ENDIAN_CHANGE_U16(minor);
|
||||
} // setMinior
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the proximity UUID.
|
||||
* @param [in] uuid The proximity UUID.
|
||||
*/
|
||||
void NimBLEBeacon::setProximityUUID(const NimBLEUUID &uuid) {
|
||||
NimBLEUUID temp_uuid = uuid;
|
||||
temp_uuid.to128();
|
||||
memcpy(m_beaconData.proximityUUID, temp_uuid.getNative()->u128.value, 16);
|
||||
} // setProximityUUID
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set the signal power.
|
||||
* @param [in] signalPower The signal power value.
|
||||
*/
|
||||
void NimBLEBeacon::setSignalPower(int8_t signalPower) {
|
||||
m_beaconData.signalPower = signalPower;
|
||||
} // setSignalPower
|
||||
|
||||
Reference in New Issue
Block a user