1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-03 17:02:13 +01:00

Bangle.js: actTrk receive multiple lines per UARTRX

This commit is contained in:
Ganblejs 2024-03-01 01:41:34 +01:00 committed by José Rebelo
parent d3229dea96
commit 2c918f6a7c

View File

@ -754,15 +754,15 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
} }
String filename = "recorder.log" + log + ".csv"; String filename = "recorder.log" + log + ".csv";
if (!json.has("line")) { // if no line was sent with this json object, it signifies that the whole recorder log has been transmitted. if (!json.has("lines")) { // if no lines was sent with this json object, it signifies that the whole recorder log has been transmitted.
parseFetchedRecorderCSV(dir, filename, log); parseFetchedRecorderCSV(dir, filename, log);
} else { // We received a line of the csv, now we append it to the file in storage. } else { // We received a lines of the csv, now we append it to the file in storage.
String line = json.getString("line"); String lines = json.getString("lines");
LOG.info(line); LOG.info(lines);
String mode = "append"; String mode = "append";
if (line.equals("")) { if (lines.equals("")) {
mode = "write"; mode = "write";
} }
@ -771,7 +771,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
File outputFileLogID = new File(dir, filenameLogID); File outputFileLogID = new File(dir, filenameLogID);
LOG.warn("Writing log to " + outputFile.toString()); LOG.warn("Writing log to " + outputFile.toString());
try { try {
FileUtils.copyStringToFile(line,outputFile,mode); FileUtils.copyStringToFile(lines,outputFile,mode);
//GB.toast(getContext(), "Log written to " + filename, Toast.LENGTH_LONG, GB.INFO); //GB.toast(getContext(), "Log written to " + filename, Toast.LENGTH_LONG, GB.INFO);
FileUtils.copyStringToFile(log,outputFileLogID,""); FileUtils.copyStringToFile(log,outputFileLogID,"");
@ -781,7 +781,7 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
} }
} }
if (!json.has("line") && json.getString("log").equals(lastRecToFetch)) { if (!json.has("lines") && json.getString("log").equals(lastRecToFetch)) {
getDevice().unsetBusyTask(); getDevice().unsetBusyTask();
} }
} }