Trying to understand BLEUUID.toString().c_str()

william.ferguson.au
Posts: 29
Joined: Wed Jan 02, 2019 8:55 am

Trying to understand BLEUUID.toString().c_str()

Postby william.ferguson.au » Sun Sep 29, 2019 12:55 pm

I got caught up in a bug in BLEUUID where it was chopping off the last 2 chars of the UUID.
Have created a fix for that https://github.com/espressif/arduino-esp32/pull/3297

But along the way I became derailed because it appeared that the BLECharacteristic UUID and any BLECharacteristic longer than 15 chars would become corrupted. It turns out they don't get corrupted, but my confusion stems from different output from each of:

Code: Select all

        const char* uuid_str = (const char*) characteristic->getUUID().toString().c_str();
        ESP_LOGD(TAG, "#onRead uuid='%s'", uuid_str);
        ESP_LOGD(TAG, "#onRead uuid='%s'", characteristic->getUUID().toString().c_str());

Code: Select all

D (7452) issue_3153: #onRead uuid='?485f-43ab-42fc-99a6-e0b8eb2a3159'
D (7462) issue_3153: #onRead uuid='fcb7485f-43ab-42fc-99a6-e0b8eb2a3159'
Could someone please explain why those two log statements generate divergent outputs?

Who is online

Users browsing this forum: Google [Bot] and 3 guests