The current DEV branch is using the ESP32 BLE for Arduino, but a newer version looks to be included in the ESP32 framework(?) now.
The newer version looks to have a few changes, including only returning one ServiceData
and ServiceDataUUID
per device.
I don’t know if this functionality is used with other devices, but switching to the built-in library still reports the steps for my Xiaomi MiBand 4. This version has a few bug fixes, including allowing OMG to compile with a CORE_DEBUG_LEVEL
value set.
Changes
ZgatewayBT.ino : 397
if (advertisedDevice.haveServiceData()) {
std::string serviceData = advertisedDevice.getServiceData();
int serviceDataLength = serviceData.length();
String returnedString = "";
for (int i = 0; i < serviceDataLength; i++) {
int a = serviceData[i];
if (a < 16) {
returnedString += F("0");
}
returnedString += String(a, HEX);
}
Log.trace(F("Service data: %s" CR), returnedString.c_str());
BLEdata.set("servicedata", returnedString.c_str());
std::string serviceDatauuid = advertisedDevice.getServiceDataUUID().toString();
Log.trace(F("Service data UUID: %s" CR), (char*)serviceDatauuid.c_str());
BLEdata.set("servicedatauuid", (char*)serviceDatauuid.c_str());
PublishDeviceData(BLEdata);
} else {
PublishDeviceData(BLEdata); // publish device even if there is no service data
}