Removed redundant orientation virtual sensor events 51/35851/5
authorVibhor Gaur <vibhor.gaur@samsung.com>
Wed, 25 Feb 2015 10:36:58 +0000 (16:06 +0530)
committerVibhor Gaur <vibhor.gaur@samsung.com>
Thu, 26 Feb 2015 12:31:14 +0000 (18:01 +0530)
Removed redundant orientation events ORIENTATION_BASE_DATA_SET and ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME which were the same.
These have been moved to the sensor_deprecated folder.
ORIENTATION_BASE_DATA_SET was used for polling events and ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME was used for event driven Since both these represent the same orientation virtual sensor event, DATA_SET type has been removed.
ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME has been renamed to ORIENTATION_RAW_DATA_EVENT to make it simpler.
The change has been tested on rd-pq device for all sensord API and all API were found to be working

Change-Id: Iac7080cef6483b4fcaf5a454739ab1be50a57d23

src/gravity/gravity_sensor.cpp
src/libsensord/client_common.cpp
src/libsensord/sensor_deprecated.h
src/libsensord/sensor_orientation.h
src/orientation/orientation_sensor.cpp
src/server/command_worker.cpp
test/src/auto_test.c
test/src/tc-common.c

index 8fa44f2..d6dc7d7 100755 (executable)
@@ -125,7 +125,7 @@ bool gravity_sensor::on_start(void)
 {
        AUTOLOCK(m_mutex);
 
-       m_orientation_sensor->add_client(ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME);
+       m_orientation_sensor->add_client(ORIENTATION_RAW_DATA_EVENT);
        m_orientation_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false);
        m_orientation_sensor->start();
 
@@ -137,7 +137,7 @@ bool gravity_sensor::on_stop(void)
 {
        AUTOLOCK(m_mutex);
 
-       m_orientation_sensor->delete_client(ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME);
+       m_orientation_sensor->delete_client(ORIENTATION_RAW_DATA_EVENT);
        m_orientation_sensor->delete_interval((intptr_t)this, false);
        m_orientation_sensor->stop();
 
@@ -178,7 +178,7 @@ void gravity_sensor::synthesize(const sensor_event_t &event, vector<sensor_event
                roll *= DEG2RAD;
        }
 
-       if (event.event_type == ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME) {
+       if (event.event_type == ORIENTATION_RAW_DATA_EVENT) {
                diff_time = event.data.timestamp - m_time;
 
                if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR))
@@ -216,7 +216,7 @@ int gravity_sensor::get_sensor_data(const unsigned int event_type, sensor_data_t
        sensor_data_t orientation_data;
        float pitch, roll, azimuth;
 
-       m_orientation_sensor->get_sensor_data(ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME, orientation_data);
+       m_orientation_sensor->get_sensor_data(ORIENTATION_RAW_DATA_EVENT, orientation_data);
 
        azimuth = orientation_data.values[0];
        pitch = orientation_data.values[1];
index 5b7eb35..9733d9d 100755 (executable)
@@ -59,7 +59,7 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_EVENT, LIGHT_LUX_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, GRAVITY_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
-       FILL_LOG_ELEMENT(LOG_ID_EVENT, ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
+       FILL_LOG_ELEMENT(LOG_ID_EVENT, ORIENTATION_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, PRESSURE_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, TEMPERATURE_RAW_DATA_EVENT, 0, 10),
        FILL_LOG_ELEMENT(LOG_ID_EVENT, ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME, 0, 10),
@@ -68,7 +68,6 @@ log_element g_log_elements[] = {
 
        FILL_LOG_ELEMENT(LOG_ID_DATA, CONTEXT_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),
 };
 
 typedef unordered_map<unsigned int, log_attr* > log_map;
@@ -152,7 +151,7 @@ bool is_ontime_event(unsigned int event_type)
        case PROXIMITY_DISTANCE_DATA_EVENT:
        case GRAVITY_RAW_DATA_EVENT:
        case LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME:
-       case ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME:
+       case ORIENTATION_RAW_DATA_EVENT:
        case PRESSURE_RAW_DATA_EVENT:
                return true;
                break;
@@ -190,7 +189,7 @@ unsigned int get_calibration_event_type(unsigned int event_type)
        case GEOMAGNETIC_SENSOR:
                return GEOMAGNETIC_CALIBRATION_NEEDED_EVENT;
        case ORIENTATION_SENSOR:
-               return ORIENTATION_EVENT_CALIBRATION_NEEDED;
+               return ORIENTATION_CALIBRATION_NEEDED_EVENT;
        default:
                return 0;
        }
index 3f751b4..aee52eb 100644 (file)
@@ -76,6 +76,10 @@ extern "C"
 #define GRAVITY_BASE_DATA_SET GRAVITY_RAW_DATA_EVENT
 #define GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME GRAVITY_RAW_DATA_EVENT
 
+#define ORIENTATION_BASE_DATA_SET ORIENTATION_RAW_DATA_EVENT
+#define ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME ORIENTATION_RAW_DATA_EVENT
+#define ORIENTATION_EVENT_CALIBRATION_NEEDED ORIENTATION_CALIBRATION_NEEDED_EVENT
+
 enum accelerometer_rotate_state {
        ROTATION_UNKNOWN = 0,
        ROTATION_LANDSCAPE_LEFT = 1,
index ecc2d2e..5852e17 100755 (executable)
@@ -36,13 +36,9 @@ extern "C"
  * @{
  */
 
-enum orientation_data_id {
-       ORIENTATION_BASE_DATA_SET                               = (ORIENTATION_SENSOR << 16) | 0x0001,
-};
-
 enum orientation_event_type {
-       ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME               = (ORIENTATION_SENSOR << 16) | 0x0001,
-       ORIENTATION_EVENT_CALIBRATION_NEEDED                    = (ORIENTATION_SENSOR << 16) | 0x0002,
+       ORIENTATION_RAW_DATA_EVENT      = (ORIENTATION_SENSOR << 16) | 0x0001,
+       ORIENTATION_CALIBRATION_NEEDED_EVENT    = (ORIENTATION_SENSOR << 16) | 0x0002,
 };
 
 /**
index 355ac12..708ca92 100755 (executable)
@@ -83,7 +83,7 @@ orientation_sensor::orientation_sensor()
        cvirtual_sensor_config &config = cvirtual_sensor_config::get_instance();
 
        m_name = string(SENSOR_NAME);
-       register_supported_event(ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME);
+       register_supported_event(ORIENTATION_RAW_DATA_EVENT);
        m_enable_orientation = 0;
 
        if (!config.get(SENSOR_TYPE_ORIENTATION, ELEMENT_VENDOR, m_vendor)) {
@@ -355,7 +355,7 @@ void orientation_sensor::synthesize(const sensor_event_t &event, vector<sensor_e
                m_time = get_timestamp();
 
                orientation_event.sensor_id = get_id();
-               orientation_event.event_type = ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME;
+               orientation_event.event_type = ORIENTATION_RAW_DATA_EVENT;
                orientation_event.data.accuracy = SENSOR_ACCURACY_GOOD;
                orientation_event.data.timestamp = m_time;
                orientation_event.data.value_count = 3;
@@ -385,7 +385,7 @@ int orientation_sensor::get_sensor_data(const unsigned int event_type, sensor_da
        euler_angles<float> euler_orientation;
        float azimuth_offset;
 
-       if (event_type != ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME)
+       if (event_type != ORIENTATION_RAW_DATA_EVENT)
                return -1;
 
        m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data);
index a467b39..d30ca37 100755 (executable)
@@ -849,7 +849,7 @@ csensor_event_dispatcher& command_worker::get_event_dispathcher(void)
 
 void insert_priority_list(unsigned int event_type)
 {
-       if (event_type == ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME ||
+       if (event_type == ORIENTATION_RAW_DATA_EVENT ||
                        event_type == LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME ||
                        event_type == GRAVITY_RAW_DATA_EVENT ||
                        event_type == ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME) {
index fdf0e1c..f3d12be 100644 (file)
@@ -217,7 +217,7 @@ int main(int argc, char **argv)
        result = check_sensor_api(LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME, interval);
        fprintf(fp, "Linear Accel - RAW_DATA_REPORT_ON_TIME - %d\n", result);
 
-       result = check_sensor_api(ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME, interval);
+       result = check_sensor_api(ORIENTATION_RAW_DATA_EVENT, interval);
        fprintf(fp, "Orientation - RAW_DATA_REPORT_ON_TIME - %d\n", result);
 
        result = check_sensor_api(PRESSURE_RAW_DATA_EVENT, interval);
index 2d0fa0a..8130665 100644 (file)
@@ -92,7 +92,7 @@ unsigned int get_event_driven(sensor_type_t sensor_type, char str[])
                break;
        case ORIENTATION_SENSOR:
                if (strcmp(str, "RAW_DATA_REPORT_ON_TIME") == 0)
-                       return ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME;
+                       return ORIENTATION_RAW_DATA_EVENT;
                break;
        case GRAVITY_SENSOR:
                if (strcmp(str, "RAW_DATA_REPORT_ON_TIME") == 0)
@@ -205,7 +205,7 @@ int main(int argc, char **argv)
        }
        else if (strcmp(argv[1], "orientation") == 0) {
                 sensor_type = ORIENTATION_SENSOR;
-                event = ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME;
+                event = ORIENTATION_RAW_DATA_EVENT;
        }
        else if (strcmp(argv[1], "gravity") == 0) {
                 sensor_type = GRAVITY_SENSOR;