Hi,
for a medical study my goal is to obtain several sensor data (HRM, RR Intervall, Light, Pressure, Movement) and save them with the current time to a .txt file.
So far everything was working till I implemented the part to save the data. I could use the method for one sensor and then the app began to lag, if I try to save more than one sensor value, the app stops working completly. To save, I use the following code:
function getHRM() {
var hrm = 0.0;
var rrintervall;
function onGetSuccessCB(hrmInfo) {
hrm = hrmInfo.heartRate;
console.log(hrm);
document.getElementById('hrm').innerHTML = ('hrm: ' + hrm + "<br />");
rrintervall = hrmInfo.rRInterval;
console.log(rrintervall);
document.getElementById('rr-value').innerHTML = ('rr: ' + rrintervall + "<br />");
tizen.filesystem.resolve("documents", function(dir)
{
file = dir.resolve("hrm.txt");
file.openStream(
"a",
function(fs) {
fs.write(" " + hrm + " "+ tizen.time.getCurrentDateTime().toLocaleString()+";");
fs.close();
}, function(e) {
console.log("Error " + e.message);
}, "UTF-8");
});
}
tizen.humanactivitymonitor.start('HRM', onGetSuccessCB);
}
Also I realized, that the app is not saving any data when the screen is turned off. Before saving the data, it was that, when the screen was turned off and I switched it on again, it felt like, the app was "rushing" through the values from the time when the screen was turned off. After I implemented the saving function I just didn't record any background data.
Any ideas, what causes the problems? I read somewhere that it is not possible to record the data in the background without programming it in C but I could't verify it so far, is that true?
I'm glad for every help, thanks.