sensor interval can’t be re-set

sensor interval can’t be re-set

BY 26 Sep 2017 Native Application Development

I’m using the Sensor API to record accelerometer and gyroscope data. When I first set up my sensor callbacks, I pass in an interval in ms, e.g:

sensor_listener_set_event_cb(m_listener, interval, cb, this);

where interval is either 10 (for 100Hz data) or 20 (for 50Hz data).  When I’m done recording, I stop the listener and unset the callback with sensor_listener_unset_event_cb().

This works the first time through, but I’m finding that after I call this once, in any future calls, the value of the interval is ignored.  So for example, if the first time I want to record data, I do it at 50Hz, then any time I record data after that, it will also be at 50Hz, even if I explicitly set the interval to 10 to record at 100 Hz.  Likewise, if I record at 100Hz the first time, I can never record at 50Hz after that.

I’ve tried also calling sensor_listener_set_interval(), but this also has no effect.

This is on a Gear S2 running Tizen 2.3.1.

Has anyone else seen this behavior?  Is this a bug in the SDK?

Written by