I am trying to develop a watch face that uses heart rate and pedometer information, I have searched all over here and can't figure out how to fix my problem.
I have included <sensor.h> and set http://tizen.org/prialege/healthifo privalege
The problem i am having is when I run
sensor_get_default_sensor(SENSOR_HRM, &sensorHanlder);
for either the pedometer or the heart rate monitor, it returns -13 (Permission Denied) and I cant figure out anything regarding how to fix that. I also tride using
sensor_get_default_sensor_by_uri("http://tizen.org/sensor/healthinfo/human_pedometer", &sensorHandler);
and it gives me the same error.
I have gotten this same code working for the accelerometer, so It is structured right for at least some sensors.
I am running tizen 4.0 with the emulator and on my galaxy watch and get the same results. any help would be greatly appreciated
the following is the section of code I am using (from example code from this site):
float hrnow; int success; bool checkSupport(sensor_type_e type){ bool support; sensor_is_supported(type,&support); return support; } //for heart rate monitor void sensorEventCallBack(sensor_h sensorHanlder, sensor_event_s *event, void *user_data){ sensor_type_e type; sensor_get_type(sensorHanlder, &type); switch (type) { case SENSOR_HRM: dlog_print(DLOG_DEBUG, LOG_TAG, "SENSOR_HRM data: %.2f", event->values[0]); hr_now = event->values[0]; break; default: dlog_print(DLOG_ERROR, LOG_TAG, "Not an HRM event"); } } void logPrintSensorData(appdata_s *ad){ if(checkSupport(SENSOR_HRM)){ sensor_h sensorHandler; success = sensor_get_default_sensor(SENSOR_HRM, &sensorHanlder); // success = sensor_get_default_sensor_by_uri("http://tizen.org/sensor/healthinfo/human_pedometer", &sensorHandler); sensor_listener_h sensorListener; sensor_create_listener(sensorHandler,&sensorListener); sensor_listener_set_event_cb(sensorListener,1000, sensorEventCallBack, NULL); sensor_listener_set_option(sensorListener,SENSOR_OPTION_ALWAYS_ON); sensor_listener_start(sensorListener); /* Once Task Completed*/ //sensor_listener_stop(sensorListener); } else { dlog_print(DLOG_ERROR, LOG_TAG, "SENSOR_HRM Not Supported"); } }