From: Ankur Date: Wed, 18 Feb 2015 10:27:13 +0000 (+0530) Subject: Removing redundant accelerometer events X-Git-Tag: submit/tizen_tv/20150226.040306~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8a764233038e4f8997fee8b515192bf931b586ca;p=platform%2Fcore%2Fsystem%2Fsensord.git Removing redundant accelerometer events ACCELEROMETER_BASE_DATA_SET and ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME were the same ACCELEROMETER_BASE_DATA_SET has been removed. ACCELEROMETER_BASE_DATA_SET was used for polling events and ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME was used for event driven Since both these represent the same accelerometer event, DATA_SET type has been removed. And ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME has been renamed to ACCELEROMETER_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: I7602335045a1847b9ea3e58247b6ddcc82bbda7f --- diff --git a/src/accel/accel_sensor.cpp b/src/accel/accel_sensor.cpp index 8bb436d..1dc28ff 100755 --- a/src/accel/accel_sensor.cpp +++ b/src/accel/accel_sensor.cpp @@ -42,8 +42,8 @@ accel_sensor::accel_sensor() m_name = string(SENSOR_NAME); vector supported_events = { - ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, - ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME, + ACCELEROMETER_RAW_DATA_EVENT, + ACCELEROMETER_UNPROCESSED_DATA_EVENT, }; for_each(supported_events.begin(), supported_events.end(), @@ -104,15 +104,15 @@ bool accel_sensor::process_event(void) AUTOLOCK(m_mutex); AUTOLOCK(m_client_info_mutex); - if (get_client_cnt(ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME)) { + if (get_client_cnt(ACCELEROMETER_UNPROCESSED_DATA_EVENT)) { base_event.sensor_id = get_id(); - base_event.event_type = ACCELEROMETER_EVENT_UNPROCESSED_DATA_REPORT_ON_TIME; + base_event.event_type = ACCELEROMETER_UNPROCESSED_DATA_EVENT; push(base_event); } - if (get_client_cnt(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME)) { + if (get_client_cnt(ACCELEROMETER_RAW_DATA_EVENT)) { base_event.sensor_id = get_id(); - base_event.event_type = ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME; + base_event.event_type = ACCELEROMETER_RAW_DATA_EVENT; raw_to_base(base_event.data); push(base_event); } @@ -152,7 +152,7 @@ int accel_sensor::get_sensor_data(unsigned int type, sensor_data_t &data) return -1; } - if (type == ACCELEROMETER_BASE_DATA_SET) { + if (type == ACCELEROMETER_RAW_DATA_EVENT) { raw_to_base(data); } else { ERR("Does not support type: 0x%x", type); diff --git a/src/auto_rotation/auto_rotation_sensor.cpp b/src/auto_rotation/auto_rotation_sensor.cpp index efefb8b..cdf7609 100755 --- a/src/auto_rotation/auto_rotation_sensor.cpp +++ b/src/auto_rotation/auto_rotation_sensor.cpp @@ -110,7 +110,7 @@ bool auto_rotation_sensor::on_start(void) m_alg->start(); - m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->add_interval((int)this , SAMPLING_TIME, true); m_accel_sensor->start(); @@ -119,7 +119,7 @@ bool auto_rotation_sensor::on_start(void) bool auto_rotation_sensor::on_stop(void) { - m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->delete_interval((int)this , true); m_accel_sensor->stop(); @@ -130,7 +130,7 @@ void auto_rotation_sensor::synthesize(const sensor_event_t& event, vectoradd_interval((intptr_t)this, (m_interval/MS_TO_US), false); m_gravity_sensor->start(); - m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false); m_accel_sensor->start(); @@ -165,7 +165,7 @@ bool linear_accel_sensor::on_stop(void) m_gravity_sensor->delete_interval((intptr_t)this, false); m_gravity_sensor->stop(); - m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->delete_interval((intptr_t)this, false); m_accel_sensor->stop(); @@ -197,7 +197,7 @@ void linear_accel_sensor::synthesize(const sensor_event_t &event, vectorget_sensor_data(GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME, gravity_data); - m_accel_sensor->get_sensor_data(ACCELEROMETER_BASE_DATA_SET, accel_data); + m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data); accel_data.values[0] = m_accel_rotation_direction_compensation[0] * (accel_data.values[0] - m_accel_static_bias[0]) / m_accel_scale; accel_data.values[1] = m_accel_rotation_direction_compensation[1] * (accel_data.values[1] - m_accel_static_bias[1]) / m_accel_scale; diff --git a/src/orientation/orientation_sensor.cpp b/src/orientation/orientation_sensor.cpp index 7629132..0719a1b 100755 --- a/src/orientation/orientation_sensor.cpp +++ b/src/orientation/orientation_sensor.cpp @@ -232,7 +232,7 @@ bool orientation_sensor::on_start(void) { AUTOLOCK(m_mutex); - m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false); m_accel_sensor->start(); m_gyro_sensor->add_client(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME); @@ -250,7 +250,7 @@ bool orientation_sensor::on_stop(void) { AUTOLOCK(m_mutex); - m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->delete_interval((intptr_t)this, false); m_accel_sensor->stop(); m_gyro_sensor->delete_client(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME); @@ -294,7 +294,7 @@ void orientation_sensor::synthesize(const sensor_event_t &event, vector euler_orientation; float azimuth_offset; - if (event.event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME) { + if (event.event_type == ACCELEROMETER_RAW_DATA_EVENT) { diff_time = event.data.timestamp - m_time; if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR)) @@ -388,7 +388,7 @@ int orientation_sensor::get_sensor_data(const unsigned int event_type, sensor_da if (event_type != ORIENTATION_EVENT_RAW_DATA_REPORT_ON_TIME) return -1; - m_accel_sensor->get_sensor_data(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, accel_data); + m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data); m_gyro_sensor->get_sensor_data(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME, gyro_data); m_magnetic_sensor->get_sensor_data(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, magnetic_data); diff --git a/src/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp b/src/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp index ea5a446..3f6646e 100755 --- a/src/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp +++ b/src/rotation_vector/geomagnetic_rv/geomagnetic_rv_sensor.cpp @@ -171,7 +171,7 @@ bool geomagnetic_rv_sensor::on_start(void) { AUTOLOCK(m_mutex); - m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false); m_accel_sensor->start(); m_magnetic_sensor->add_client(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME); @@ -186,7 +186,7 @@ bool geomagnetic_rv_sensor::on_stop(void) { AUTOLOCK(m_mutex); - m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->delete_interval((intptr_t)this, false); m_accel_sensor->stop(); m_magnetic_sensor->delete_client(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME); @@ -225,7 +225,7 @@ void geomagnetic_rv_sensor::synthesize(const sensor_event_t& event, vector quaternion_geo_rv; - if (event.event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME) { + if (event.event_type == ACCELEROMETER_RAW_DATA_EVENT) { diff_time = event.data.timestamp - m_time; if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR)) @@ -291,7 +291,7 @@ int geomagnetic_rv_sensor::get_sensor_data(unsigned int event_type, sensor_data_ if (event_type != GEOMAGNETIC_RV_EVENT_RAW_DATA_REPORT_ON_TIME) return -1; - m_accel_sensor->get_sensor_data(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, accel_data); + m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data); m_magnetic_sensor->get_sensor_data(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, magnetic_data); pre_process_data(accel, accel_data.values, m_accel_static_bias, m_accel_rotation_direction_compensation, m_accel_scale); diff --git a/src/rotation_vector/rv/rv_sensor.cpp b/src/rotation_vector/rv/rv_sensor.cpp index 7846940..392d930 100755 --- a/src/rotation_vector/rv/rv_sensor.cpp +++ b/src/rotation_vector/rv/rv_sensor.cpp @@ -198,7 +198,7 @@ bool rv_sensor::on_start(void) { AUTOLOCK(m_mutex); - m_accel_sensor->add_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->add_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->add_interval((intptr_t)this, (m_interval/MS_TO_US), false); m_accel_sensor->start(); m_gyro_sensor->add_client(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME); @@ -216,7 +216,7 @@ bool rv_sensor::on_stop(void) { AUTOLOCK(m_mutex); - m_accel_sensor->delete_client(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + m_accel_sensor->delete_client(ACCELEROMETER_RAW_DATA_EVENT); m_accel_sensor->delete_interval((intptr_t)this, false); m_accel_sensor->stop(); m_gyro_sensor->delete_client(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME); @@ -260,7 +260,7 @@ void rv_sensor::synthesize(const sensor_event_t& event, vector & sensor_event_t rv_event; quaternion quaternion_orientation; - if (event.event_type == ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME) { + if (event.event_type == ACCELEROMETER_RAW_DATA_EVENT) { diff_time = event.data.timestamp - m_time; if (m_time && (diff_time < m_interval * MIN_DELIVERY_DIFF_FACTOR)) @@ -343,7 +343,7 @@ int rv_sensor::get_sensor_data(unsigned int event_type, sensor_data_t &data) if (event_type != ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME) return -1; - m_accel_sensor->get_sensor_data(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, accel_data); + m_accel_sensor->get_sensor_data(ACCELEROMETER_RAW_DATA_EVENT, accel_data); m_gyro_sensor->get_sensor_data(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME, gyro_data); m_magnetic_sensor->get_sensor_data(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, magnetic_data); diff --git a/src/server/command_worker.cpp b/src/server/command_worker.cpp index c161171..d9c5baa 100755 --- a/src/server/command_worker.cpp +++ b/src/server/command_worker.cpp @@ -853,13 +853,13 @@ void insert_priority_list(unsigned int event_type) event_type == LINEAR_ACCEL_EVENT_RAW_DATA_REPORT_ON_TIME || event_type == GRAVITY_EVENT_RAW_DATA_REPORT_ON_TIME || event_type == ROTATION_VECTOR_EVENT_RAW_DATA_REPORT_ON_TIME) { - priority_list.insert(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + priority_list.insert(ACCELEROMETER_RAW_DATA_EVENT); priority_list.insert(GYROSCOPE_EVENT_RAW_DATA_REPORT_ON_TIME); priority_list.insert(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME); } if (event_type == GEOMAGNETIC_RV_EVENT_RAW_DATA_REPORT_ON_TIME) { - priority_list.insert(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME); + priority_list.insert(ACCELEROMETER_RAW_DATA_EVENT); priority_list.insert(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME); } } diff --git a/test/src/auto_test.c b/test/src/auto_test.c index e897f74..283aaf1 100644 --- a/test/src/auto_test.c +++ b/test/src/auto_test.c @@ -199,7 +199,7 @@ int main(int argc, char **argv) fp = fopen("auto_test.output", "w+"); - result = check_sensor_api(ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME, interval); + result = check_sensor_api(ACCELEROMETER_RAW_DATA_EVENT, interval); fprintf(fp, "Accelerometer - RAW_DATA_REPORT_ON_TIME - %d\n", result); result = check_sensor_api(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME, interval); diff --git a/test/src/tc-common.c b/test/src/tc-common.c index 81d83d9..368143a 100644 --- a/test/src/tc-common.c +++ b/test/src/tc-common.c @@ -63,7 +63,7 @@ unsigned int get_event_driven(sensor_type_t sensor_type, char str[]) switch (sensor_type) { case ACCELEROMETER_SENSOR: if (strcmp(str, "RAW_DATA_REPORT_ON_TIME") == 0) - return ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME; + return ACCELEROMETER_RAW_DATA_EVENT; break; case GYROSCOPE_SENSOR: if (strcmp(str, "RAW_DATA_REPORT_ON_TIME") == 0) @@ -177,7 +177,7 @@ int main(int argc, char **argv) if (strcmp(argv[1], "accelerometer") == 0) { sensor_type = ACCELEROMETER_SENSOR; - event = ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME; + event = ACCELEROMETER_RAW_DATA_EVENT; } else if (strcmp(argv[1], "gyroscope") == 0) { sensor_type = GYROSCOPE_SENSOR;