Hello
I am using eps_ble_tracker and try to get HA app iBeacon’s UUID
auto ibeacon = x.get_ibeacon().value();
ESP_LOGD("ble_adv", " UUID: %s", ibeacon.from_uuid.to_string().c_str());
Problem I have is that it returns it in this format:
UUID: 7495060EEE0AB7-9C77-402C-7140-B822B7
instead of this:
b722b840-712c-4077-9cb7-0aee0e069574
This is from the source code from https://github.com/esphome/esphome/blob/61ebc629f6bbd26e6f63253cb2f496e95834a7c4/esphome/components/esp32_ble_tracker/esp32_ble_tracker.cpp:
esp_bt_uuid_t ESPBTUUID::get_uuid() { return this->uuid_; }
std::string ESPBTUUID::to_string() {
char sbuf[64];
switch (this->uuid_.len) {
case ESP_UUID_LEN_16:
sprintf(sbuf, "0x%02X%02X", this->uuid_.uuid.uuid16 >> 8, this->uuid_.uuid.uuid16 & 0xff);
break;
case ESP_UUID_LEN_32:
sprintf(sbuf, "0x%02X%02X%02X%02X", this->uuid_.uuid.uuid32 >> 24, (this->uuid_.uuid.uuid32 >> 16 & 0xff),
(this->uuid_.uuid.uuid32 >> 8 & 0xff), this->uuid_.uuid.uuid32 & 0xff);
break;
default:
case ESP_UUID_LEN_128:
char *bpos = sbuf;
for (int8_t i = 15; i >= 0; i--) {
sprintf(bpos, "%02X", this->uuid_.uuid.uuid128[i]);
bpos += 2;
if (i == 3 || i == 5 || i == 7 || i == 9)
sprintf(bpos++, "-");
}
sbuf[47] = '\0';
break;
}
return sbuf;
}