You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove duplicate BLE service data sent over MQTT(#1044)
This will remove the sending of BLE service data when multiple service data attributes are advertised by a broadcasting device.
Instead the data for known device types will be consolidated into a single message to reduce overhead.
Copy file name to clipboardExpand all lines: main/ZgatewayBT.ino
+1-30Lines changed: 1 addition & 30 deletions
Original file line number
Diff line number
Diff line change
@@ -685,36 +685,7 @@ class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks {
685
685
process_bledata(BLEdata); // this will force to resolve all the service data
686
686
}
687
687
688
-
if (serviceDataCount > 1) {
689
-
BLEdata.remove("servicedata");
690
-
BLEdata.remove("servicedatauuid");
691
-
692
-
int msglen = BLEdata.measureLength() + 1;
693
-
char jsonmsg[msglen];
694
-
char jsonmsgb[msglen];
695
-
BLEdata.printTo(jsonmsgb, sizeof(jsonmsgb));
696
-
for (int j = 0; j < serviceDataCount; j++) {
697
-
strcpy(jsonmsg, jsonmsgb); // the parse _destroys_ the message buffer
698
-
JsonObject& BLEdataLocal = getBTJsonObject(jsonmsg, j == 0); // note, that first time we will get here the BLEdata itself; haPresence for the first msg
699
-
if (!BLEdataLocal.containsKey("id")) { // would crash without id
700
-
Log.trace("Json parsing error for %s" CR, jsonmsgb);
0 commit comments