summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsungmin82.ha <sungmin82.ha@samsung.com>2013-07-30 15:14:53 +0900
committersungmin82.ha <sungmin82.ha@samsung.com>2013-07-30 15:14:53 +0900
commit2f2462b94a8738d76cd7dc328f82ebd63e3c70a4 (patch)
tree37a1ac197038ed4d38f02b5070a1138c5e97cef0
parentcb27e88b33d68cb3e660b2956343e1c20b3ea49f (diff)
downloademulator-plugin-accel-proc-tizen.tar.gz
emulator-plugin-accel-proc-tizen.tar.bz2
emulator-plugin-accel-proc-tizen.zip
sync with tizen_2.2HEADtizen
Change-Id: I54717586106b3f2e5d22c0d4721674bbe34937ec Signed-off-by: Sungmin Ha <sungmin82.ha@samsung.com>
-rw-r--r--AUTHORS13
-rw-r--r--LICENSE.LGPLv2.1 (renamed from COPYING)2
-rw-r--r--NOTICE4
-rw-r--r--debian/changelog13
-rw-r--r--debian/control2
-rw-r--r--debian/copyright20
-rw-r--r--include/accel_sim_processor.h33
-rw-r--r--packaging/sf-plugin-proc-accel-emul.manifest5
-rw-r--r--packaging/sf-plugin-proc-accel-emul.spec5
-rw-r--r--src/accel_sim_processor.cpp223
10 files changed, 248 insertions, 72 deletions
diff --git a/AUTHORS b/AUTHORS
index 8acdf13..1722483 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,12 @@
-DongKyun Yun <dk77.yun@samsung.com>
-Sungmin Ha <sungmin82.ha@samsung.com>
+YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+DaiYoung Kim <daiyoung777.kim@samsung.com>
+SeokYeon Hwang <syeon.hwang@samsung.com>
+SangJin Kim <sangjin3.kim@samsung.com>
+KiTae Kim <kt920.kim@samsung.com>
+JinHyung Jo <jinhyung.jo@samsung.com>
+SungMin Ha <sungmin82.ha@samsung.com>
+MunKyu Im <munkyu.im@samsung.com>
+JiHye Kim <jihye1128.kim@samsung.com>
+GiWoong Kim <giwoong.kim@samsung.com>
+SooYoung Ha <yoosah.ha@samsnung.com>
HyunGoo Kang <hyungoo1.kang@samsung.com>
diff --git a/COPYING b/LICENSE.LGPLv2.1
index fabb204..9c92a19 100644
--- a/COPYING
+++ b/LICENSE.LGPLv2.1
@@ -1,4 +1,4 @@
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
diff --git a/NOTICE b/NOTICE
index f085dc6..18b91b4 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1 +1,3 @@
-Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under GNU LESSER GENERAL PUBLIC LICENSE Version 2.1.
+Please, see the LICENSE.LGPLv2.1 file for GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, terms and conditions.
diff --git a/debian/changelog b/debian/changelog
index ce429df..326edbd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+sf-plugin-proc-accel-emul (0.2.13) unstable; urgency=low
+
+ * modified for support updated libslp-sensor
+
+ -- Sungmin ha <sungmin82.ha@samsung.com> Wed, 17 Oct 2012 19:55:02 +0900
+
+sf-plugin-proc-accel-emul (0.2.11) unstable; urgency=low
+
+ * Add orientation event
+ * Tag: sf-plugin-proc-accel-emul_0.2.11
+
+ -- JuHyun Kim <jh8212.kim@samsung.com> Wed, 19 Sep 2012 11:47:11 +0900
+
sf-plugin-proc-accel-emul (0.2.10) unstable; urgency=low
* fixed unexpectedly stop when sms injection with sensor data
diff --git a/debian/control b/debian/control
index 05ea768..5cad9f0 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: misc
Priority: extra
Maintainer: Sungmin Ha <sungmin82.ha@samsung.com>,Jihye Kim <jihye1128.kim@samsung.com>,Yeongkyoon Lee <yeongkyoon.lee@samsung.com>
Build-Depends: libsf-common-dev, libslp-setting-dev
-Standards-Version: 0.2.10
+Standards-Version: 0.2.13
Package: sf-plugin-proc-accel-emul
Architecture: i386
diff --git a/debian/copyright b/debian/copyright
index bdf91ce..8b13789 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -1,21 +1 @@
-This is sf-plugin-proc-accel-sim, written and maintained by Sungmin Ha <sungmin82.ha@samsung.com>
-on Mon, 25 Jul 2011 14:08:22 +0900.
-The original source can always be found at:
- ftp://slp.samsung.net/dists/unstable/main/source/
-
-Copyright Holder: $NAME
-
-License:
- samsung
-
-/*
- * Copyright (c) 2008 Samsung Electronics, Inc.
- * All rights reserved.
- *
- * This software is a confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information"). You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung Electronics.
- */
diff --git a/include/accel_sim_processor.h b/include/accel_sim_processor.h
index 56ec393..d8bdcc3 100644
--- a/include/accel_sim_processor.h
+++ b/include/accel_sim_processor.h
@@ -3,7 +3,9 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact: Sungmin Ha <sungmin82.ha@samsung.com>
+ * Contact:
+ * SooYoung Ha <yoosah.ha@samsnung.com>
+ * Sungmin Ha <sungmin82.ha@samsung.com>
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the
@@ -21,6 +23,8 @@
*
*/
+#define MAX_WINDOW_NUM 3
+
class accel_sim_processor : public cprocessor_module
{
public:
@@ -29,13 +33,19 @@ public:
static const char *LCD_TYPE_KEY;
enum data_id {
- ACCELEROMETER_BASE_DATA_SET = (0x0001<<16) | 0x0001,
+ ACCELEROMETER_BASE_DATA_SET = (0x0001 << 16) | 0x0001,
+ ACCELEROMETER_ORIENTATION_DATA_SET = (0x0001 << 16) | 0x0002,
+ ACCELEROMETER_LINEAR_ACCELERATION_DATA_SET = (0x0001 << 16) | 0x0004,
+ ACCELEROMETER_GRAVITY_DATA_SET = (0x0001 << 16) | 0x0008,
};
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_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,
@@ -152,6 +162,10 @@ private:
long m_x;
long m_y;
long m_z;
+
+ float m_gravity_x;
+ float m_gravity_y;
+ float m_gravity_z;
long m_event;
long m_new_event;
@@ -180,11 +194,16 @@ private:
long m_ms_unit_upscale_y;
long m_ms_unit_upscale_z;
int m_lcd_type;
-
+
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;
+ int m_curr_window_count;
+ long m_windowing[MAX_WINDOW_NUM];
};
diff --git a/packaging/sf-plugin-proc-accel-emul.manifest b/packaging/sf-plugin-proc-accel-emul.manifest
new file mode 100644
index 0000000..017d22d
--- /dev/null
+++ b/packaging/sf-plugin-proc-accel-emul.manifest
@@ -0,0 +1,5 @@
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
diff --git a/packaging/sf-plugin-proc-accel-emul.spec b/packaging/sf-plugin-proc-accel-emul.spec
index d02d5bc..5693543 100644
--- a/packaging/sf-plugin-proc-accel-emul.spec
+++ b/packaging/sf-plugin-proc-accel-emul.spec
@@ -1,13 +1,12 @@
#git:/slp/pkgs/e/emulator-plugin-accel-proc
Name: sf-plugin-proc-accel-emul
-Version: 0.2.10
+Version: 0.2.20
Release: 1
Summary: Accel simulator Processor plugin for sensor framework (using setting)
Group: System Environment/Libraries
License: GNUv2
Source0: %{name}-%{version}.tar.gz
-BuildArch: i386
-ExclusiveArch: %{ix86}
+Source1001: packaging/sf-plugin-proc-accel-emul.manifest
BuildRequires: cmake
BuildRequires: pkgconfig(sf_common)
BuildRequires: pkgconfig(vconf)
diff --git a/src/accel_sim_processor.cpp b/src/accel_sim_processor.cpp
index f3d013e..6cbb08e 100644
--- a/src/accel_sim_processor.cpp
+++ b/src/accel_sim_processor.cpp
@@ -3,7 +3,8 @@
*
* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
*
- * Contact:
+ * Contact:
+ * SooYoung Ha <yoosah.ha@samsnung.com>
* Sungmin Ha <sungmin82.ha@samsung.com>
* DongKyun Yun <dk77.yun@samsung.com>
*
@@ -67,6 +68,11 @@
#define DEBUG
#define SRV_IP "10.0.2.2"
+#define RADIAN_VALUE 57.29747
+#define GRAVITY_VALUE 0.0098
+#define BINARY_TO_GRAVITY 0.001
+#define LOW_FILTER_ALPHA 0.8
+#define LOW_FILTER_ALPHA_R 0.2
const char *accel_sim_processor::LCD_TYPE_NODE = "/sys/class/graphics/fb0/virtual_size";
@@ -78,6 +84,9 @@ accel_sim_processor::accel_sim_processor()
, m_x(-1)
, m_y(-1)
, m_z(-1)
+, m_gravity_x(-1)
+, m_gravity_y(-1)
+, m_gravity_z(-1)
, m_event(0)
, m_new_event(0)
, m_version(1)
@@ -96,6 +105,9 @@ accel_sim_processor::accel_sim_processor()
, m_ms_unit_upscale_z(-1)
, 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");
@@ -284,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;
@@ -304,7 +317,8 @@ void *accel_sim_processor::working(void *inst)
#endif
struct sockaddr_in si_other;
- int s, i, slen=sizeof(si_other);
+// int s; // for socket, but not be used now
+ int i, slen=sizeof(si_other);
char buf[16];
FILE* fd;
char fbuf[16];
@@ -321,8 +335,10 @@ void *accel_sim_processor::working(void *inst)
memset(buf, '\0', sizeof(buf));
+ /* socket doesn't be used now
if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))==-1)
ERR("socket error! (%s)\n", __FUNCTION__ );
+ */
memset((char *) &si_other, 0, sizeof(si_other));
si_other.sin_family = AF_INET;
@@ -361,24 +377,24 @@ void *accel_sim_processor::working(void *inst)
DBG("Data is ready now\n");
- x = filter->value("x");
- y = filter->value("y");
- z = filter->value("z");
+ x = filter->value("x") * -1;
+ y = filter->value("y") * -1;
+ z = filter->value("z") * -1;
DBG("Read %ld %ld %ld\n", x, y, z);
DBG("Prev-Read %ld %ld %ld\n", processor->m_x, processor->m_y, processor->m_z);
- atan_value = atan2(y,-x);
- acc_theta = (int)(atan_value * (180.0/M_PI) + 270)%360;
+ atan_value = atan2(x, y);
+ acc_theta = (int)(atan_value * (180.0/M_PI) + 360)%360;
- if ( z > 250 ) {
+ if ( z > 1024 ) {
norm_z = 1.0;
}
- else if ( z < -250 ) {
+ else if ( z < -1024 ) {
norm_z = -1.0;
}
else {
- norm_z = ((double)z)/250;
+ norm_z = ((double)z)/1024;
}
acc_pitch = (int)( acos(norm_z) *(180.0/M_PI));
#endif
@@ -549,9 +565,10 @@ void *accel_sim_processor::working(void *inst)
}
}
- close(s);
+// 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;
@@ -562,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;
@@ -645,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) {
@@ -654,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) {
@@ -694,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) {
@@ -705,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");
@@ -769,11 +816,20 @@ bool accel_sim_processor::add_callback_func(cmd_reg_t * param)
}
}
m_rotation_cb_client++;
-
+
break;
case ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME:
m_data_report_cb_client++;
break;
+ 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;
@@ -801,11 +857,23 @@ bool accel_sim_processor::remove_callback_func(cmd_reg_t * param)
free (m_rotation_cb_key);
m_rotation_cb_key = NULL;
}
-
+
break;
case ACCELEROMETER_EVENT_RAW_DATA_REPORT_ON_TIME:
m_data_report_cb_client--;
break;
+ case ACCELEROMETER_EVENT_ORIENTATION_DATA_REPORT_ON_TIME:
+ 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;
@@ -824,6 +892,9 @@ bool accel_sim_processor::check_callback_event(cmd_reg_t *param)
switch ( param->event_type ) {
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;
@@ -842,32 +913,110 @@ 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_filter) {
+ result = m_filter->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)
{
- if (m_filter) {
- if ( struct_type == ACCELEROMETER_BASE_DATA_SET ) {
- return m_filter->get_struct_value(struct_type , struct_values);
- } else {
- ERR("does not support stuct_type\n");
- return -1;
- }
- } else {
- ERR("no m_filter , cannot get_struct_value from filter\n");
- return -1;
- }
+ int state;
+ base_data_struct sensor_struct_data;
+ base_data_struct *return_struct_data = NULL;
+
+ state = m_filter ? m_filter->get_struct_value(ACCELEROMETER_BASE_DATA_SET , &sensor_struct_data) : -1;
+ if (state<0) {
+ ERR("Error , m_filter get struct_data fail\n");
+ return -1;
+ }
+
+ if ( struct_type == ACCELEROMETER_BASE_DATA_SET ) {
+ return_struct_data = (base_data_struct *)struct_values;
+ return_struct_data->data_accuracy = sensor_struct_data.data_accuracy;
+ return_struct_data->data_unit_idx = IDX_UNIT_METRE_PER_SECOND_SQUARED;
+ return_struct_data->values_num = 3;
+ return_struct_data->values[0] = sensor_struct_data.values[0];
+ return_struct_data->values[1] = sensor_struct_data.values[1];
+ return_struct_data->values[2] = sensor_struct_data.values[2];
+ } else if ( struct_type == ACCELEROMETER_ORIENTATION_DATA_SET ) {
+ return_struct_data = (base_data_struct *)struct_values;
+ return_struct_data->data_accuracy = sensor_struct_data.data_accuracy;
+ return_struct_data->data_unit_idx = IDX_UNIT_DEGREE;
+ return_struct_data->values_num = 3;
+ return_struct_data->values[0] = (int)(atan2(sensor_struct_data.values[0], sensor_struct_data.values[1]) * RADIAN_VALUE + 180) % 360;
+ return_struct_data->values[1] = (int)(atan2(sensor_struct_data.values[1], sensor_struct_data.values[2]) * RADIAN_VALUE ) % 180;
+ return_struct_data->values[2] = (int)(atan2(sensor_struct_data.values[0], sensor_struct_data.values[2]) * RADIAN_VALUE ) % 180;
+
+ if(return_struct_data->values[2] > 90)
+ return_struct_data->values[2] = 180 - return_struct_data->values[2];
+ else if (return_struct_data->values[2] < -90)
+ return_struct_data->values[2] = -180 - return_struct_data->values[2];
+ } else if (struct_type == ACCELEROMETER_LINEAR_ACCELERATION_DATA_SET) {
+ return_struct_data = (base_data_struct *)struct_values;
+ return_struct_data->data_accuracy = sensor_struct_data.data_accuracy;
+ return_struct_data->data_unit_idx = IDX_UNIT_METRE_PER_SECOND_SQUARED;
+ return_struct_data->values_num = 3;
+ m_gravity_x = (LOW_FILTER_ALPHA * m_gravity_x) + (LOW_FILTER_ALPHA_R * sensor_struct_data.values[0]);
+ m_gravity_y = (LOW_FILTER_ALPHA * m_gravity_y) + (LOW_FILTER_ALPHA_R * sensor_struct_data.values[1]);
+ m_gravity_z = (LOW_FILTER_ALPHA * m_gravity_z) + (LOW_FILTER_ALPHA_R * sensor_struct_data.values[2]);
+ return_struct_data->values[0] = (sensor_struct_data.values[0] - m_gravity_x);
+ return_struct_data->values[1] = (sensor_struct_data.values[1] - m_gravity_y);
+ return_struct_data->values[2] = (sensor_struct_data.values[2] - m_gravity_z);
+ } else if (struct_type == ACCELEROMETER_GRAVITY_DATA_SET) {
+ return_struct_data = (base_data_struct *)struct_values;
+ return_struct_data->data_accuracy = sensor_struct_data.data_accuracy;
+ return_struct_data->data_unit_idx = IDX_UNIT_METRE_PER_SECOND_SQUARED;
+ return_struct_data->values_num = 3;
+ return_struct_data->values[0] = sensor_struct_data.values[0] / GRAVITY_VALUE * BINARY_TO_GRAVITY;
+ return_struct_data->values[1] = sensor_struct_data.values[1] / GRAVITY_VALUE * BINARY_TO_GRAVITY;
+ return_struct_data->values[2] = sensor_struct_data.values[2] / GRAVITY_VALUE * BINARY_TO_GRAVITY;
+ } else {
+ ERR("does not support stuct_type\n");
+ return -1;
+ }
+
+ return 0;
}
int accel_sim_processor::check_lcd_type(void)