mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 05:16:51 +01:00
Additional Huami Summary fields
This commit is contained in:
parent
96d709bea1
commit
2af93eba03
@ -92,17 +92,29 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser {
|
|||||||
int minLongitude;
|
int minLongitude;
|
||||||
float caloriesBurnt;
|
float caloriesBurnt;
|
||||||
float distanceMeters;
|
float distanceMeters;
|
||||||
|
float distanceMeters2 = 0;
|
||||||
float ascentMeters = 0;
|
float ascentMeters = 0;
|
||||||
float descentMeters = 0;
|
float descentMeters = 0;
|
||||||
float maxAltitude = 0;
|
float maxAltitude = 0;
|
||||||
float minAltitude = 0;
|
float minAltitude = 0;
|
||||||
|
float averageAltitude = 0;
|
||||||
float maxSpeed = 0;
|
float maxSpeed = 0;
|
||||||
float minPace;
|
float minSpeed = 0;
|
||||||
float maxPace;
|
float averageSpeed = 0;
|
||||||
|
float minPace = 0;
|
||||||
|
float maxPace = 0;
|
||||||
|
float averagePace = 0;
|
||||||
|
int maxCadence = 0;
|
||||||
|
int minCadence = 0;
|
||||||
|
int averageCadence = 0;
|
||||||
|
int maxStride = 0;
|
||||||
|
int minStride = 0;
|
||||||
|
int averageStride2 = 0;
|
||||||
float totalStride = 0;
|
float totalStride = 0;
|
||||||
float averageStride;
|
float averageStride;
|
||||||
short averageHR;
|
short averageHR;
|
||||||
short maxHR = 0;
|
short maxHR = 0;
|
||||||
|
short minHR = 0;
|
||||||
short averageKMPaceSeconds;
|
short averageKMPaceSeconds;
|
||||||
int ascentSeconds = 0;
|
int ascentSeconds = 0;
|
||||||
int descentSeconds = 0;
|
int descentSeconds = 0;
|
||||||
@ -121,31 +133,45 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser {
|
|||||||
// Bip S now has 518 so assuming 512+x, might be wrong
|
// Bip S now has 518 so assuming 512+x, might be wrong
|
||||||
|
|
||||||
if (version >= 512) {
|
if (version >= 512) {
|
||||||
|
buffer.get(); // skip one byte
|
||||||
|
minHR = buffer.getShort();
|
||||||
if (version == 519) {
|
if (version == 519) {
|
||||||
// hack that skips data on yet unknown summary version 519 data
|
// hack that skips data on yet unknown summary version 519 data
|
||||||
buffer.position(0x8c);
|
buffer.position(0x8c);
|
||||||
}
|
}
|
||||||
steps = buffer.getInt();
|
steps = buffer.getInt();
|
||||||
activeSeconds = buffer.getInt();
|
activeSeconds = buffer.getInt();
|
||||||
//unknown
|
|
||||||
buffer.getLong();
|
maxLatitude = buffer.getInt();
|
||||||
buffer.getLong();
|
minLatitude = buffer.getInt();
|
||||||
|
maxLongitude = buffer.getInt();
|
||||||
|
minLongitude = buffer.getInt();
|
||||||
|
|
||||||
caloriesBurnt = buffer.getFloat();
|
caloriesBurnt = buffer.getFloat();
|
||||||
distanceMeters = buffer.getFloat();
|
distanceMeters = buffer.getFloat();
|
||||||
|
|
||||||
ascentMeters = buffer.getFloat();
|
ascentMeters = buffer.getFloat();
|
||||||
descentMeters = buffer.getFloat();
|
descentMeters = buffer.getFloat();
|
||||||
maxAltitude = buffer.getFloat();
|
maxAltitude = buffer.getFloat();
|
||||||
minAltitude = buffer.getFloat();
|
minAltitude = buffer.getFloat();
|
||||||
//unknown
|
averageAltitude = buffer.getFloat();
|
||||||
buffer.getLong();
|
|
||||||
buffer.getLong();
|
maxSpeed = buffer.getFloat(); // in meter/second
|
||||||
minPace = buffer.getFloat();
|
minSpeed = buffer.getFloat();
|
||||||
|
averageSpeed = buffer.getFloat();
|
||||||
|
minPace = buffer.getFloat(); // in seconds/meter
|
||||||
maxPace = buffer.getFloat();
|
maxPace = buffer.getFloat();
|
||||||
//unknown
|
averagePace = buffer.getFloat();
|
||||||
buffer.getLong();
|
|
||||||
buffer.getLong();
|
maxCadence = Math.round(buffer.getFloat() * 60);
|
||||||
buffer.getLong();
|
minCadence = Math.round(buffer.getFloat() * 60);
|
||||||
buffer.getLong();
|
averageCadence = Math.round(buffer.getFloat() * 60);
|
||||||
|
|
||||||
|
maxStride = Math.round(buffer.getFloat() * 100);
|
||||||
|
minStride = Math.round(buffer.getFloat() * 100);
|
||||||
|
averageStride2 = Math.round(buffer.getFloat() * 100);
|
||||||
|
|
||||||
|
distanceMeters2 = buffer.getFloat(); // this distance is 87-97% of distanceMeters, so probably length of the GPS track (difference is larger, when GPS took longer to get a precise position)
|
||||||
buffer.getInt();
|
buffer.getInt();
|
||||||
averageHR = buffer.getShort();
|
averageHR = buffer.getShort();
|
||||||
averageKMPaceSeconds = buffer.getShort();
|
averageKMPaceSeconds = buffer.getShort();
|
||||||
@ -274,6 +300,7 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser {
|
|||||||
addSummaryData("flatSeconds", flatSeconds, "seconds");
|
addSummaryData("flatSeconds", flatSeconds, "seconds");
|
||||||
|
|
||||||
addSummaryData("distanceMeters", distanceMeters, "meters");
|
addSummaryData("distanceMeters", distanceMeters, "meters");
|
||||||
|
// addSummaryData("distanceMeters2", distanceMeters2, "meters");
|
||||||
addSummaryData("ascentMeters", ascentMeters, "meters");
|
addSummaryData("ascentMeters", ascentMeters, "meters");
|
||||||
addSummaryData("descentMeters", descentMeters, "meters");
|
addSummaryData("descentMeters", descentMeters, "meters");
|
||||||
if (maxAltitude != -100000) {
|
if (maxAltitude != -100000) {
|
||||||
@ -282,10 +309,18 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser {
|
|||||||
if (minAltitude != 100000) {
|
if (minAltitude != 100000) {
|
||||||
addSummaryData("minAltitude", minAltitude, "meters");
|
addSummaryData("minAltitude", minAltitude, "meters");
|
||||||
}
|
}
|
||||||
|
if (minAltitude != 100000) {
|
||||||
|
addSummaryData("averageAltitude", averageAltitude, "meters");
|
||||||
|
}
|
||||||
addSummaryData("steps", steps, "steps_unit");
|
addSummaryData("steps", steps, "steps_unit");
|
||||||
addSummaryData("activeSeconds", activeSeconds, "seconds");
|
addSummaryData("activeSeconds", activeSeconds, "seconds");
|
||||||
addSummaryData("caloriesBurnt", caloriesBurnt, "calories_unit");
|
addSummaryData("caloriesBurnt", caloriesBurnt, "calories_unit");
|
||||||
addSummaryData("maxSpeed", maxSpeed, "meters_second");
|
addSummaryData("maxSpeed", maxSpeed, "meters_second");
|
||||||
|
addSummaryData("minSpeed", minSpeed, "meters_second");
|
||||||
|
addSummaryData("averageSpeed", averageSpeed, "meters_second");
|
||||||
|
addSummaryData("maxCadence", maxCadence, "spm");
|
||||||
|
addSummaryData("minCadence", minCadence, "spm");
|
||||||
|
addSummaryData("averageCadence", averageCadence, "spm");
|
||||||
|
|
||||||
if (!(activityKind == ActivityKind.TYPE_ELLIPTICAL_TRAINER ||
|
if (!(activityKind == ActivityKind.TYPE_ELLIPTICAL_TRAINER ||
|
||||||
activityKind == ActivityKind.TYPE_JUMP_ROPING ||
|
activityKind == ActivityKind.TYPE_JUMP_ROPING ||
|
||||||
@ -294,13 +329,18 @@ public class HuamiActivitySummaryParser implements ActivitySummaryParser {
|
|||||||
activityKind == ActivityKind.TYPE_INDOOR_CYCLING)) {
|
activityKind == ActivityKind.TYPE_INDOOR_CYCLING)) {
|
||||||
addSummaryData("minPace", minPace, "seconds_m");
|
addSummaryData("minPace", minPace, "seconds_m");
|
||||||
addSummaryData("maxPace", maxPace, "seconds_m");
|
addSummaryData("maxPace", maxPace, "seconds_m");
|
||||||
|
// addSummaryData("averagePace", averagePace, "seconds_m");
|
||||||
}
|
}
|
||||||
|
|
||||||
addSummaryData("totalStride", totalStride, "meters");
|
addSummaryData("totalStride", totalStride, "meters");
|
||||||
addSummaryData("averageHR", averageHR, "bpm");
|
addSummaryData("averageHR", averageHR, "bpm");
|
||||||
addSummaryData("maxHR", maxHR, "bpm");
|
addSummaryData("maxHR", maxHR, "bpm");
|
||||||
|
addSummaryData("minHR", minHR, "bpm");
|
||||||
addSummaryData("averageKMPaceSeconds", averageKMPaceSeconds, "seconds_km");
|
addSummaryData("averageKMPaceSeconds", averageKMPaceSeconds, "seconds_km");
|
||||||
addSummaryData("averageStride", averageStride, "cm");
|
addSummaryData("averageStride", averageStride, "cm");
|
||||||
|
addSummaryData("maxStride", maxStride, "cm");
|
||||||
|
addSummaryData("minStride", minStride, "cm");
|
||||||
|
// addSummaryData("averageStride2", averageStride2, "cm");
|
||||||
|
|
||||||
if (activityKind == ActivityKind.TYPE_SWIMMING || activityKind == ActivityKind.TYPE_SWIMMING_OPENWATER) {
|
if (activityKind == ActivityKind.TYPE_SWIMMING || activityKind == ActivityKind.TYPE_SWIMMING_OPENWATER) {
|
||||||
addSummaryData("averageStrokeDistance", averageStrokeDistance, "meters");
|
addSummaryData("averageStrokeDistance", averageStrokeDistance, "meters");
|
||||||
|
@ -145,10 +145,10 @@ public class ActivitySummaryJsonSummary {
|
|||||||
private JSONObject createActivitySummaryGroups(){
|
private JSONObject createActivitySummaryGroups(){
|
||||||
String groupDefinitions = "{'Strokes':['averageStrokeDistance','averageStrokesPerSecond','strokes'], " +
|
String groupDefinitions = "{'Strokes':['averageStrokeDistance','averageStrokesPerSecond','strokes'], " +
|
||||||
"'Swimming':['swolfIndex','swimStyle'], " +
|
"'Swimming':['swolfIndex','swimStyle'], " +
|
||||||
"'Elevation':['ascentMeters','descentMeters','maxAltitude','minAltitude','ascentSeconds','descentSeconds','flatSeconds', 'baseAltitude'], " +
|
"'Elevation':['ascentMeters','descentMeters','maxAltitude','minAltitude','averageAltitude','ascentSeconds','descentSeconds','flatSeconds', 'baseAltitude'], " +
|
||||||
"'Speed':['maxSpeed','minPace','maxPace','averageKMPaceSeconds', 'averageSpeed', 'averageSpeed2'], " +
|
"'Speed':['averageSpeed','maxSpeed','minSpeed','averageKMPaceSeconds','minPace','maxPace','averageSpeed2','averageCadence','maxCadence','minCadence'], " +
|
||||||
"'Activity':['distanceMeters','steps','activeSeconds','caloriesBurnt','totalStride'," +
|
"'Activity':['distanceMeters','steps','activeSeconds','caloriesBurnt','totalStride'," +
|
||||||
"'averageHR','averageStride'], " +
|
"'averageHR','maxHR','minHR','averageStride','maxStride','minStride'], " +
|
||||||
"'Laps':['averageLapPace','laps']}";
|
"'Laps':['averageLapPace','laps']}";
|
||||||
JSONObject data = null;
|
JSONObject data = null;
|
||||||
try {
|
try {
|
||||||
|
@ -1114,16 +1114,25 @@
|
|||||||
<string name="descentMeters">Downhill</string>
|
<string name="descentMeters">Downhill</string>
|
||||||
<string name="maxAltitude">Maximum</string>
|
<string name="maxAltitude">Maximum</string>
|
||||||
<string name="minAltitude">Minimum</string>
|
<string name="minAltitude">Minimum</string>
|
||||||
|
<string name="averageAltitude">Average</string>
|
||||||
<string name="steps">Steps</string>
|
<string name="steps">Steps</string>
|
||||||
<string name="activeSeconds">Active</string>
|
<string name="activeSeconds">Active</string>
|
||||||
<string name="caloriesBurnt">Calories</string>
|
<string name="caloriesBurnt">Calories</string>
|
||||||
<string name="maxSpeed">Maximum</string>
|
<string name="maxSpeed">Maximum</string>
|
||||||
|
<string name="minSpeed">Minimum</string>
|
||||||
<string name="minPace">Slowest Pace</string>
|
<string name="minPace">Slowest Pace</string>
|
||||||
<string name="maxPace">Fastest Pace</string>
|
<string name="maxPace">Fastest Pace</string>
|
||||||
<string name="totalStride">Total stride</string>
|
<string name="totalStride">Total stride</string>
|
||||||
<string name="averageHR">Heartrate</string>
|
<string name="averageHR">Heartrate</string>
|
||||||
|
<string name="maxHR">Max Heartrate</string>
|
||||||
|
<string name="minHR">Min Heartrate</string>
|
||||||
<string name="averageKMPaceSeconds">Pace</string>
|
<string name="averageKMPaceSeconds">Pace</string>
|
||||||
<string name="averageStride">Average Stride</string>
|
<string name="averageStride">Average Stride</string>
|
||||||
|
<string name="maxStride">Max Stride</string>
|
||||||
|
<string name="minStride">Min Stride</string>
|
||||||
|
<string name="averageCadence">Average Cadence</string>
|
||||||
|
<string name="maxCadence">Max Cadence</string>
|
||||||
|
<string name="minCadence">Min Cadence</string>
|
||||||
<string name="averageStrokeDistance">Average Stroke Distance</string>
|
<string name="averageStrokeDistance">Average Stroke Distance</string>
|
||||||
<string name="averageStrokesPerSecond">Average Strokes</string>
|
<string name="averageStrokesPerSecond">Average Strokes</string>
|
||||||
<string name="averageLapPace">Average Lap Pace</string>
|
<string name="averageLapPace">Average Lap Pace</string>
|
||||||
@ -1154,6 +1163,7 @@
|
|||||||
<string name="seconds_km">sec/km</string>
|
<string name="seconds_km">sec/km</string>
|
||||||
<string name="seconds_m">sec/m</string>
|
<string name="seconds_m">sec/m</string>
|
||||||
<string name="minutes_km">min/km</string>
|
<string name="minutes_km">min/km</string>
|
||||||
|
<string name="spm">steps/min</string>
|
||||||
<string name="bpm">bpm</string>
|
<string name="bpm">bpm</string>
|
||||||
<string name="km">km</string>
|
<string name="km">km</string>
|
||||||
<string name="mi">mi</string>
|
<string name="mi">mi</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user