On Gadgetbridge, ensure the default data handler is set rather than built into bangleRx.

This means that when comms.js does its hacky thing to replace the data handler it doesn't end up duplicating handlers.

Fixes #3151
pull/3152/head
Gordon Williams 2024-01-11 10:06:38 +00:00
parent 31bf63aeb5
commit 932d2c0d9d
1 changed files with 5 additions and 3 deletions

View File

@ -248,12 +248,14 @@ if (typeof Android!=="undefined") {
hadData : false,
handlers : []
}
connection.on("data", function(d) {
connection.received += d;
connection.hadData = true;
if (connection.cb) connection.cb(d);
});
function bangleRx(data) {
// document.getElementById("status").innerText = "RX:"+data;
connection.received += data;
connection.hadData = true;
if (connection.cb) connection.cb(data);
// call data event
if (connection.handlers["data"])
connection.handlers["data"](data);