Removing redundant auto_rotation events 76/35776/8
authorAnkur <ankur29.garg@samsung.com>
Thu, 26 Feb 2015 12:00:27 +0000 (17:30 +0530)
committerAnkur <ankur29.garg@samsung.com>
Thu, 26 Feb 2015 12:00:34 +0000 (17:30 +0530)
AUTO_ROTATION_BASE_DATA_SET and AUTO_ROTATION_EVENT_CHANGE_STATE were the same
AUTO_ROTATION_BASE_DATA_SET has been removed.

AUTO_ROTATION_BASE_DATA_SET was used for polling events and AUTO_ROTATION__EVENT_CHANGE_STATE was used for event driven
Since both these represent the same auto_rotation sensor event, DATA_SET type has been removed.

And AUTO_ROTATION_EVENT_CHANGE_STATE has been renamed to AUTO_ROTATION_CHANGE_STATE_EVENT to make it simpler.

Change-Id: I8523af6c00dd2919bb6b9f0606c48d5df37ff0c9

src/auto_rotation/auto_rotation_sensor.cpp
src/libsensord/client_common.cpp
src/libsensord/sensor_auto_rotation.h
src/libsensord/sensor_deprecated.h

index cdf7609..381e861 100755 (executable)
@@ -49,7 +49,7 @@ auto_rotation_sensor::auto_rotation_sensor()
 {
        m_name = string(SENSOR_NAME);
 
-       register_supported_event(AUTO_ROTATION_EVENT_CHANGE_STATE);
+       register_supported_event(AUTO_ROTATION_CHANGE_STATE_EVENT);
 }
 
 auto_rotation_sensor::~auto_rotation_sensor()
@@ -146,7 +146,7 @@ void auto_rotation_sensor::synthesize(const sensor_event_t& event, vector<sensor
                INFO("Rotation: %d, ACC[0]: %f, ACC[1]: %f, ACC[2]: %f", rotation, event.data.values[0], event.data.values[1], event.data.values[2]);
                rotation_event.sensor_id = get_id();
                rotation_event.data.accuracy = SENSOR_ACCURACY_GOOD;
-               rotation_event.event_type = AUTO_ROTATION_EVENT_CHANGE_STATE;
+               rotation_event.event_type = AUTO_ROTATION_CHANGE_STATE_EVENT;
                rotation_event.data.timestamp = event.data.timestamp;
                rotation_event.data.values[0] = rotation;
                rotation_event.data.value_count = 1;
@@ -161,7 +161,7 @@ void auto_rotation_sensor::synthesize(const sensor_event_t& event, vector<sensor
 
 int auto_rotation_sensor::get_sensor_data(unsigned int data_id, sensor_data_t &data)
 {
-       if (data_id != AUTO_ROTATION_BASE_DATA_SET)
+       if (data_id != AUTO_ROTATION_CHANGE_STATE_EVENT)
                return -1;
 
        AUTOLOCK(m_value_mutex);
index 361351b..6e5bfe7 100755 (executable)
@@ -50,7 +50,7 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_STATE_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, PROXIMITY_DISTANCE_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, CONTEXT_EVENT_REPORT, 0, 1),
-       FILL_LOG_ELEMENT(LOG_ID_EVENT, AUTO_ROTATION_EVENT_CHANGE_STATE, 0, 1),
+       FILL_LOG_ELEMENT(LOG_ID_EVENT, AUTO_ROTATION_CHANGE_STATE_EVENT, 0, 1),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, ACCELEROMETER_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, GYROSCOPE_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, GEOMAGNETIC_RAW_DATA_EVENT, 0, 10),
@@ -69,7 +69,6 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_DATA, LIGHT_BASE_DATA_SET, 0, 25),
        FILL_LOG_ELEMENT(LOG_ID_DATA, LIGHT_LUX_DATA_SET, 0, 25),
        FILL_LOG_ELEMENT(LOG_ID_DATA, CONTEXT_BASE_DATA_SET, 0, 25),
-       FILL_LOG_ELEMENT(LOG_ID_DATA, AUTO_ROTATION_BASE_DATA_SET, 0, 25),
        FILL_LOG_ELEMENT(LOG_ID_DATA, GRAVITY_BASE_DATA_SET, 0, 25),
        FILL_LOG_ELEMENT(LOG_ID_DATA, LINEAR_ACCEL_BASE_DATA_SET, 0, 25),
        FILL_LOG_ELEMENT(LOG_ID_DATA, ORIENTATION_BASE_DATA_SET, 0, 25),
@@ -176,7 +175,7 @@ bool is_single_state_event(unsigned int event_type)
        case GEOMAGNETIC_CALIBRATION_NEEDED_EVENT:
        case LIGHT_EVENT_CHANGE_LEVEL:
        case PROXIMITY_CHANGE_STATE_EVENT:
-       case AUTO_ROTATION_EVENT_CHANGE_STATE:
+       case AUTO_ROTATION_CHANGE_STATE_EVENT:
                return true;
                break;
        }
index 752f13d..1f717c5 100755 (executable)
@@ -36,12 +36,8 @@ extern "C"
  * @{
  */
 
-enum auto_rotation_data_id {
-       AUTO_ROTATION_BASE_DATA_SET     = (AUTO_ROTATION_SENSOR << 16) | 0x0001,
-};
-
 enum auto_rotation_event_type {
-       AUTO_ROTATION_EVENT_CHANGE_STATE = (AUTO_ROTATION_SENSOR << 16) | 0x0001,
+       AUTO_ROTATION_CHANGE_STATE_EVENT = (AUTO_ROTATION_SENSOR << 16) | 0x0001,
 };
 
 enum auto_rotation_state {
index 7237789..da7fd94 100644 (file)
@@ -64,6 +64,9 @@ extern "C"
 #define GEOMAGNETIC_EVENT_CALIBRATION_NEEDED GEOMAGNETIC_CALIBRATION_NEEDED_EVENT
 #define GEOMAGNETIC_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME GEOMAGNETIC_UNPROCESSED_DATA_EVENT
 
+#define AUTO_ROTATION_BASE_DATA_SET AUTO_ROTATION_CHANGE_STATE_EVENT
+#define AUTO_ROTATION_EVENT_CHANGE_STATE AUTO_ROTATION_CHANGE_STATE_EVENT
+
 enum accelerometer_rotate_state {
        ROTATION_UNKNOWN = 0,
        ROTATION_LANDSCAPE_LEFT = 1,