[humanactivitymonitor] Fixing rRinterval value in heartRate data 44/179244/3
authorRafal Walczyna <r.walczyna@partner.samsung.com>
Wed, 16 May 2018 12:29:03 +0000 (14:29 +0200)
committerRafal Walczyna <r.walczyna@partner.samsung.com>
Fri, 18 May 2018 09:59:55 +0000 (09:59 +0000)
rRinterval was always 0. This value is now available, but measurement
is not present in unified builds. It was tested on R765 and R600 with
solis binaries and it worked fine.

[verification] AutoTCT - 100% pass

Change-Id: I3c181c53e0832f429774f86277bcaeda4708c0b7
Signed-off-by: Rafal Walczyna <r.walczyna@partner.samsung.com>
src/humanactivitymonitor/humanactivitymonitor_manager.cc

index 22d52b5..9a52f2f 100644 (file)
@@ -1371,15 +1371,18 @@ HumanActivityMonitorManager::HumanActivityMonitorManager()
       return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "To few values of HRM event");
     }
 
-    LOGGER(DEBUG) << "  |- values[0]: " << event->values[0];
-    LOGGER(DEBUG) << "  |- values[1]: " << event->values[1];
+    LOGGER(DEBUG) << "  |- values[0][HR ]: " << event->values[0];
+    LOGGER(DEBUG) << "  |- values[2][RRI]: " << event->values[2];
 
     float hr = floor(event->values[0] + 0.5);  // heart beat rate 0 ~ 220 integer (bpm)
 
-    // there are no public native api for peak to peak interval.
+    // there are no public native api documentation for peak to peak interval.
     // but RRI = (60 / HR) * 1000
-    // or unofficially values[1] is rri (0 ~ 5000 ms)
-    float rri = floor(event->values[1] + 0.5);
+    // @ 18.05.2018
+    // in capi, rri is in values[2], but it is not documented because value can be unstable
+    // and it is not available on all devices. On solis it works fine.
+
+    float rri = floor(event->values[2] + 0.5);  // rr-interval 0 ~ 5000 integer (ms)
 
     data->insert(std::make_pair("heartRate", picojson::value(static_cast<double>(hr))));
     data->insert(std::make_pair("rRInterval", picojson::value(static_cast<double>(rri))));