Hello,
I am trying to retrieve the heart rate value and the RR-interval using the motion API (Samsung Extension).
The device I'm using is Samsung Gear S2.
I have several issues I'm struggling with...
1.
I was able to find some relevant topics in this forum and was able to use the code in the posts to get the heart rate value.
This is that code.
window.webapis.motion.start("HRM", onchangedCB); function onchangedCB(hrmInfo) { time = new Date().getTime() - initial; console.log("[" + time + ", "+ hrmInfo.heartRate + ", " + hrmInfo.rRInterval + "]" ); }
The code above gives me the right heart rate value with the right time in milliseconds,
but the rr-interval value always seem to be zero.
Does anyone know why the rr-inverval isn't giving me the right value?
2.
I also want to write the output to a text file,
So I looked up the filesystem API and tried to start from the top by writing hello world in the sample code.
var documentsDir; tizen.filesystem.resolve("documents", function(result) {documentsDir = result; } ); var testFile = documentsDir.createFile("test.txt"); if (testFile != null) { testFile.openStream("rw", onOpenSuccess, null, "UTF-8"); } function onOpenSuccess(fs) { /* Write HelloWorld to the file */ fs.write("HelloWorld"); /* Move pointer to the beginning */ fs.position = 0; /* Read the file content from the beginning */ fs.read(testFile.fileSize); /* Close the file */ fs.close(); }
This code seems to run fine without any errors, but I can't locate where the file is!
Is the file saved in the watch's internal memory?
3.
And one more question!
The sampling rate of retrieving the heart rate seems to be approximately 100ms.
Can I set the sampling rate into a shorter interval?
I'd really appreciate it if anyone can give help because I am using Tizen and samsung sdk for the first time
and it is giving me a lot of trouble...
Thank you in advance!