[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:
h2zero
2024-07-12 20:42:53 -06:00
committed by h2zero
parent d1d1b49a26
commit 10d589162b
15 changed files with 237 additions and 310 deletions

View File

@@ -219,7 +219,7 @@ void NimBLEServer::start() {
// with Notify / Indicate capabilities for event handling
for(auto &svc : m_svcVec) {
if(svc->m_removed == 0) {
rc = ble_gatts_find_svc(&svc->getUUID().getNative()->u, &svc->m_handle);
rc = ble_gatts_find_svc(svc->getUUID().getBase(), &svc->m_handle);
if(rc != 0) {
NIMBLE_LOGW(LOG_TAG, "GATT Server started without service: %s, Service %s",
svc->getUUID().toString().c_str(), svc->isStarted() ? "missing" : "not started");
@@ -412,7 +412,7 @@ std::string NimBLEServer::getPeerNameInternal(uint16_t conn_handle, TaskHandle_t
int rc = ble_gattc_read_by_uuid(conn_handle,
1,
0xffff,
((ble_uuid_t*)&uuid),
&uuid.u,
NimBLEServer::peerNameCB,
taskData);
if (rc != 0) {