Languages

Menu
Sites
Language
Stress Sensor callback does not work.
   

Hello. 

I am developing a native app in Samsung Galaxy Watch (ModelName : SM-R800, Tizen software version 4.0.0.1)

It is using a stress monitor sensor. However, the functionally provided by the Tizen Platform does not work.

HRM or other sensor is not problem. (callback function is called.)

There are no examples of SENSOR_HUMAN_STRESS_MONITOR on Tizen website and Samsung developer website.

SENSOR_HUMAN_STRESS_MONITOR is different usage? Or is the API not yet implemented?

Thanks.


#include <sensor.h>

sensor_listener_h listener_for_stressmonitor_to_save;
stressmonitor_user_data_h stressmonitor_data_to_save;

void stressmonitor_to_save_cb(sensor_h sensor, sensor_event_s *event, void *user_data)
{
    dlog_print(DLOG_DEBUG, LOG_TAG, "stressmonitor_to_save_cb called\n");
}

void add_stressmonitor_listener() {
    sensor_h sensor;
    sensor_type_e type = SENSOR_HUMAN_STRESS_MONITOR;

    sensor_get_default_sensor(type, &sensor);

    bool sensor_supported = false;
    int result = -1;

    result = sensor_is_supported(type, &sensor_supported);
    dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_is_supported ?? %s", sensor_supported == true ? "true" : "false");

    result = sensor_create_listener(sensor, &listener_for_stressmonitor_to_save);
    dlog_print(DLOG_DEBUG, LOG_TAG, "sensor_create_listener=%d\n", ret);

    /* Set a changed CB */
    sensor_listener_set_event_cb(listener_for_stressmonitor_to_save, 200, stressmonitor_to_save_cb, NULL);
    sensor_listener_set_option(listener_for_stressmonitor_to_save, SENSOR_OPTION_ALWAYS_ON);
    sensor_listener_set_attribute_int(listener_for_stressmonitor_to_save, SENSOR_ATTRIBUTE_PAUSE_POLICY, SENSOR_PAUSE_NONE);

    if(SENSOR_ERROR_NONE == sensor_listener_start(listener_for_stressmonitor_to_save)) {
        dlog_print(DLOG_DEBUG, LOG_TAG, "Success start\n");
    }
}
 

 

Responses

1 Replies
chua enze

Hi, did you manage to solve this issue?