From f076e298cb762677d7d8a179c43f51df5780c379 Mon Sep 17 00:00:00 2001 From: Vibhor Gaur Date: Wed, 25 Feb 2015 16:46:46 +0530 Subject: [PATCH] Removing redundant linear acceleration virtual sensor events 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 | 5 ++--- src/libsensord/sensor_deprecated.h | 3 +++ src/libsensord/sensor_linear_accel.h | 6 +----- src/linear_accel/linear_accel_sensor.cpp | 6 +++--- src/server/command_worker.cpp | 2 +- test/src/auto_test.c | 2 +- test/src/tc-common.c | 4 ++-- 7 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/libsensord/client_common.cpp b/src/libsensord/client_common.cpp index 9733d9d..cda167c 100755 --- a/src/libsensord/client_common.cpp +++ b/src/libsensord/client_common.cpp @@ -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 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; diff --git a/src/libsensord/sensor_deprecated.h b/src/libsensord/sensor_deprecated.h index aee52eb..011d12b 100644 --- a/src/libsensord/sensor_deprecated.h +++ b/src/libsensord/sensor_deprecated.h @@ -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, diff --git a/src/libsensord/sensor_linear_accel.h b/src/libsensord/sensor_linear_accel.h index d4369c0..306d1d6 100755 --- a/src/libsensord/sensor_linear_accel.h +++ b/src/libsensord/sensor_linear_accel.h @@ -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, }; /** diff --git a/src/linear_accel/linear_accel_sensor.cpp b/src/linear_accel/linear_accel_sensor.cpp index 3ccc8d5..fe2d608 100755 --- a/src/linear_accel/linear_accel_sensor.cpp +++ b/src/linear_accel/linear_accel_sensor.cpp @@ -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