语言

Menu
Sites
Language
Gear S2 HRM

Hey guys,

I'd like to create a listener and manually start heart rate monitoring.

When setting up the listener and sensor, it returns error -22 (SENSOR_ERROR_INVALID_PARAMETER). 

I'm using a GearS2 and the recent 2.3.1 SDK.

Not sure what's wrong here, since right now I'm just testing the code from https://developer.tizen.org/development/tutorials/native-application/system/sensor

    sensor_listener_h listener;
    sensor_type_e type = SENSOR_HRM;
    sensor_h sensor;
    sensor_get_default_sensor(type, &sensor);
    sensor_create_listener(sensor, &listener);
    sensor_listener_set_event_cb(listener, 1000, on_sensor_event, user_data);
    sensor_listener_set_interval(listener, 1000);
    sensor_listener_start(listener);

The following features is added to the manifest:

sensor.heart_rate_monitor

 

Thanks in advance!

 

编辑者为: Dominik Fehr 13 10月, 2015

响应

2 回复
Dominik Fehr

Fixed, it required privilege "healthinfo".

Tho now it's only returning zeroes with:(int)event->values[0]

Palitsyna

Hello,

yes, according to the list of Tizen privileges, healthinfo privilege is required to allow the application to read the user's health information gathered by device sensors, such as pedometer or heart rate monitor.

Here you can find Sensor API: https://developer.tizen.org/dev-guide/2.3.1/org.tizen.native.mobile.apireference/group__CAPI__SYSTEM__SENSOR__MODULE.html#gabcbdd30f240a6357e05345c8290738ad

It says that sensor_get_default_sensor() requires healthinfo privilege.