, m_thread_state(THREAD_STATE_TERMINATE)
, m_hup_observer(NULL)
, m_client_info(sensor_client_info::get_instance())
+, m_axis(SENSORD_AXIS_DEVICE_ORIENTED)
, m_display_rotation(AUTO_ROTATION_DEGREE_UNKNOWN)
{
}
return m_client_info.is_event_active(cb_info->handle, cb_info->event_type, cb_info->event_id);
}
+void sensor_event_listener::set_sensor_axis(int axis)
+{
+ m_axis = axis;
+}
+
void sensor_event_listener::align_sensor_axis(sensor_t sensor, sensor_data_t *data)
{
sensor_type_t type = sensor_to_sensor_info(sensor)->get_type();
- if (type != ACCELEROMETER_SENSOR && type != GYROSCOPE_SENSOR && type != GRAVITY_SENSOR)
+ if (m_axis != SENSORD_AXIS_DISPLAY_ORIENTED)
+ return;
+
+ if (type != ACCELEROMETER_SENSOR && type != GYROSCOPE_SENSOR && type != GRAVITY_SENSOR && type != LINEAR_ACCEL_SENSOR)
return;
float x, y;
if (cb_info->accuracy_cb)
cb_info->accuracy_cb(cb_info->sensor, cb_info->timestamp, cb_info->accuracy, cb_info->accuracy_user_data);
- ((sensor_cb_t) cb_info->cb)(cb_info->sensor, cb_info->event_type, (sensor_data_t *) cb_info->sensor_data.get(), cb_info->user_data);
+ sensor_event_listener::get_instance().align_sensor_axis(cb_info->sensor, (sensor_data_t *)cb_info->sensor_data.get());
+ ((sensor_cb_t) cb_info->cb)(cb_info->sensor, cb_info->event_type, (sensor_data_t *)cb_info->sensor_data.get(), cb_info->user_data);
delete cb_info;
void clear(void);
void set_hup_observer(hup_observer_t observer);
+
+ void set_sensor_axis(int axis);
void set_display_rotation(int rt);
private:
sensor_client_info &m_client_info;
/* WC1's rotation control */
+ /* SENSORD_AXIS_DEVICE_ORIENTED, SENSORD_AXIS_DISPLAY_ORIENTED */
+ int m_axis;
int m_display_rotation;
sensor_event_listener();