1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
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
|