diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/accel_sim_processor.h | 207 |
1 files changed, 207 insertions, 0 deletions
diff --git a/include/accel_sim_processor.h b/include/accel_sim_processor.h new file mode 100644 index 0000000..d124b8c --- /dev/null +++ b/include/accel_sim_processor.h @@ -0,0 +1,207 @@ +/* + * emulator-plugin-accel-proc + * + * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. + * + * 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 + * Free Software Foundation; either version 2.1 of the License, or (at your option) + * any later version. + * + * This library is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + * License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +class accel_sim_processor : public cprocessor_module +{ +public: + static const char *SIMUL_NODE; + static const char *LCD_TYPE_NODE; + static const char *LCD_TYPE_KEY; + + enum data_id { + 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_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, + PORTRAIT_TOP = 0x002, + PORTRAIT_BTM = 0x004, + HEAD_LEFT = 0x008, + HEAD_CENTER = 0x010, + HEAD_RIGHT = 0x020, + FRONT = 0x040, + BACK = 0x080, + MIDDLE = 0x100, + }; + + enum rotation_event_t { + ROTATION_UNKNOWN = 0, + ROTATION_HEAD_ROTATE_90 = 1, /*CCW base*/ + ROTATION_HEAD_ROTATE_0 = 2, /*CCW base*/ + ROTATION_HEAD_ROTATE_180 = 3, /*CCW base*/ + ROTATION_HEAD_ROTATE_270 = 4, /*CCW base*/ + }; + + enum value_limit_t { + LANDSCAPE_MIN = 1700, + LANDSCAPE_MAX = 2400, + + PORTRAIT_BTM_MIN= 2600, + PORTRAIT_BTM_MAX= 2900, + + PORTRAIT_TOP_MIN= 1200, + PORTRAIT_TOP_MAX= 1400, + + HEAD_LEFT_MIN = 1100, + HEAD_LEFT_MAX = 1400, + + HEAD_CENTER_MIN = 1700, + HEAD_CENTER_MAX = 2300, + + HEAD_RIGHT_MIN = 2700, + HEAD_RIGHT_MAX = 3000, + + FRONT_MIN = 1100, + FRONT_MAX = 1300, + + MIDDLE_MIN = 1700, + MIDDLE_MAX = 2300, + + BACK_MIN = 2700, + BACK_MAX = 2900, + }; + + enum pitch_value_limit_t { + PITCH_MIN = 35, /*init 35 , 60*/ + PITCH_MAX = 145, /*init 145 , 135*/ + }; + + enum cmd_property_t { + PROPERTY_CMD_START = 0, + PROPERTY_CMD_1, + PROPERTY_CMD_2, + PROPERTY_CMD_3, + PROPERTY_CMD_4, + PROPERTY_CMD_5, + }; + + enum simulator_event_t { + SIMUL_ROTATE_0 = 0, + SIMUL_ROTATE_90, + SIMUL_ROTATE_180, + SIMUL_ROTATE_270, + }; + + accel_sim_processor(); + virtual ~accel_sim_processor(); + + const char *name(void); + int id(void); + int version(void); + + bool update_name(char *name); + bool update_id(int id); + bool update_version(int version); + + bool add_input(csensor_module *sensor); + bool add_input(cfilter_module *filter); + + long value(char *port); + long value(int id); + + cprocessor_module *create_new(void); + void destroy(cprocessor_module *module); + + static void *working(void *inst); + static void *stopped(void *inst); + + virtual bool start(void); + virtual bool stop(void); + + bool add_callback_func(cmd_reg_t *param); + bool remove_callback_func(cmd_reg_t *param); + bool check_callback_event(cmd_reg_t *param); + + long set_cmd(int type , int property , long input_value); + int get_property(unsigned int property_level , void *property_data ); + int get_struct_value(unsigned int struct_type , void *struct_values); + + int check_lcd_type(void); + int check_hw_node(void); + + +private: + csensor_module *m_sensor; + cfilter_module *m_filter; + + 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; + + long m_version; + long m_id; + + char *m_name; + + csync m_sync; + int m_acc_theta; + int m_acc_pitch; + + int m_client; +#ifdef SIMULATOR + int m_handle_simul_node; + int m_run_state; + fd_set m_readfds; + fd_set m_writefds; + fd_set m_exceptfds; + fd_set m_standby_fds; +#endif + int m_work_err_count; + long m_ms_unit_upscale_value; + long m_ms_unit_upscale_x; + 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; +}; + + + +//! End of a file |