Languages

Menu
Sites
Language
HRM sensor data recording

Hello, I am trying to develop an application that records the heart rate data (beat by beat data) along with timestamps and stores it locally, and also has the functionality to send that file to a mobile application. I have been able to use the HRM sensor in my application and view the current heart rate; however, attempting to use the sensor_recorder_start and sensor_recorder_stop function causes my application to force close. I used the pedometer recording example by modifying it for the heart rate monitor sensor and leaving everything else the same:

 bool support = false;

    sensor_recorder_is_supported(SENSOR_HRM, &support);
    if (!support) {
        /* HRM is not supported or cannot be recorded on the current device */
    }

    sensor_recorder_option_h option;

    sensor_recorder_create_option(&option);
    /* 720 hours (30 days) */
    sensor_recorder_option_set_int(option, SENSOR_RECORDER_OPTION_RETENTION_PERIOD, 30*24);

    sensor_recorder_start(SENSOR_HRM, option);

    sensor_recorder_stop(SENSOR_HRM);

 

I was wondering if you could help me understand why the application force closes, and what I could do to fix it? Ideally I want to implement it in a way that when the user presses start and the void _sensor_start_cb is invoked, the sensor_recorder_start is implemented, and when the user presses stop and the void _sensor_stop_cb is invoked, the sensor_recorder_stop is implemented. I attempted this implementation and my application force closed as well. I am developing on tizen 2.3.2 and my target device is gear fit 2. This is for a research project for George Mason University and any help would be greatly appreciated.

Edited by: Ashraf Ansary on 19 Apr, 2018

Responses

3 Replies
K Johnson

What are the values sensor_recorder_start() and sensor_recorder_stop() functions returning? Would you please share here?

Ashraf Ansary

Hello, I was able to do it in a different way. I stored the values in a character array and wrote the arrays in a local text file. I appreciate the response though. As for the sensor_recorder functions not working, I guessed it was because the HRM sensor does not support recording - in the example it does say not all sensors support recording (I never actually saw what they returned, which I should have done in hindsight). And this was probably a better way to implement for me since i needed the heart rate data and the time stamp for that data as well, and i need to be able to extract it later on.

K Johnson

That sounds great! Would you please share code snippets relevant to your work(if possible) so that it can come to help to other people facing similar scenario? I guess you've started listening HRM data and continued it for a certain time interval. After that stopped listening and stored data in to an array and then continued updating a text file along with. Am I right? 

However, how about using sqlite database instead of storing data into array and updating local text file according to array data?