diff options
author | Sooyoung Ha <yoosah.ha@samsung.com> | 2013-03-15 19:15:57 +0900 |
---|---|---|
committer | Sooyoung Ha <yoosah.ha@samsung.com> | 2013-03-15 19:18:25 +0900 |
commit | a5a03d2efc3a4b8bf68d9f984063761f076d3c3c (patch) | |
tree | f60ba310d090327e6b2b1088ccd08b32e3daa3ba | |
parent | d3a4c16607f3fbd68987f2bb75e6e12e2fa7677f (diff) | |
download | emulator-plugin-accel-proc-a5a03d2efc3a4b8bf68d9f984063761f076d3c3c.tar.gz emulator-plugin-accel-proc-a5a03d2efc3a4b8bf68d9f984063761f076d3c3c.tar.bz2 emulator-plugin-accel-proc-a5a03d2efc3a4b8bf68d9f984063761f076d3c3c.zip |
add user acceleration and gravity data report
-rw-r--r-- | include/accel_sim_processor.h | 12 | ||||
-rw-r--r-- | packaging/sf-plugin-proc-accel-emul.spec | 2 | ||||
-rw-r--r-- | src/accel_sim_processor.cpp | 73 |
3 files changed, 71 insertions, 16 deletions
diff --git a/include/accel_sim_processor.h b/include/accel_sim_processor.h index 2484d06..d124b8c 100644 --- a/include/accel_sim_processor.h +++ b/include/accel_sim_processor.h @@ -38,10 +38,12 @@ public: }; enum evet_type_t { - ACCELEROMETER_EVENT_ROTATION_CHECK = (0x0001 << 16) | 0x0001, - ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME = (0x0001 << 16) | 0x0002, - ACCELEROMETER_EVENT_CALIBRATION_NEEDED = (0x0001 << 16) | 0x0004, - ACCELEROMETER_EVENT_ORIENTATION_DATA_REPORT_ON_TIME = (0x0001 << 16) | 0x0020, + ACCELEROMETER_EVENT_ROTATION_CHECK = (0x0001 << 16) | 0x0001, + ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME = (0x0001 << 16) | 0x0002, + ACCELEROMETER_EVENT_CALIBRATION_NEEDED = (0x0001 << 16) | 0x0004, + ACCELEROMETER_EVENT_ORIENTATION_DATA_REPORT_ON_TIME = (0x0001 << 16) | 0x0020, + ACCELEROMETER_EVENT_LINEAR_ACCELERATION_DATA_REPORT_ON_TIME = (0x0001 << 16) | 0x0040, + ACCELEROMETER_EVENT_GRAVITY_DATA_REPORT_ON_TIME = (0x0001 << 16) | 0x0080, }; enum value_t { LANDSCAPE = 0x001, @@ -194,6 +196,8 @@ private: unsigned int m_rotation_cb_client; unsigned int m_data_report_cb_client; unsigned int m_orientation_report_cb_client; + unsigned int m_linear_acceleration_report_cb_client; + unsigned int m_gravity_report_cb_client; char *m_rotation_cb_key; }; diff --git a/packaging/sf-plugin-proc-accel-emul.spec b/packaging/sf-plugin-proc-accel-emul.spec index f142de1..3de4abc 100644 --- a/packaging/sf-plugin-proc-accel-emul.spec +++ b/packaging/sf-plugin-proc-accel-emul.spec @@ -1,6 +1,6 @@ #git:/slp/pkgs/e/emulator-plugin-accel-proc Name: sf-plugin-proc-accel-emul -Version: 0.2.17 +Version: 0.2.18 Release: 1 Summary: Accel simulator Processor plugin for sensor framework (using setting) Group: System Environment/Libraries diff --git a/src/accel_sim_processor.cpp b/src/accel_sim_processor.cpp index 2fafb70..151f545 100644 --- a/src/accel_sim_processor.cpp +++ b/src/accel_sim_processor.cpp @@ -106,6 +106,8 @@ accel_sim_processor::accel_sim_processor() , m_rotation_cb_client(0) , m_data_report_cb_client(0) , m_orientation_report_cb_client(0) +, m_linear_acceleration_report_cb_client(0) +, m_gravity_report_cb_client(0) { m_name = strdup("accel_sim_processor"); m_rotation_cb_key = strdup("memory/private/sensor/10001"); @@ -790,6 +792,12 @@ bool accel_sim_processor::add_callback_func(cmd_reg_t * param) case ACCELEROMETER_EVENT_ORIENTATION_DATA_REPORT_ON_TIME: m_orientation_report_cb_client++; break; + case ACCELEROMETER_EVENT_LINEAR_ACCELERATION_DATA_REPORT_ON_TIME: + m_linear_acceleration_report_cb_client++; + break; + case ACCELEROMETER_EVENT_GRAVITY_DATA_REPORT_ON_TIME: + m_gravity_report_cb_client++; + break; default: ERR("invaild event type !!"); return false; @@ -826,6 +834,14 @@ bool accel_sim_processor::remove_callback_func(cmd_reg_t * param) if(m_orientation_report_cb_client > 0) m_orientation_report_cb_client--; break; + case ACCELEROMETER_EVENT_LINEAR_ACCELERATION_DATA_REPORT_ON_TIME: + if(m_linear_acceleration_report_cb_client > 0) + m_linear_acceleration_report_cb_client--; + break; + case ACCELEROMETER_EVENT_GRAVITY_DATA_REPORT_ON_TIME: + if(m_gravity_report_cb_client > 0) + m_gravity_report_cb_client--; + break; default: ERR("invaild event type !!"); return false; @@ -845,6 +861,8 @@ bool accel_sim_processor::check_callback_event(cmd_reg_t *param) case ACCELEROMETER_EVENT_ROTATION_CHECK: case ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME: case ACCELEROMETER_EVENT_ORIENTATION_DATA_REPORT_ON_TIME: + case ACCELEROMETER_EVENT_LINEAR_ACCELERATION_DATA_REPORT_ON_TIME: + case ACCELEROMETER_EVENT_GRAVITY_DATA_REPORT_ON_TIME: DBG("event check ok\n"); break; @@ -863,17 +881,50 @@ long accel_sim_processor::set_cmd(int type , int property , long input_value) int accel_sim_processor::get_property(unsigned int property_level , void *property_data ) { - if(m_filter) - { - return m_filter->get_property(property_level, property_data); - } else if(m_sensor) { - return m_sensor->get_property(property_level, property_data); - } else { - ERR("no m_sensor, cannot get_property from sensor\n"); - return -1; - } - - return 0; + int result = -1; + base_property_struct *return_property; + return_property = (base_property_struct *)property_data; + + if (m_sensor) { + result = m_sensor->get_property(ACCELEROMETER_BASE_DATA_SET , return_property); + if(result == 0) + { + if(property_level == ACCELEROMETER_BASE_DATA_SET) + { + return result; + } + else if(property_level == ACCELEROMETER_ORIENTATION_DATA_SET) + { + return_property->sensor_unit_idx = IDX_UNIT_DEGREE; + return_property->sensor_min_range = -180; + return_property->sensor_max_range = 360; + return_property->sensor_resolution = 1; + } + else if(property_level == ACCELEROMETER_LINEAR_ACCELERATION_DATA_SET) + { + return_property->sensor_unit_idx = IDX_UNIT_METRE_PER_SECOND_SQUARED; + return_property->sensor_min_range = -20.0; + return_property->sensor_max_range = 20.0; + return_property->sensor_resolution = 0.1; + } + else if(property_level == ACCELEROMETER_GRAVITY_DATA_SET) + { + return_property->sensor_unit_idx = IDX_UNIT_METRE_PER_SECOND_SQUARED; + return_property->sensor_min_range = -2.0; + return_property->sensor_max_range = 2.0; + return_property->sensor_resolution = 0.01; + } + else + { + ERR("cannot get_property from sensor\n"); + return -1; + } + return result; + } + } else { + ERR("no m_sensor , cannot get_property from sensor\n"); + } + return -1; } int accel_sim_processor::get_struct_value(unsigned int struct_type , void *struct_values) |