summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSooyoung Ha <yoosah.ha@samsung.com>2013-04-08 21:17:36 +0900
committerSooyoung Ha <yoosah.ha@samsung.com>2013-04-08 21:17:36 +0900
commit57c584bffd349623435725c9f98064f8cd516f3b (patch)
tree6ac6f1d6d1e8295136a29751cf2e95b469e01f3a
parent1692a2c965816aef0d0e990668d586472ffe1992 (diff)
downloademulator-plugin-accel-proc-57c584bffd349623435725c9f98064f8cd516f3b.tar.gz
emulator-plugin-accel-proc-57c584bffd349623435725c9f98064f8cd516f3b.tar.bz2
emulator-plugin-accel-proc-57c584bffd349623435725c9f98064f8cd516f3b.zip
add the checking rotation status routine
-rw-r--r--include/accel_sim_processor.h4
-rw-r--r--packaging/sf-plugin-proc-accel-emul.spec2
-rw-r--r--src/accel_sim_processor.cpp36
3 files changed, 39 insertions, 3 deletions
diff --git a/include/accel_sim_processor.h b/include/accel_sim_processor.h
index d124b8c..d8bdcc3 100644
--- a/include/accel_sim_processor.h
+++ b/include/accel_sim_processor.h
@@ -23,6 +23,8 @@
*
*/
+#define MAX_WINDOW_NUM 3
+
class accel_sim_processor : public cprocessor_module
{
public:
@@ -200,6 +202,8 @@ private:
unsigned int m_gravity_report_cb_client;
char *m_rotation_cb_key;
+ int m_curr_window_count;
+ long m_windowing[MAX_WINDOW_NUM];
};
diff --git a/packaging/sf-plugin-proc-accel-emul.spec b/packaging/sf-plugin-proc-accel-emul.spec
index d2774c5..5693543 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.19
+Version: 0.2.20
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 586a588..6cbb08e 100644
--- a/src/accel_sim_processor.cpp
+++ b/src/accel_sim_processor.cpp
@@ -296,6 +296,7 @@ void *accel_sim_processor::working(void *inst)
unsigned long status_event;
long new_event = -1;
int state;
+ bool rotation_on = false;
#ifdef SIMULATOR
int fd_count = -1;
@@ -566,7 +567,8 @@ void *accel_sim_processor::working(void *inst)
}
// close(s);
- DBG("check event_value :%lu, status_event : %lu , acc_pitch : %d , acc_theta : %d \n",event , status_event ,acc_pitch , acc_theta );
+// DBG("check event_value :%lu, status_event : %lu , acc_pitch : %d , acc_theta : %d \n",event , status_event ,acc_pitch , acc_theta );
+ DBG("check event_value :%lu, status_event : %lu , acc_pitch : %d , acc_theta : %d , new_event : %d \n",event , status_event ,acc_pitch , acc_theta, new_event );
processor->m_x = x;
processor->m_y = y;
@@ -577,9 +579,27 @@ void *accel_sim_processor::working(void *inst)
processor->m_ms_unit_upscale_x = ((double)x * 0.004 * (9.81))*processor->m_ms_unit_upscale_value;
processor->m_ms_unit_upscale_y = ((double)y * 0.004 * (9.81))*processor->m_ms_unit_upscale_value;
processor->m_ms_unit_upscale_z = ((double)z * 0.004 * (9.81))*processor->m_ms_unit_upscale_value;
+
+ processor->m_windowing[processor->m_curr_window_count++] = status_event;
+
+ if (processor->m_curr_window_count == MAX_WINDOW_NUM ) {
+ processor->m_curr_window_count = 0;
+ }
+
+ for (i=0; i < MAX_WINDOW_NUM ; i++) {
+ DBG("processor->m_windowing[%d] = [%d]",i,status_event);
+ if( processor->m_windowing[i] == status_event) {
+ rotation_on = true;
+ } else {
+ rotation_on = false;
+ break;
+ }
+ }
+ DBG("rotation_on = [%s]",rotation_on ? "true" : "false");
+
#endif
- if (event)
+ if (event && rotation_on)
{
processor->m_event = status_event;
processor->m_new_event = new_event;
@@ -660,6 +680,7 @@ long accel_sim_processor::value(int id)
bool accel_sim_processor::start(void)
{
bool ret;
+ int i = 0;
m_client ++;
if (m_client > 1) {
@@ -669,6 +690,11 @@ bool accel_sim_processor::start(void)
DBG("%s processor real starting\n",m_name);
+ for(i = 0 ; i < MAX_WINDOW_NUM ; i++) {
+ m_windowing[i] = 0;
+ }
+ m_curr_window_count = 0;
+
#ifdef SIMULATOR
m_handle_simul_node = open(SIMUL_NODE,O_RDONLY);
if (m_handle_simul_node<0) {
@@ -709,6 +735,7 @@ bool accel_sim_processor::start(void)
bool accel_sim_processor::stop(void)
{
bool ret;
+ int i = 0;
m_client --;
if (m_client > 0) {
@@ -720,6 +747,11 @@ bool accel_sim_processor::stop(void)
m_client = 0;
+ for(i = 0 ; i < MAX_WINDOW_NUM ; i++) {
+ m_windowing[i] = 0;
+ }
+ m_curr_window_count = 0;
+
ret = cprocessor_module::stop();
if ( ret != true ) {
ERR("cprocessor_module::stop()\n");