From 709994c3e7fe22d65bb721b65c5b1caa91b39005 Mon Sep 17 00:00:00 2001 From: Ale Martinez Date: Tue, 30 Jun 2020 19:01:50 -0300 Subject: [PATCH] Add muscle mass and bone mass to Withings download Fixes #3497 --- src/Cloud/WithingsDownload.cpp | 4 ++++ src/Cloud/WithingsReading.h | 12 ++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Cloud/WithingsDownload.cpp b/src/Cloud/WithingsDownload.cpp index 9e80a5edb..414c0c4a0 100644 --- a/src/Cloud/WithingsDownload.cpp +++ b/src/Cloud/WithingsDownload.cpp @@ -200,6 +200,8 @@ WithingsDownload::parse(QString text, QList &bodyMeasures) w.fatkg = r.fatkg; w.leankg = r.leankg; w.fatpercent = r.fatpercent; + w.musclekg = r.musclekg; + w.boneskg = r.boneskg; w.source = BodyMeasure::Withings; bodyMeasures.append(w); } @@ -251,6 +253,8 @@ WithingsDownload::jsonDocumentToWithingsReading(QJsonDocument doc) { case 5 : thisReading.leankg = value; break; case 6 : thisReading.fatpercent = value; break; case 8 : thisReading.fatkg = value; break; + case 76: thisReading.musclekg = value; break; + case 88: thisReading.boneskg = value; break; default: break; } } diff --git a/src/Cloud/WithingsReading.h b/src/Cloud/WithingsReading.h index 170c79f46..1d6a8d858 100644 --- a/src/Cloud/WithingsReading.h +++ b/src/Cloud/WithingsReading.h @@ -31,17 +31,11 @@ // found here http://www.withings.com/en/api/bodyscale // -#define WITHINGS_WEIGHT 0 -#define WITHINGS_FATKG 1 -#define WITHINGS_FATPERCENT 2 -#define WITHINGS_LEANKG 3 -#define WITHINGS_HEIGHT 4 - class WithingsReading { public: WithingsReading() : category(0), groupId(0), attribution(0), when(QDateTime()), comment(""), - weightkg(0), fatkg(0), leankg(0), fatpercent(0), sizemeter(0) {} + weightkg(0), fatkg(0), leankg(0), fatpercent(0), sizemeter(0), musclekg(0), boneskg(0) {} int category; // 1 = target, 2 = measurement int groupId; // serialized for synchronizing @@ -54,7 +48,9 @@ public: fatkg, // fat in Kilograms leankg, // lean mass in Kilograms fatpercent, // body fat as a percentage of weight - sizemeter; // height ? + sizemeter, // height + musclekg, // muscle mass (kg) + boneskg; // bone mass (kg) // used by qSort() bool operator< (WithingsReading right) const {