forked from h2zero/esp-nimble-cpp
[Breaking] Refactor NimBLEUUID.
* msbFirst parameter has been removed from constructor as it was unnecessary, caller should reverse the data first or call the new `reverseByteOrder` method after. * `getNative` method replaced with `getBase` which returns a read-only pointer to the UUID size underlying. * Added `reverseByteOrder` method, this will reverse the bytes of the UUID, which can be useful for advertising/logging. * Added `getValue` method, which returns a read-only `uint8_t` pointer to the UUID value. * Removed `m_valueSet` member variable, `bitSize()` can be used as a replacement. * General code cleanup.
This commit is contained in:
@@ -79,7 +79,7 @@ uint16_t NimBLEBeacon::getMinor() {
|
||||
* @return The UUID advertised.
|
||||
*/
|
||||
NimBLEUUID NimBLEBeacon::getProximityUUID() {
|
||||
return NimBLEUUID(m_beaconData.proximityUUID, 16, true);
|
||||
return NimBLEUUID(m_beaconData.proximityUUID, 16).reverseByteOrder();
|
||||
}
|
||||
|
||||
|
||||
@@ -140,9 +140,7 @@ void NimBLEBeacon::setMinor(uint16_t minor) {
|
||||
void NimBLEBeacon::setProximityUUID(const NimBLEUUID &uuid) {
|
||||
NimBLEUUID temp_uuid = uuid;
|
||||
temp_uuid.to128();
|
||||
std::reverse_copy(temp_uuid.getNative()->u128.value,
|
||||
temp_uuid.getNative()->u128.value + 16,
|
||||
m_beaconData.proximityUUID);
|
||||
std::reverse_copy(temp_uuid.getValue(), temp_uuid.getValue() + 16, m_beaconData.proximityUUID);
|
||||
} // setProximityUUID
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user