1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Add light intensity to the known steps datalog message.

Add support for record version 6 introduced with firmware 3.11.
There are more data in each record now, but we still do not know what they mean.
Close #270
This commit is contained in:
Daniele Gobbetti 2016-04-04 23:33:17 +02:00
parent 34600e085e
commit 51def0d497

View File

@ -46,7 +46,7 @@ public class DatalogSessionHealthSteps extends DatalogSession {
recordVersion = datalogMessage.getShort(); recordVersion = datalogMessage.getShort();
if (recordVersion != 5) if ((recordVersion != 5) && (recordVersion != 6))
return false; //we don't know how to deal with the data TODO: this is not ideal because we will get the same message again and again since we NACK it return false; //we don't know how to deal with the data TODO: this is not ideal because we will get the same message again and again since we NACK it
timestamp = datalogMessage.getInt(); timestamp = datalogMessage.getInt();
@ -59,8 +59,7 @@ public class DatalogSessionHealthSteps extends DatalogSession {
for (int recordIdx = 0; recordIdx < recordNum; recordIdx++) { for (int recordIdx = 0; recordIdx < recordNum; recordIdx++) {
datalogMessage.position(beginOfRecordPosition + recordIdx * recordLength); //we may not consume all the bytes of a record datalogMessage.position(beginOfRecordPosition + recordIdx * recordLength); //we may not consume all the bytes of a record
stepsRecords[recordIdx] = new StepsRecord(timestamp, datalogMessage.get() & 0xff, datalogMessage.get() & 0xff, datalogMessage.getShort() & 0xffff); stepsRecords[recordIdx] = new StepsRecord(timestamp, datalogMessage.get() & 0xff, datalogMessage.get() & 0xff, datalogMessage.getShort() & 0xffff, datalogMessage.get() & 0xff);
datalogMessage.getShort(); // skip
timestamp += 60; timestamp += 60;
} }
@ -102,12 +101,14 @@ public class DatalogSessionHealthSteps extends DatalogSession {
int steps; int steps;
int orientation; int orientation;
int intensity; int intensity;
int light_intensity;
public StepsRecord(int timestamp, int steps, int orientation, int intensity) { public StepsRecord(int timestamp, int steps, int orientation, int intensity, int light_intensity) {
this.timestamp = timestamp; this.timestamp = timestamp;
this.steps = steps; this.steps = steps;
this.orientation = orientation; this.orientation = orientation;
this.intensity = intensity; this.intensity = intensity;
this.light_intensity = light_intensity;
} }
} }