Removing redundant linear acceleration virtual sensor events 57/35857/4
authorVibhor Gaur <vibhor.gaur@samsung.com>
Wed, 25 Feb 2015 11:16:46 +0000 (16:46 +0530)
committerVibhor Gaur <vibhor.gaur@samsung.com>
Thu, 26 Feb 2015 12:34:25 +0000 (18:04 +0530)
Removed redundant linear acceleration virtual sensor events LINEAR_ACCEL_BASE_DATA_SET and LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME which were the same. These have been moved to the sensor_deprecated folder.
LINEAR_ACCEL_BASE_DATA_SET was used for polling events and LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME was used for event driven.
Since both these represent the same linear acceleration virtual sensor event, DATA_SET type has been removed.
LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME has been renamed to LINEAR_ACCEL_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: Ib0603a497ef5132917aa46d9c4055bf1377dfb68

src/libsensord/client_common.cpp
src/libsensord/sensor_deprecated.h
src/libsensord/sensor_linear_accel.h
src/linear_accel/linear_accel_sensor.cpp
src/server/command_worker.cpp
test/src/auto_test.c
test/src/tc-common.c

index 9733d9d..cda167c 100755 (executable)
@@ -58,7 +58,7 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_EVENT, LIGHT_LEVEL_DATA_EVENT, 0, 10),
        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, LINEAR_ACCEL_RAW_DATA_EVENT, 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),
@@ -67,7 +67,6 @@ log_element g_log_elements[] = {
        FILL_LOG_ELEMENT(LOG_ID_EVENT, GAMING_RV_RAW_DATA_EVENT, 0, 10),
 
        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),
 };
 
 typedef unordered_map<unsigned int, log_attr* > log_map;
@@ -150,7 +149,7 @@ bool is_ontime_event(unsigned int event_type)
        case LIGHT_LUX_DATA_EVENT:
        case PROXIMITY_DISTANCE_DATA_EVENT:
        case GRAVITY_RAW_DATA_EVENT:
-       case LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME:
+       case LINEAR_ACCEL_RAW_DATA_EVENT:
        case ORIENTATION_RAW_DATA_EVENT:
        case PRESSURE_RAW_DATA_EVENT:
                return true;
index aee52eb..011d12b 100644 (file)
@@ -80,6 +80,9 @@ extern "C"
 #define ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME ORIENTATION_RAW_DATA_EVENT
 #define ORIENTATION_EVENT_CALIBRATION_NEEDED ORIENTATION_CALIBRATION_NEEDED_EVENT
 
+#define LINEAR_ACCEL_BASE_DATA_SET LINEAR_ACCEL_RAW_DATA_EVENT
+#define LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME LINEAR_ACCEL_RAW_DATA_EVENT
+
 enum accelerometer_rotate_state {
        ROTATION_UNKNOWN = 0,
        ROTATION_LANDSCAPE_LEFT = 1,
index d4369c0..306d1d6 100755 (executable)
@@ -36,12 +36,8 @@ extern "C"
  * @{
  */
 
-enum linear_accel_data_id {
-       LINEAR_ACCEL_BASE_DATA_SET                              = (LINEAR_ACCEL_SENSOR << 16) | 0x0001,
-};
-
 enum linear_accel_event_type {
-       LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME                                      = (LINEAR_ACCEL_SENSOR << 16) | 0x0001,
+       LINEAR_ACCEL_RAW_DATA_EVENT     = (LINEAR_ACCEL_SENSOR << 16) | 0x0001,
 };
 
 /**
index 3ccc8d5..fe2d608 100755 (executable)
@@ -62,7 +62,7 @@ linear_accel_sensor::linear_accel_sensor()
 
        m_name = string(SENSOR_NAME);
        m_enable_linear_accel = 0;
-       register_supported_event(LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME);
+       register_supported_event(LINEAR_ACCEL_RAW_DATA_EVENT);
 
 
        if (!config.get(SENSOR_TYPE_LINEAR_ACCEL, ELEMENT_VENDOR, m_vendor)) {
@@ -231,7 +231,7 @@ void linear_accel_sensor::synthesize(const sensor_event_t &event, vector<sensor_
 
                m_time = get_timestamp();
                lin_accel_event.sensor_id = get_id();
-               lin_accel_event.event_type = LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME;
+               lin_accel_event.event_type = LINEAR_ACCEL_RAW_DATA_EVENT;
                lin_accel_event.data.value_count = 3;
                lin_accel_event.data.timestamp = m_time;
                lin_accel_event.data.accuracy = SENSOR_ACCURACY_GOOD;
@@ -254,7 +254,7 @@ int linear_accel_sensor::get_sensor_data(const unsigned int event_type, sensor_d
        accel_data.values[1] = m_accel_rotation_direction_compensation[1] * (accel_data.values[1] - m_accel_static_bias[1]) / m_accel_scale;
        accel_data.values[2] = m_accel_rotation_direction_compensation[2] * (accel_data.values[2] - m_accel_static_bias[2]) / m_accel_scale;
 
-       if (event_type != LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME)
+       if (event_type != LINEAR_ACCEL_RAW_DATA_EVENT)
                return -1;
 
        data.accuracy = SENSOR_ACCURACY_GOOD;
index d30ca37..19965a0 100755 (executable)
@@ -850,7 +850,7 @@ csensor_event_dispatcher& command_worker::get_event_dispathcher(void)
 void insert_priority_list(unsigned int event_type)
 {
        if (event_type == ORIENTATION_RAW_DATA_EVENT ||
-                       event_type == LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME ||
+                       event_type == LINEAR_ACCEL_RAW_DATA_EVENT ||
                        event_type == GRAVITY_RAW_DATA_EVENT ||
                        event_type == ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME) {
                priority_list.insert(ACCELEROMETER_RAW_DATA_EVENT);
index f3d12be..6bb0d29 100644 (file)
@@ -214,7 +214,7 @@ int main(int argc, char **argv)
        result = check_sensor_api(LIGHT_LUX_DATA_EVENT, interval);
        fprintf(fp, "Light - RAW_DATA_REPORT_ON_TIME - %d\n", result);
 
-       result = check_sensor_api(LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME, interval);
+       result = check_sensor_api(LINEAR_ACCEL_RAW_DATA_EVENT, interval);
        fprintf(fp, "Linear Accel - RAW_DATA_REPORT_ON_TIME - %d\n", result);
 
        result = check_sensor_api(ORIENTATION_RAW_DATA_EVENT, interval);
index 8130665..ce39702 100644 (file)
@@ -100,7 +100,7 @@ unsigned int get_event_driven(sensor_type_t sensor_type, char str[])
                break;
        case LINEAR_ACCEL_SENSOR:
                if (strcmp(str, "RAW_DATA_REPORT_ON_TIME") == 0)
-                       return LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME;
+                       return LINEAR_ACCEL_RAW_DATA_EVENT;
                break;
        case ROTATION_VECTOR_SENSOR:
                if (strcmp(str, "RAW_DATA_REPORT_ON_TIME") == 0)
@@ -213,7 +213,7 @@ int main(int argc, char **argv)
        }
        else if (strcmp(argv[1], "linear_accel") == 0) {
                 sensor_type = LINEAR_ACCEL_SENSOR;
-                event = LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME;
+                event = LINEAR_ACCEL_RAW_DATA_EVENT;
        }
        else if (strcmp(argv[1], "rotation_vector") == 0) {
                 sensor_type = ROTATION_VECTOR_SENSOR;