realg = (double)sqrt((x * x) + (y * y) + (z * z));
acc_pitch = ROTATION_90 - abs((int) (asin(z / realg) * RADIAN));
- cur_rotation = convert_rotation(prev_rotation, acc_pitch, acc_theta);
+ int new_rotation = convert_rotation(prev_rotation, acc_pitch, acc_theta);
- if (cur_rotation == AUTO_ROTATION_DEGREE_UNKNOWN)
+ if (new_rotation == AUTO_ROTATION_DEGREE_UNKNOWN) {
+ if (prev_rotation == AUTO_ROTATION_DEGREE_UNKNOWN) {
+ cur_rotation = AUTO_ROTATION_DEGREE_0; /* default degree is 0 */
+ return true;
+ }
return false;
+ }
- if (cur_rotation != prev_rotation)
+ if (new_rotation != prev_rotation) {
+ cur_rotation = new_rotation;
return true;
+ }
return false;
}
#include <command_types.h>
#include <sensor_listener_proxy.h>
+#define AUTO_ROTATION "http://tizen.org/sensor/general/auto_rotation/tizen_default"
+
using namespace sensor;
sensor_handler::sensor_handler(const sensor_info &info)
*len = size;
*data = (sensor_data_t *)temp;
- m_sensor_data_cache.clear();
+ if (m_info.get_uri() != AUTO_ROTATION)
+ m_sensor_data_cache.clear();
+
return 0;
}