summaryrefslogtreecommitdiff
path: root/src/modules/eeze
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2013-04-19 09:55:02 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2013-04-22 15:58:28 +0100
commitc2da27328bff555f75ab336f280688f05b4abc40 (patch)
treeab5458c0afadbb4ed9ec3e07c2cffacdbfb617f2 /src/modules/eeze
parent116013320a941357a925441928ea7e10ed6c0ebd (diff)
eeze/sensor: Simplify object handling in async paths.
This follows the simplified handling of sensor object we are already doing for the sync paths. Its a bit more complicated here as we need to pass all data through the module specific async handling. But the result should be the same.
Diffstat (limited to 'src/modules/eeze')
-rw-r--r--src/modules/eeze/sensor/fake/fake.c45
-rw-r--r--src/modules/eeze/sensor/tizen/tizen.c328
-rw-r--r--src/modules/eeze/sensor/udev/udev.c25
3 files changed, 188 insertions, 210 deletions
diff --git a/src/modules/eeze/sensor/fake/fake.c b/src/modules/eeze/sensor/fake/fake.c
index bf9d694eca..ebe8352b18 100644
--- a/src/modules/eeze/sensor/fake/fake.c
+++ b/src/modules/eeze/sensor/fake/fake.c
@@ -24,6 +24,14 @@ static int _eeze_sensor_fake_log_dom = -1;
24 24
25static Eeze_Sensor_Module *esensor_module; 25static Eeze_Sensor_Module *esensor_module;
26 26
27static void
28_dummy_free(void *user_data EINA_UNUSED, void *func_data EINA_UNUSED)
29{
30/* Don't free the event data after dispatching the event. We keep track of
31 * it on our own
32 */
33}
34
27static Eina_Bool 35static Eina_Bool
28fake_init(void) 36fake_init(void)
29{ 37{
@@ -89,16 +97,10 @@ fake_read(Eeze_Sensor_Obj *obj)
89} 97}
90 98
91static Eina_Bool 99static Eina_Bool
92fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED) 100fake_async_read(Eeze_Sensor_Obj *obj, void *user_data)
93{ 101{
94 Eeze_Sensor_Obj *obj = NULL; 102 if (user_data)
95 103 obj->user_data = user_data;
96 obj = eeze_sensor_obj_get(sensor_type);
97 if (obj == NULL)
98 {
99 ERR("No matching sensor object found in list.");
100 return EINA_FALSE;
101 }
102 104
103 /* Default values for sensor objects with three data points */ 105 /* Default values for sensor objects with three data points */
104 obj->accuracy = -1; 106 obj->accuracy = -1;
@@ -107,54 +109,53 @@ fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED)
107 obj->data[2] = 42; 109 obj->data[2] = 42;
108 obj->timestamp = ecore_time_get(); 110 obj->timestamp = ecore_time_get();
109 111
110 switch (sensor_type) 112 switch (obj->type)
111 { 113 {
112 case EEZE_SENSOR_TYPE_ACCELEROMETER: 114 case EEZE_SENSOR_TYPE_ACCELEROMETER:
113 ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, obj, NULL, NULL); 115 ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, obj, _dummy_free, NULL);
114 break; 116 break;
115 case EEZE_SENSOR_TYPE_GRAVITY: 117 case EEZE_SENSOR_TYPE_GRAVITY:
116 ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, NULL, NULL); 118 ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, _dummy_free, NULL);
117 break; 119 break;
118 case EEZE_SENSOR_TYPE_LINEAR_ACCELERATION: 120 case EEZE_SENSOR_TYPE_LINEAR_ACCELERATION:
119 ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, NULL, NULL); 121 ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, _dummy_free, NULL);
120 break; 122 break;
121 case EEZE_SENSOR_TYPE_DEVICE_ORIENTATION: 123 case EEZE_SENSOR_TYPE_DEVICE_ORIENTATION:
122 ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, NULL, NULL); 124 ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, _dummy_free, NULL);
123 break; 125 break;
124 case EEZE_SENSOR_TYPE_MAGNETIC: 126 case EEZE_SENSOR_TYPE_MAGNETIC:
125 ecore_event_add(EEZE_SENSOR_EVENT_MAGNETIC, obj, NULL, NULL); 127 ecore_event_add(EEZE_SENSOR_EVENT_MAGNETIC, obj, _dummy_free, NULL);
126 break; 128 break;
127 case EEZE_SENSOR_TYPE_ORIENTATION: 129 case EEZE_SENSOR_TYPE_ORIENTATION:
128 ecore_event_add(EEZE_SENSOR_EVENT_ORIENTATION, obj, NULL, NULL); 130 ecore_event_add(EEZE_SENSOR_EVENT_ORIENTATION, obj, _dummy_free, NULL);
129 break; 131 break;
130 case EEZE_SENSOR_TYPE_GYROSCOPE: 132 case EEZE_SENSOR_TYPE_GYROSCOPE:
131 ecore_event_add(EEZE_SENSOR_EVENT_GYROSCOPE, obj, NULL, NULL); 133 ecore_event_add(EEZE_SENSOR_EVENT_GYROSCOPE, obj, _dummy_free, NULL);
132 break; 134 break;
133 case EEZE_SENSOR_TYPE_LIGHT: 135 case EEZE_SENSOR_TYPE_LIGHT:
134 /* Reset values that are not used for sensor object with one data point */ 136 /* Reset values that are not used for sensor object with one data point */
135 obj->data[1] = 0; 137 obj->data[1] = 0;
136 obj->data[2] = 0; 138 obj->data[2] = 0;
137 ecore_event_add(EEZE_SENSOR_EVENT_LIGHT, obj, NULL, NULL); 139 ecore_event_add(EEZE_SENSOR_EVENT_LIGHT, obj, _dummy_free, NULL);
138 break; 140 break;
139 case EEZE_SENSOR_TYPE_PROXIMITY: 141 case EEZE_SENSOR_TYPE_PROXIMITY:
140 obj->data[1] = 0; 142 obj->data[1] = 0;
141 obj->data[2] = 0; 143 obj->data[2] = 0;
142 ecore_event_add(EEZE_SENSOR_EVENT_PROXIMITY, obj, NULL, NULL); 144 ecore_event_add(EEZE_SENSOR_EVENT_PROXIMITY, obj, _dummy_free, NULL);
143 break; 145 break;
144 case EEZE_SENSOR_TYPE_BAROMETER: 146 case EEZE_SENSOR_TYPE_BAROMETER:
145 obj->data[1] = 0; 147 obj->data[1] = 0;
146 obj->data[2] = 0; 148 obj->data[2] = 0;
147 ecore_event_add(EEZE_SENSOR_EVENT_BAROMETER, obj, NULL, NULL); 149 ecore_event_add(EEZE_SENSOR_EVENT_BAROMETER, obj, _dummy_free, NULL);
148 break; 150 break;
149 case EEZE_SENSOR_TYPE_TEMPERATURE: 151 case EEZE_SENSOR_TYPE_TEMPERATURE:
150 obj->data[1] = 0; 152 obj->data[1] = 0;
151 obj->data[2] = 0; 153 obj->data[2] = 0;
152 ecore_event_add(EEZE_SENSOR_EVENT_TEMPERATURE, obj, NULL, NULL); 154 ecore_event_add(EEZE_SENSOR_EVENT_TEMPERATURE, obj, _dummy_free, NULL);
153 break; 155 break;
154 156
155 default: 157 default:
156 ERR("Not possible to read from this sensor type."); 158 ERR("Not possible to read from this sensor type.");
157 free(obj);
158 return EINA_FALSE; 159 return EINA_FALSE;
159 } 160 }
160 return EINA_TRUE; 161 return EINA_TRUE;
diff --git a/src/modules/eeze/sensor/tizen/tizen.c b/src/modules/eeze/sensor/tizen/tizen.c
index e3ae016b55..5217aeab33 100644
--- a/src/modules/eeze/sensor/tizen/tizen.c
+++ b/src/modules/eeze/sensor/tizen/tizen.c
@@ -24,6 +24,15 @@ static Eeze_Sensor_Module *esensor_module;
24/* Tizen sensor handle */ 24/* Tizen sensor handle */
25static sensor_h sensor_handle; 25static sensor_h sensor_handle;
26 26
27static void
28_dummy_free(void *user_data EINA_UNUSED, void *func_data EINA_UNUSED)
29{
30/* Don't free the event data after dispatching the event. We keep track of
31 * it on our own
32 */
33}
34
35
27/* The Tizen sensor type ENUM has shown to not be stable regarding its 36/* The Tizen sensor type ENUM has shown to not be stable regarding its
28 * numbering scheme so we better translate between the Tizen types and the 37 * numbering scheme so we better translate between the Tizen types and the
29 * ones we use here. 38 * ones we use here.
@@ -98,7 +107,7 @@ eeze_to_tizen(Eeze_Sensor_Type type)
98 107
99/* Reverse mapping from Tizen to eeze sensor types */ 108/* Reverse mapping from Tizen to eeze sensor types */
100static Eeze_Sensor_Type 109static Eeze_Sensor_Type
101tizen_to_eeze(sesnor_type_e type) 110tizen_to_eeze(sensor_type_e type)
102{ 111{
103 switch (type) 112 switch (type)
104 { 113 {
@@ -186,12 +195,11 @@ clock_convert(unsigned long long timestamp)
186static void 195static void
187accelerometer_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 196accelerometer_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
188{ 197{
189 Eeze_Sensor_Obj *obj = NULL; 198 Eeze_Sensor_Obj *obj = user_data;
190 199
191 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_ACCELEROMETER);
192 if (obj == NULL) 200 if (obj == NULL)
193 { 201 {
194 ERR("No matching sensor object found in list."); 202 ERR("No matching sensor object given.");
195 return; 203 return;
196 } 204 }
197 obj->accuracy = accuracy; 205 obj->accuracy = accuracy;
@@ -199,19 +207,18 @@ accelerometer_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy,
199 obj->data[1] = y; 207 obj->data[1] = y;
200 obj->data[2] = z; 208 obj->data[2] = z;
201 obj->timestamp = clock_convert(timestamp); 209 obj->timestamp = clock_convert(timestamp);
202 ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, obj, NULL, NULL); 210 ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, obj, _dummy_free, NULL);
203 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ACCELEROMETER)); 211 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ACCELEROMETER));
204} 212}
205 213
206static void 214static void
207gravity_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 215gravity_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
208{ 216{
209 Eeze_Sensor_Obj *obj = NULL; 217 Eeze_Sensor_Obj *obj = user_data;
210 218
211 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_GRAVITY);
212 if (obj == NULL) 219 if (obj == NULL)
213 { 220 {
214 ERR("No matching sensor object found in list."); 221 ERR("No matching sensor object given.");
215 return; 222 return;
216 } 223 }
217 obj->accuracy = accuracy; 224 obj->accuracy = accuracy;
@@ -219,19 +226,18 @@ gravity_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float
219 obj->data[1] = y; 226 obj->data[1] = y;
220 obj->data[2] = z; 227 obj->data[2] = z;
221 obj->timestamp = clock_convert(timestamp); 228 obj->timestamp = clock_convert(timestamp);
222 ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, NULL, NULL); 229 ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, _dummy_free, NULL);
223 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GRAVITY)); 230 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GRAVITY));
224} 231}
225 232
226static void 233static void
227linear_acceleration_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 234linear_acceleration_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
228{ 235{
229 Eeze_Sensor_Obj *obj = NULL; 236 Eeze_Sensor_Obj *obj = user_data;
230 237
231 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION);
232 if (obj == NULL) 238 if (obj == NULL)
233 { 239 {
234 ERR("No matching sensor object found in list."); 240 ERR("No matching sensor object given.");
235 return; 241 return;
236 } 242 }
237 obj->accuracy = accuracy; 243 obj->accuracy = accuracy;
@@ -239,7 +245,7 @@ linear_acceleration_cb(unsigned long long timestamp, sensor_data_accuracy_e accu
239 obj->data[1] = y; 245 obj->data[1] = y;
240 obj->data[2] = z; 246 obj->data[2] = z;
241 obj->timestamp = clock_convert(timestamp); 247 obj->timestamp = clock_convert(timestamp);
242 ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, NULL, NULL); 248 ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, _dummy_free, NULL);
243 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION)); 249 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION));
244} 250}
245 251
@@ -247,12 +253,11 @@ static void
247device_orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float yaw, 253device_orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float yaw,
248 float pitch, float roll, void *user_data) 254 float pitch, float roll, void *user_data)
249{ 255{
250 Eeze_Sensor_Obj *obj = NULL; 256 Eeze_Sensor_Obj *obj = user_data;
251 257
252 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION);
253 if (obj == NULL) 258 if (obj == NULL)
254 { 259 {
255 ERR("No matching sensor object found in list."); 260 ERR("No matching sensor object given.");
256 return; 261 return;
257 } 262 }
258 obj->accuracy = accuracy; 263 obj->accuracy = accuracy;
@@ -260,19 +265,18 @@ device_orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accur
260 obj->data[1] = pitch; 265 obj->data[1] = pitch;
261 obj->data[2] = roll; 266 obj->data[2] = roll;
262 obj->timestamp = clock_convert(timestamp); 267 obj->timestamp = clock_convert(timestamp);
263 ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, NULL, NULL); 268 ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, _dummy_free, NULL);
264 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION)); 269 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION));
265} 270}
266 271
267static void 272static void
268magnetic_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 273magnetic_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
269{ 274{
270 Eeze_Sensor_Obj *obj = NULL; 275 Eeze_Sensor_Obj *obj = user_data;
271 276
272 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MAGNETIC);
273 if (obj == NULL) 277 if (obj == NULL)
274 { 278 {
275 ERR("No matching sensor object found in list."); 279 ERR("No matching sensor object given.");
276 return; 280 return;
277 } 281 }
278 obj->accuracy = accuracy; 282 obj->accuracy = accuracy;
@@ -280,19 +284,18 @@ magnetic_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float
280 obj->data[1] = y; 284 obj->data[1] = y;
281 obj->data[2] = z; 285 obj->data[2] = z;
282 obj->timestamp = clock_convert(timestamp); 286 obj->timestamp = clock_convert(timestamp);
283 ecore_event_add(EEZE_SENSOR_EVENT_MAGNETIC, obj, NULL, NULL); 287 ecore_event_add(EEZE_SENSOR_EVENT_MAGNETIC, obj, _dummy_free, NULL);
284 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MAGNETIC)); 288 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MAGNETIC));
285} 289}
286 290
287static void 291static void
288orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float azimuth, float pitch, float roll, void *user_data) 292orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float azimuth, float pitch, float roll, void *user_data)
289{ 293{
290 Eeze_Sensor_Obj *obj = NULL; 294 Eeze_Sensor_Obj *obj = user_data;
291 295
292 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_ORIENTATION);
293 if (obj == NULL) 296 if (obj == NULL)
294 { 297 {
295 ERR("No matching sensor object found in list."); 298 ERR("No matching sensor object given.");
296 return; 299 return;
297 } 300 }
298 obj->accuracy = accuracy; 301 obj->accuracy = accuracy;
@@ -300,19 +303,18 @@ orientation_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, fl
300 obj->data[1] = pitch; 303 obj->data[1] = pitch;
301 obj->data[2] = roll; 304 obj->data[2] = roll;
302 obj->timestamp = clock_convert(timestamp); 305 obj->timestamp = clock_convert(timestamp);
303 ecore_event_add(EEZE_SENSOR_EVENT_ORIENTATION, obj, NULL, NULL); 306 ecore_event_add(EEZE_SENSOR_EVENT_ORIENTATION, obj, _dummy_free, NULL);
304 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ORIENTATION)); 307 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ORIENTATION));
305} 308}
306 309
307static void 310static void
308gyroscope_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 311gyroscope_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
309{ 312{
310 Eeze_Sensor_Obj *obj = NULL; 313 Eeze_Sensor_Obj *obj = user_data;
311 314
312 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_GYROSCOPE);
313 if (obj == NULL) 315 if (obj == NULL)
314 { 316 {
315 ERR("No matching sensor object found in list."); 317 ERR("No matching sensor object given.");
316 return; 318 return;
317 } 319 }
318 obj->accuracy = accuracy; 320 obj->accuracy = accuracy;
@@ -320,95 +322,90 @@ gyroscope_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, floa
320 obj->data[1] = y; 322 obj->data[1] = y;
321 obj->data[2] = z; 323 obj->data[2] = z;
322 obj->timestamp = clock_convert(timestamp); 324 obj->timestamp = clock_convert(timestamp);
323 ecore_event_add(EEZE_SENSOR_EVENT_GYROSCOPE, obj, NULL, NULL); 325 ecore_event_add(EEZE_SENSOR_EVENT_GYROSCOPE, obj, _dummy_free, NULL);
324 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GYROSCOPE)); 326 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GYROSCOPE));
325} 327}
326 328
327static void 329static void
328light_cb(unsigned long long timestamp, float lux, void *user_data) 330light_cb(unsigned long long timestamp, float lux, void *user_data)
329{ 331{
330 Eeze_Sensor_Obj *obj = NULL; 332 Eeze_Sensor_Obj *obj = user_data;
331 333
332 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_LIGHT);
333 if (obj == NULL) 334 if (obj == NULL)
334 { 335 {
335 ERR("No matching sensor object found in list."); 336 ERR("No matching sensor object given.");
336 return; 337 return;
337 } 338 }
338 /* We have to set this ourselves because we don't get it for this type */ 339 /* We have to set this ourselves because we don't get it for this type */
339 obj->accuracy = -1; 340 obj->accuracy = -1;
340 obj->data[0] = lux; 341 obj->data[0] = lux;
341 obj->timestamp = clock_convert(timestamp); 342 obj->timestamp = clock_convert(timestamp);
342 ecore_event_add(EEZE_SENSOR_EVENT_LIGHT, obj, NULL, NULL); 343 ecore_event_add(EEZE_SENSOR_EVENT_LIGHT, obj, _dummy_free, NULL);
343 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LIGHT)); 344 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LIGHT));
344} 345}
345 346
346static void 347static void
347proximity_cb(unsigned long long timestamp, float distance, void *user_data) 348proximity_cb(unsigned long long timestamp, float distance, void *user_data)
348{ 349{
349 Eeze_Sensor_Obj *obj = NULL; 350 Eeze_Sensor_Obj *obj = user_data;
350 351
351 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_PROXIMITY);
352 if (obj == NULL) 352 if (obj == NULL)
353 { 353 {
354 ERR("No matching sensor object found in list."); 354 ERR("No matching sensor object given.");
355 return; 355 return;
356 } 356 }
357 /* We have to set this ourselves because we don't get it for this type */ 357 /* We have to set this ourselves because we don't get it for this type */
358 obj->accuracy = -1; 358 obj->accuracy = -1;
359 obj->data[0] = distance; 359 obj->data[0] = distance;
360 obj->timestamp = clock_convert(timestamp); 360 obj->timestamp = clock_convert(timestamp);
361 ecore_event_add(EEZE_SENSOR_EVENT_PROXIMITY, obj, NULL, NULL); 361 ecore_event_add(EEZE_SENSOR_EVENT_PROXIMITY, obj, _dummy_free, NULL);
362 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_PROXIMITY)); 362 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_PROXIMITY));
363} 363}
364 364
365static void 365static void
366snap_cb(unsigned long long timestamp, sensor_motion_snap_e snap, void *user_data) 366snap_cb(unsigned long long timestamp, sensor_motion_snap_e snap, void *user_data)
367{ 367{
368 Eeze_Sensor_Obj *obj = NULL; 368 Eeze_Sensor_Obj *obj = user_data;
369 369
370 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_SNAP);
371 if (obj == NULL) 370 if (obj == NULL)
372 { 371 {
373 ERR("No matching sensor object found in list."); 372 ERR("No matching sensor object given.");
374 return; 373 return;
375 } 374 }
376 /* We have to set this ourselves because we don't get it for this type */ 375 /* We have to set this ourselves because we don't get it for this type */
377 obj->accuracy = -1; 376 obj->accuracy = -1;
378 obj->data[0] = snap; 377 obj->data[0] = snap;
379 obj->timestamp = clock_convert(timestamp); 378 obj->timestamp = clock_convert(timestamp);
380 ecore_event_add(EEZE_SENSOR_EVENT_SNAP, obj, NULL, NULL); 379 ecore_event_add(EEZE_SENSOR_EVENT_SNAP, obj, _dummy_free, NULL);
381 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SNAP)); 380 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SNAP));
382} 381}
383 382
384static void 383static void
385shake_cb(unsigned long long timestamp, sensor_motion_shake_e shake, void *user_data) 384shake_cb(unsigned long long timestamp, sensor_motion_shake_e shake, void *user_data)
386{ 385{
387 Eeze_Sensor_Obj *obj = NULL; 386 Eeze_Sensor_Obj *obj = user_data;
388 387
389 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_SHAKE);
390 if (obj == NULL) 388 if (obj == NULL)
391 { 389 {
392 ERR("No matching sensor object found in list."); 390 ERR("No matching sensor object given.");
393 return; 391 return;
394 } 392 }
395 /* We have to set this ourselves because we don't get it for this type */ 393 /* We have to set this ourselves because we don't get it for this type */
396 obj->accuracy = -1; 394 obj->accuracy = -1;
397 obj->data[0] = shake; 395 obj->data[0] = shake;
398 obj->timestamp = clock_convert(timestamp); 396 obj->timestamp = clock_convert(timestamp);
399 ecore_event_add(EEZE_SENSOR_EVENT_SHAKE, obj, NULL, NULL); 397 ecore_event_add(EEZE_SENSOR_EVENT_SHAKE, obj, _dummy_free, NULL);
400 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SHAKE)); 398 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SHAKE));
401} 399}
402 400
403static void 401static void
404panning_cb(unsigned long long timestamp, int x, int y, void *user_data) 402panning_cb(unsigned long long timestamp, int x, int y, void *user_data)
405{ 403{
406 Eeze_Sensor_Obj *obj = NULL; 404 Eeze_Sensor_Obj *obj = user_data;
407 405
408 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_PANNING);
409 if (obj == NULL) 406 if (obj == NULL)
410 { 407 {
411 ERR("No matching sensor object found in list."); 408 ERR("No matching sensor object given.");
412 return; 409 return;
413 } 410 }
414 /* We have to set this ourselves because we don't get it for this type */ 411 /* We have to set this ourselves because we don't get it for this type */
@@ -416,19 +413,18 @@ panning_cb(unsigned long long timestamp, int x, int y, void *user_data)
416 obj->data[0] = x; 413 obj->data[0] = x;
417 obj->data[1] = y; 414 obj->data[1] = y;
418 obj->timestamp = clock_convert(timestamp); 415 obj->timestamp = clock_convert(timestamp);
419 ecore_event_add(EEZE_SENSOR_EVENT_PANNING, obj, NULL, NULL); 416 ecore_event_add(EEZE_SENSOR_EVENT_PANNING, obj, _dummy_free, NULL);
420 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING)); 417 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING));
421} 418}
422 419
423static void 420static void
424panning_browse_cb(unsigned long long timestamp, int x, int y, void *user_data) 421panning_browse_cb(unsigned long long timestamp, int x, int y, void *user_data)
425{ 422{
426 Eeze_Sensor_Obj *obj = NULL; 423 Eeze_Sensor_Obj *obj = user_data;
427 424
428 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE);
429 if (obj == NULL) 425 if (obj == NULL)
430 { 426 {
431 ERR("No matching sensor object found in list."); 427 ERR("No matching sensor object given.");
432 return; 428 return;
433 } 429 }
434 /* We have to set this ourselves because we don't get it for this type */ 430 /* We have to set this ourselves because we don't get it for this type */
@@ -436,19 +432,18 @@ panning_browse_cb(unsigned long long timestamp, int x, int y, void *user_data)
436 obj->data[0] = x; 432 obj->data[0] = x;
437 obj->data[1] = y; 433 obj->data[1] = y;
438 obj->timestamp = clock_convert(timestamp); 434 obj->timestamp = clock_convert(timestamp);
439 ecore_event_add(EEZE_SENSOR_EVENT_PANNING_BROWSE, obj, NULL, NULL); 435 ecore_event_add(EEZE_SENSOR_EVENT_PANNING_BROWSE, obj, _dummy_free, NULL);
440 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE)); 436 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE));
441} 437}
442 438
443static void 439static void
444tilt_cb(unsigned long long timestamp, int x, int y, void *user_data) 440tilt_cb(unsigned long long timestamp, int x, int y, void *user_data)
445{ 441{
446 Eeze_Sensor_Obj *obj = NULL; 442 Eeze_Sensor_Obj *obj = user_data;
447 443
448 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_TILT);
449 if (obj == NULL) 444 if (obj == NULL)
450 { 445 {
451 ERR("No matching sensor object found in list."); 446 ERR("No matching sensor object given.");
452 return; 447 return;
453 } 448 }
454 /* We have to set this ourselves because we don't get it for this type */ 449 /* We have to set this ourselves because we don't get it for this type */
@@ -456,25 +451,24 @@ tilt_cb(unsigned long long timestamp, int x, int y, void *user_data)
456 obj->data[0] = x; 451 obj->data[0] = x;
457 obj->data[1] = y; 452 obj->data[1] = y;
458 obj->timestamp = clock_convert(timestamp); 453 obj->timestamp = clock_convert(timestamp);
459 ecore_event_add(EEZE_SENSOR_EVENT_TILT, obj, NULL, NULL); 454 ecore_event_add(EEZE_SENSOR_EVENT_TILT, obj, _dummy_free, NULL);
460 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_TILT)); 455 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_TILT));
461} 456}
462 457
463static void 458static void
464facedown_cb(unsigned long long timestamp, void *user_data) 459facedown_cb(unsigned long long timestamp, void *user_data)
465{ 460{
466 Eeze_Sensor_Obj *obj = NULL; 461 Eeze_Sensor_Obj *obj = user_data;
467 462
468 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_FACEDOWN);
469 if (obj == NULL) 463 if (obj == NULL)
470 { 464 {
471 ERR("No matching sensor object found in list."); 465 ERR("No matching sensor object given.");
472 return; 466 return;
473 } 467 }
474 /* We have to set this ourselves because we don't get it for this type */ 468 /* We have to set this ourselves because we don't get it for this type */
475 obj->accuracy = -1; 469 obj->accuracy = -1;
476 obj->timestamp = clock_convert(timestamp); 470 obj->timestamp = clock_convert(timestamp);
477 ecore_event_add(EEZE_SENSOR_EVENT_FACEDOWN, obj, NULL, NULL); 471 ecore_event_add(EEZE_SENSOR_EVENT_FACEDOWN, obj, _dummy_free, NULL);
478 /* We are not stopping the sensor here because we want to keep it as a motion 472 /* We are not stopping the sensor here because we want to keep it as a motion
479 * event coming in at any time. 473 * event coming in at any time.
480 */ 474 */
@@ -483,18 +477,17 @@ facedown_cb(unsigned long long timestamp, void *user_data)
483static void 477static void
484directcall_cb(unsigned long long timestamp, void *user_data) 478directcall_cb(unsigned long long timestamp, void *user_data)
485{ 479{
486 Eeze_Sensor_Obj *obj = NULL; 480 Eeze_Sensor_Obj *obj = user_data;
487 481
488 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL);
489 if (obj == NULL) 482 if (obj == NULL)
490 { 483 {
491 ERR("No matching sensor object found in list."); 484 ERR("No matching sensor object given.");
492 return; 485 return;
493 } 486 }
494 /* We have to set this ourselves because we don't get it for this type */ 487 /* We have to set this ourselves because we don't get it for this type */
495 obj->accuracy = -1; 488 obj->accuracy = -1;
496 obj->timestamp = clock_convert(timestamp); 489 obj->timestamp = clock_convert(timestamp);
497 ecore_event_add(EEZE_SENSOR_EVENT_DIRECT_CALL, obj, NULL, NULL); 490 ecore_event_add(EEZE_SENSOR_EVENT_DIRECT_CALL, obj, _dummy_free, NULL);
498 /* We are not stopping the sensor here because we want to keep it as a motion 491 /* We are not stopping the sensor here because we want to keep it as a motion
499 * event coming in at any time. 492 * event coming in at any time.
500 */ 493 */
@@ -503,18 +496,17 @@ directcall_cb(unsigned long long timestamp, void *user_data)
503static void 496static void
504smart_alert_cb(unsigned long long timestamp, void *user_data) 497smart_alert_cb(unsigned long long timestamp, void *user_data)
505{ 498{
506 Eeze_Sensor_Obj *obj = NULL; 499 Eeze_Sensor_Obj *obj = user_data;
507 500
508 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_SMART_ALERT);
509 if (obj == NULL) 501 if (obj == NULL)
510 { 502 {
511 ERR("No matching sensor object found in list."); 503 ERR("No matching sensor object given.");
512 return; 504 return;
513 } 505 }
514 /* We have to set this ourselves because we don't get it for this type */ 506 /* We have to set this ourselves because we don't get it for this type */
515 obj->accuracy = -1; 507 obj->accuracy = -1;
516 obj->timestamp = clock_convert(timestamp); 508 obj->timestamp = clock_convert(timestamp);
517 ecore_event_add(EEZE_SENSOR_EVENT_SMART_ALERT, obj, NULL, NULL); 509 ecore_event_add(EEZE_SENSOR_EVENT_SMART_ALERT, obj, _dummy_free, NULL);
518 /* We are not stopping the sensor here because we want to keep it as a motion 510 /* We are not stopping the sensor here because we want to keep it as a motion
519 * event coming in at any time. 511 * event coming in at any time.
520 */ 512 */
@@ -523,18 +515,17 @@ smart_alert_cb(unsigned long long timestamp, void *user_data)
523static void 515static void
524no_move_cb(unsigned long long timestamp, void *user_data) 516no_move_cb(unsigned long long timestamp, void *user_data)
525{ 517{
526 Eeze_Sensor_Obj *obj = NULL; 518 Eeze_Sensor_Obj *obj = user_data;
527 519
528 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_NO_MOVE);
529 if (obj == NULL) 520 if (obj == NULL)
530 { 521 {
531 ERR("No matching sensor object found in list."); 522 ERR("No matching sensor object given.");
532 return; 523 return;
533 } 524 }
534 /* We have to set this ourselves because we don't get it for this type */ 525 /* We have to set this ourselves because we don't get it for this type */
535 obj->accuracy = -1; 526 obj->accuracy = -1;
536 obj->timestamp = clock_convert(timestamp); 527 obj->timestamp = clock_convert(timestamp);
537 ecore_event_add(EEZE_SENSOR_EVENT_NO_MOVE, obj, NULL, NULL); 528 ecore_event_add(EEZE_SENSOR_EVENT_NO_MOVE, obj, _dummy_free, NULL);
538 /* We are not stopping the sensor here because we want to keep it as a motion 529 /* We are not stopping the sensor here because we want to keep it as a motion
539 * event coming in at any time. 530 * event coming in at any time.
540 */ 531 */
@@ -543,18 +534,17 @@ no_move_cb(unsigned long long timestamp, void *user_data)
543static void 534static void
544doubletap_cb(unsigned long long timestamp, void *user_data) 535doubletap_cb(unsigned long long timestamp, void *user_data)
545{ 536{
546 Eeze_Sensor_Obj *obj = NULL; 537 Eeze_Sensor_Obj *obj = user_data;
547 538
548 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP);
549 if (obj == NULL) 539 if (obj == NULL)
550 { 540 {
551 ERR("No matching sensor object found in list."); 541 ERR("No matching sensor object given.");
552 return; 542 return;
553 } 543 }
554 /* We have to set this ourselves because we don't get it for this type */ 544 /* We have to set this ourselves because we don't get it for this type */
555 obj->accuracy = -1; 545 obj->accuracy = -1;
556 obj->timestamp = clock_convert(timestamp); 546 obj->timestamp = clock_convert(timestamp);
557 ecore_event_add(EEZE_SENSOR_EVENT_DOUBLETAP, obj, NULL, NULL); 547 ecore_event_add(EEZE_SENSOR_EVENT_DOUBLETAP, obj, _dummy_free, NULL);
558 /* We are not stopping the sensor here because we want to keep it as a motion 548 /* We are not stopping the sensor here because we want to keep it as a motion
559 * event coming in at any time. 549 * event coming in at any time.
560 */ 550 */
@@ -563,14 +553,13 @@ doubletap_cb(unsigned long long timestamp, void *user_data)
563static void 553static void
564accelerometer_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 554accelerometer_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
565{ 555{
566 Eeze_Sensor_Obj *obj = NULL; 556 Eeze_Sensor_Obj *obj = user_data;
567 557
568 sensor_accelerometer_unset_cb(sensor_handle); 558 sensor_accelerometer_unset_cb(sensor_handle);
569 559
570 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_ACCELEROMETER);
571 if (obj == NULL) 560 if (obj == NULL)
572 { 561 {
573 ERR("No matching sensor object found in list."); 562 ERR("No matching sensor object given.");
574 return; 563 return;
575 } 564 }
576 obj->accuracy = accuracy; 565 obj->accuracy = accuracy;
@@ -578,21 +567,20 @@ accelerometer_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accur
578 obj->data[1] = y; 567 obj->data[1] = y;
579 obj->data[2] = z; 568 obj->data[2] = z;
580 obj->timestamp = clock_convert(timestamp); 569 obj->timestamp = clock_convert(timestamp);
581 ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, obj, NULL, NULL); 570 ecore_event_add(EEZE_SENSOR_EVENT_ACCELEROMETER, obj, _dummy_free, NULL);
582 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ACCELEROMETER)); 571 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ACCELEROMETER));
583} 572}
584 573
585static void 574static void
586gravity_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 575gravity_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
587{ 576{
588 Eeze_Sensor_Obj *obj = NULL; 577 Eeze_Sensor_Obj *obj = user_data;
589 578
590 sensor_gravity_unset_cb(sensor_handle); 579 sensor_gravity_unset_cb(sensor_handle);
591 580
592 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_GRAVITY);
593 if (obj == NULL) 581 if (obj == NULL)
594 { 582 {
595 ERR("No matching sensor object found in list."); 583 ERR("No matching sensor object given.");
596 return; 584 return;
597 } 585 }
598 obj->accuracy = accuracy; 586 obj->accuracy = accuracy;
@@ -600,21 +588,20 @@ gravity_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, f
600 obj->data[1] = y; 588 obj->data[1] = y;
601 obj->data[2] = z; 589 obj->data[2] = z;
602 obj->timestamp = clock_convert(timestamp); 590 obj->timestamp = clock_convert(timestamp);
603 ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, NULL, NULL); 591 ecore_event_add(EEZE_SENSOR_EVENT_GRAVITY, obj, _dummy_free, NULL);
604 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GRAVITY)); 592 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GRAVITY));
605} 593}
606 594
607static void 595static void
608linear_acceleration_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 596linear_acceleration_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
609{ 597{
610 Eeze_Sensor_Obj *obj = NULL; 598 Eeze_Sensor_Obj *obj = user_data;
611 599
612 sensor_linear_acceleration_unset_cb(sensor_handle); 600 sensor_linear_acceleration_unset_cb(sensor_handle);
613 601
614 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION);
615 if (obj == NULL) 602 if (obj == NULL)
616 { 603 {
617 ERR("No matching sensor object found in list."); 604 ERR("No matching sensor object given.");
618 return; 605 return;
619 } 606 }
620 obj->accuracy = accuracy; 607 obj->accuracy = accuracy;
@@ -622,7 +609,7 @@ linear_acceleration_read_cb(unsigned long long timestamp, sensor_data_accuracy_e
622 obj->data[1] = y; 609 obj->data[1] = y;
623 obj->data[2] = z; 610 obj->data[2] = z;
624 obj->timestamp = clock_convert(timestamp); 611 obj->timestamp = clock_convert(timestamp);
625 ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, NULL, NULL); 612 ecore_event_add(EEZE_SENSOR_EVENT_LINEAR_ACCELERATION, obj, _dummy_free, NULL);
626 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION)); 613 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LINEAR_ACCELERATION));
627} 614}
628 615
@@ -630,14 +617,13 @@ static void
630device_orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float yaw, 617device_orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float yaw,
631 float pitch, float roll, void *user_data) 618 float pitch, float roll, void *user_data)
632{ 619{
633 Eeze_Sensor_Obj *obj = NULL; 620 Eeze_Sensor_Obj *obj = user_data;
634 621
635 sensor_device_orientation_unset_cb(sensor_handle); 622 sensor_device_orientation_unset_cb(sensor_handle);
636 623
637 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION);
638 if (obj == NULL) 624 if (obj == NULL)
639 { 625 {
640 ERR("No matching sensor object found in list."); 626 ERR("No matching sensor object given.");
641 return; 627 return;
642 } 628 }
643 obj->accuracy = accuracy; 629 obj->accuracy = accuracy;
@@ -645,21 +631,20 @@ device_orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e
645 obj->data[1] = pitch; 631 obj->data[1] = pitch;
646 obj->data[2] = roll; 632 obj->data[2] = roll;
647 obj->timestamp = clock_convert(timestamp); 633 obj->timestamp = clock_convert(timestamp);
648 ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, NULL, NULL); 634 ecore_event_add(EEZE_SENSOR_EVENT_DEVICE_ORIENTATION, obj, _dummy_free, NULL);
649 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION)); 635 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_DEVICE_ORIENTATION));
650} 636}
651 637
652static void 638static void
653magnetic_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 639magnetic_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
654{ 640{
655 Eeze_Sensor_Obj *obj = NULL; 641 Eeze_Sensor_Obj *obj = user_data;
656 642
657 sensor_magnetic_unset_cb(sensor_handle); 643 sensor_magnetic_unset_cb(sensor_handle);
658 644
659 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MAGNETIC);
660 if (obj == NULL) 645 if (obj == NULL)
661 { 646 {
662 ERR("No matching sensor object found in list."); 647 ERR("No matching sensor object given.");
663 return; 648 return;
664 } 649 }
665 obj->accuracy = accuracy; 650 obj->accuracy = accuracy;
@@ -667,21 +652,20 @@ magnetic_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy,
667 obj->data[1] = y; 652 obj->data[1] = y;
668 obj->data[2] = z; 653 obj->data[2] = z;
669 obj->timestamp = clock_convert(timestamp); 654 obj->timestamp = clock_convert(timestamp);
670 ecore_event_add(EEZE_SENSOR_EVENT_MAGNETIC, obj, NULL, NULL); 655 ecore_event_add(EEZE_SENSOR_EVENT_MAGNETIC, obj, _dummy_free, NULL);
671 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MAGNETIC)); 656 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MAGNETIC));
672} 657}
673 658
674static void 659static void
675orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float azimuth, float pitch, float roll, void *user_data) 660orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float azimuth, float pitch, float roll, void *user_data)
676{ 661{
677 Eeze_Sensor_Obj *obj = NULL; 662 Eeze_Sensor_Obj *obj = user_data;
678 663
679 sensor_orientation_unset_cb(sensor_handle); 664 sensor_orientation_unset_cb(sensor_handle);
680 665
681 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_ORIENTATION);
682 if (obj == NULL) 666 if (obj == NULL)
683 { 667 {
684 ERR("No matching sensor object found in list."); 668 ERR("No matching sensor object given.");
685 return; 669 return;
686 } 670 }
687 obj->accuracy = accuracy; 671 obj->accuracy = accuracy;
@@ -689,21 +673,20 @@ orientation_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accurac
689 obj->data[1] = pitch; 673 obj->data[1] = pitch;
690 obj->data[2] = roll; 674 obj->data[2] = roll;
691 obj->timestamp = clock_convert(timestamp); 675 obj->timestamp = clock_convert(timestamp);
692 ecore_event_add(EEZE_SENSOR_EVENT_ORIENTATION, obj, NULL, NULL); 676 ecore_event_add(EEZE_SENSOR_EVENT_ORIENTATION, obj, _dummy_free, NULL);
693 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ORIENTATION)); 677 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_ORIENTATION));
694} 678}
695 679
696static void 680static void
697gyroscope_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data) 681gyroscope_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy, float x, float y, float z, void *user_data)
698{ 682{
699 Eeze_Sensor_Obj *obj = NULL; 683 Eeze_Sensor_Obj *obj = user_data;
700 684
701 sensor_gyroscope_unset_cb(sensor_handle); 685 sensor_gyroscope_unset_cb(sensor_handle);
702 686
703 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_GYROSCOPE);
704 if (obj == NULL) 687 if (obj == NULL)
705 { 688 {
706 ERR("No matching sensor object found in list."); 689 ERR("No matching sensor object given.");
707 return; 690 return;
708 } 691 }
709 obj->accuracy = accuracy; 692 obj->accuracy = accuracy;
@@ -711,125 +694,119 @@ gyroscope_read_cb(unsigned long long timestamp, sensor_data_accuracy_e accuracy,
711 obj->data[1] = y; 694 obj->data[1] = y;
712 obj->data[2] = z; 695 obj->data[2] = z;
713 obj->timestamp = clock_convert(timestamp); 696 obj->timestamp = clock_convert(timestamp);
714 ecore_event_add(EEZE_SENSOR_EVENT_GYROSCOPE, obj, NULL, NULL); 697 ecore_event_add(EEZE_SENSOR_EVENT_GYROSCOPE, obj, _dummy_free, NULL);
715 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GYROSCOPE)); 698 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_GYROSCOPE));
716} 699}
717 700
718static void 701static void
719light_read_cb(unsigned long long timestamp, float lux, void *user_data) 702light_read_cb(unsigned long long timestamp, float lux, void *user_data)
720{ 703{
721 Eeze_Sensor_Obj *obj = NULL; 704 Eeze_Sensor_Obj *obj = user_data;
722 705
723 sensor_light_unset_cb(sensor_handle); 706 sensor_light_unset_cb(sensor_handle);
724 707
725 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_LIGHT);
726 if (obj == NULL) 708 if (obj == NULL)
727 { 709 {
728 ERR("No matching sensor object found in list."); 710 ERR("No matching sensor object given.");
729 return; 711 return;
730 } 712 }
731 /* We have to set this ourselves because we don't get it for this type */ 713 /* We have to set this ourselves because we don't get it for this type */
732 obj->accuracy = -1; 714 obj->accuracy = -1;
733 obj->data[0] = lux; 715 obj->data[0] = lux;
734 obj->timestamp = clock_convert(timestamp); 716 obj->timestamp = clock_convert(timestamp);
735 ecore_event_add(EEZE_SENSOR_EVENT_LIGHT, obj, NULL, NULL); 717 ecore_event_add(EEZE_SENSOR_EVENT_LIGHT, obj, _dummy_free, NULL);
736 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LIGHT)); 718 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_LIGHT));
737} 719}
738 720
739static void 721static void
740proximity_read_cb(unsigned long long timestamp, float distance, void *user_data) 722proximity_read_cb(unsigned long long timestamp, float distance, void *user_data)
741{ 723{
742 Eeze_Sensor_Obj *obj = NULL; 724 Eeze_Sensor_Obj *obj = user_data;
743 725
744 sensor_proximity_unset_cb(sensor_handle); 726 sensor_proximity_unset_cb(sensor_handle);
745 727
746 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_PROXIMITY);
747 if (obj == NULL) 728 if (obj == NULL)
748 { 729 {
749 ERR("No matching sensor object found in list."); 730 ERR("No matching sensor object given.");
750 return; 731 return;
751 } 732 }
752 /* We have to set this ourselves because we don't get it for this type */ 733 /* We have to set this ourselves because we don't get it for this type */
753 bj->accuracy = -1; 734 bj->accuracy = -1;
754 obj->data[0] = distance; 735 obj->data[0] = distance;
755 obj->timestamp = clock_convert(timestamp); 736 obj->timestamp = clock_convert(timestamp);
756 ecore_event_add(EEZE_SENSOR_EVENT_PROXIMITY, obj, NULL, NULL); 737 ecore_event_add(EEZE_SENSOR_EVENT_PROXIMITY, obj, _dummy_free, NULL);
757 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_PROXIMITY)); 738 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_PROXIMITY));
758} 739}
759 740
760static void 741static void
761snap_read_cb(unsigned long long timestamp, sensor_motion_snap_e snap, void *user_data) 742snap_read_cb(unsigned long long timestamp, sensor_motion_snap_e snap, void *user_data)
762{ 743{
763 Eeze_Sensor_Obj *obj = NULL; 744 Eeze_Sensor_Obj *obj = user_data;
764 745
765 sensor_motion_snap_unset_cb(sensor_handle); 746 sensor_motion_snap_unset_cb(sensor_handle);
766 747
767 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_SNAP);
768 if (obj == NULL) 748 if (obj == NULL)
769 { 749 {
770 ERR("No matching sensor object found in list."); 750 ERR("No matching sensor object given.");
771 return; 751 return;
772 } 752 }
773 /* We have to set this ourselves because we don't get it for this type */ 753 /* We have to set this ourselves because we don't get it for this type */
774 obj->accuracy = -1; 754 obj->accuracy = -1;
775 obj->data[0] = snap; 755 obj->data[0] = snap;
776 obj->timestamp = clock_convert(timestamp); 756 obj->timestamp = clock_convert(timestamp);
777 ecore_event_add(EEZE_SENSOR_EVENT_SNAP, obj, NULL, NULL); 757 ecore_event_add(EEZE_SENSOR_EVENT_SNAP, obj, _dummy_free, NULL);
778 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SNAP)); 758 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SNAP));
779} 759}
780 760
781static void 761static void
782shake_read_cb(unsigned long long timestamp, sensor_motion_shake_e shake, void *user_data) 762shake_read_cb(unsigned long long timestamp, sensor_motion_shake_e shake, void *user_data)
783{ 763{
784 Eeze_Sensor_Obj *obj = NULL; 764 Eeze_Sensor_Obj *obj = user_data;
785 765
786 sensor_motion_shake_unset_cb(sensor_handle); 766 sensor_motion_shake_unset_cb(sensor_handle);
787 767
788 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_SHAKE);
789 if (obj == NULL) 768 if (obj == NULL)
790 { 769 {
791 ERR("No matching sensor object found in list."); 770 ERR("No matching sensor object given.");
792 return; 771 return;
793 } 772 }
794 /* We have to set this ourselves because we don't get it for this type */ 773 /* We have to set this ourselves because we don't get it for this type */
795 obj->accuracy = -1; 774 obj->accuracy = -1;
796 obj->data[0] = shake; 775 obj->data[0] = shake;
797 obj->timestamp = clock_convert(timestamp); 776 obj->timestamp = clock_convert(timestamp);
798 ecore_event_add(EEZE_SENSOR_EVENT_SHAKE, obj, NULL, NULL); 777 ecore_event_add(EEZE_SENSOR_EVENT_SHAKE, obj, _dummy_free, NULL);
799 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SHAKE)); 778 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SHAKE));
800} 779}
801 780
802static void 781static void
803doubletap_read_cb(unsigned long long timestamp, void *user_data) 782doubletap_read_cb(unsigned long long timestamp, void *user_data)
804{ 783{
805 Eeze_Sensor_Obj *obj = NULL; 784 Eeze_Sensor_Obj *obj = user_data;
806 785
807 sensor_motion_doubletap_unset_cb(sensor_handle); 786 sensor_motion_doubletap_unset_cb(sensor_handle);
808 787
809 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP);
810 if (obj == NULL) 788 if (obj == NULL)
811 { 789 {
812 ERR("No matching sensor object found in list."); 790 ERR("No matching sensor object given.");
813 return; 791 return;
814 } 792 }
815 /* We have to set this ourselves because we don't get it for this type */ 793 /* We have to set this ourselves because we don't get it for this type */
816 obj->accuracy = -1; 794 obj->accuracy = -1;
817 obj->timestamp = clock_convert(timestamp); 795 obj->timestamp = clock_convert(timestamp);
818 ecore_event_add(EEZE_SENSOR_EVENT_DOUBLETAP, obj, NULL, NULL); 796 ecore_event_add(EEZE_SENSOR_EVENT_DOUBLETAP, obj, _dummy_free, NULL);
819 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP)); 797 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DOUBLETAP));
820} 798}
821 799
822static void 800static void
823panning_read_cb(unsigned long long timestamp, int x, int y, void *user_data) 801panning_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
824{ 802{
825 Eeze_Sensor_Obj *obj = NULL; 803 Eeze_Sensor_Obj *obj = user_data;
826 804
827 sensor_motion_panning_unset_cb(sensor_handle); 805 sensor_motion_panning_unset_cb(sensor_handle);
828 806
829 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_PANNING);
830 if (obj == NULL) 807 if (obj == NULL)
831 { 808 {
832 ERR("No matching sensor object found in list."); 809 ERR("No matching sensor object given.");
833 return; 810 return;
834 } 811 }
835 /* We have to set this ourselves because we don't get it for this type */ 812 /* We have to set this ourselves because we don't get it for this type */
@@ -837,21 +814,20 @@ panning_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
837 obj->data[0] = x; 814 obj->data[0] = x;
838 obj->data[1] = y; 815 obj->data[1] = y;
839 obj->timestamp = clock_convert(timestamp); 816 obj->timestamp = clock_convert(timestamp);
840 ecore_event_add(EEZE_SENSOR_EVENT_PANNING, obj, NULL, NULL); 817 ecore_event_add(EEZE_SENSOR_EVENT_PANNING, obj, _dummy_free, NULL);
841 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING)); 818 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING));
842} 819}
843 820
844static void 821static void
845panning_browse_read_cb(unsigned long long timestamp, int x, int y, void *user_data) 822panning_browse_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
846{ 823{
847 Eeze_Sensor_Obj *obj = NULL; 824 Eeze_Sensor_Obj *obj = user_data;
848 825
849 sensor_motion_panning_browse_unset_cb(sensor_handle); 826 sensor_motion_panning_browse_unset_cb(sensor_handle);
850 827
851 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE);
852 if (obj == NULL) 828 if (obj == NULL)
853 { 829 {
854 ERR("No matching sensor object found in list."); 830 ERR("No matching sensor object given.");
855 return; 831 return;
856 } 832 }
857 /* We have to set this ourselves because we don't get it for this type */ 833 /* We have to set this ourselves because we don't get it for this type */
@@ -859,21 +835,20 @@ panning_browse_read_cb(unsigned long long timestamp, int x, int y, void *user_da
859 obj->data[0] = x; 835 obj->data[0] = x;
860 obj->data[1] = y; 836 obj->data[1] = y;
861 obj->timestamp = clock_convert(timestamp); 837 obj->timestamp = clock_convert(timestamp);
862 ecore_event_add(EEZE_SENSOR_EVENT_PANNING_BROWSE, obj, NULL, NULL); 838 ecore_event_add(EEZE_SENSOR_EVENT_PANNING_BROWSE, obj, _dummy_free, NULL);
863 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE)); 839 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_PANNING_BROWSE));
864} 840}
865 841
866static void 842static void
867tilt_read_cb(unsigned long long timestamp, int x, int y, void *user_data) 843tilt_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
868{ 844{
869 Eeze_Sensor_Obj *obj = NULL; 845 Eeze_Sensor_Obj *obj = user_data;
870 846
871 sensor_motion_tilt_unset_cb(sensor_handle); 847 sensor_motion_tilt_unset_cb(sensor_handle);
872 848
873 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_TILT);
874 if (obj == NULL) 849 if (obj == NULL)
875 { 850 {
876 ERR("No matching sensor object found in list."); 851 ERR("No matching sensor object given.");
877 return; 852 return;
878 } 853 }
879 /* We have to set this ourselves because we don't get it for this type */ 854 /* We have to set this ourselves because we don't get it for this type */
@@ -881,87 +856,83 @@ tilt_read_cb(unsigned long long timestamp, int x, int y, void *user_data)
881 obj->data[0] = x; 856 obj->data[0] = x;
882 obj->data[1] = y; 857 obj->data[1] = y;
883 obj->timestamp = clock_convert(timestamp); 858 obj->timestamp = clock_convert(timestamp);
884 ecore_event_add(EEZE_SENSOR_EVENT_TILT, obj, NULL, NULL); 859 ecore_event_add(EEZE_SENSOR_EVENT_TILT, obj, _dummy_free, NULL);
885 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_TILT)); 860 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_TILT));
886} 861}
887 862
888static void 863static void
889facedown_read_cb(unsigned long long timestamp, void *user_data) 864facedown_read_cb(unsigned long long timestamp, void *user_data)
890{ 865{
891 Eeze_Sensor_Obj *obj = NULL; 866 Eeze_Sensor_Obj *obj = user_data;
892 867
893 sensor_motion_facedown_unset_cb(sensor_handle); 868 sensor_motion_facedown_unset_cb(sensor_handle);
894 869
895 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_FACEDOWN);
896 if (obj == NULL) 870 if (obj == NULL)
897 { 871 {
898 ERR("No matching sensor object found in list."); 872 ERR("No matching sensor object given.");
899 return; 873 return;
900 } 874 }
901 /* We have to set this ourselves because we don't get it for this type */ 875 /* We have to set this ourselves because we don't get it for this type */
902 obj->accuracy = -1; 876 obj->accuracy = -1;
903 obj->timestamp = clock_convert(timestamp); 877 obj->timestamp = clock_convert(timestamp);
904 ecore_event_add(EEZE_SENSOR_EVENT_FACEDOWN, obj, NULL, NULL); 878 ecore_event_add(EEZE_SENSOR_EVENT_FACEDOWN, obj, _dummy_free, NULL);
905 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_FACEDOWN)); 879 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_FACEDOWN));
906} 880}
907 881
908static void 882static void
909directcall_read_cb(unsigned long long timestamp, void *user_data) 883directcall_read_cb(unsigned long long timestamp, void *user_data)
910{ 884{
911 Eeze_Sensor_Obj *obj = NULL; 885 Eeze_Sensor_Obj *obj = user_data;
912 886
913 sensor_motion_directcall_unset_cb(sensor_handle); 887 sensor_motion_directcall_unset_cb(sensor_handle);
914 888
915 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL);
916 if (obj == NULL) 889 if (obj == NULL)
917 { 890 {
918 ERR("No matching sensor object found in list."); 891 ERR("No matching sensor object given.");
919 return; 892 return;
920 } 893 }
921 /* We have to set this ourselves because we don't get it for this type */ 894 /* We have to set this ourselves because we don't get it for this type */
922 obj->accuracy = -1; 895 obj->accuracy = -1;
923 obj->timestamp = clock_convert(timestamp); 896 obj->timestamp = clock_convert(timestamp);
924 ecore_event_add(EEZE_SENSOR_EVENT_DIRECT_CALL, obj, NULL, NULL); 897 ecore_event_add(EEZE_SENSOR_EVENT_DIRECT_CALL, obj, _dummy_free, NULL);
925 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL)); 898 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_DIRECT_CALL));
926} 899}
927 900
928static void 901static void
929smart_alert_read_cb(unsigned long long timestamp, void *user_data) 902smart_alert_read_cb(unsigned long long timestamp, void *user_data)
930{ 903{
931 Eeze_Sensor_Obj *obj = NULL; 904 Eeze_Sensor_Obj *obj = user_data;
932 905
933 sensor_motion_smart_alert_unset_cb(sensor_handle); 906 sensor_motion_smart_alert_unset_cb(sensor_handle);
934 907
935 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_SMART_ALERT);
936 if (obj == NULL) 908 if (obj == NULL)
937 { 909 {
938 ERR("No matching sensor object found in list."); 910 ERR("No matching sensor object given.");
939 return; 911 return;
940 } 912 }
941 /* We have to set this ourselves because we don't get it for this type */ 913 /* We have to set this ourselves because we don't get it for this type */
942 obj->accuracy = -1; 914 obj->accuracy = -1;
943 obj->timestamp = clock_convert(timestamp); 915 obj->timestamp = clock_convert(timestamp);
944 ecore_event_add(EEZE_SENSOR_EVENT_SMART_ALERT, obj, NULL, NULL); 916 ecore_event_add(EEZE_SENSOR_EVENT_SMART_ALERT, obj, _dummy_free, NULL);
945 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SMART_ALERT)); 917 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_SMART_ALERT));
946} 918}
947 919
948static void 920static void
949no_move_read_cb(unsigned long long timestamp, void *user_data) 921no_move_read_cb(unsigned long long timestamp, void *user_data)
950{ 922{
951 Eeze_Sensor_Obj *obj = NULL; 923 Eeze_Sensor_Obj *obj = user_data;
952 924
953 sensor_motion_no_move_unset_cb(sensor_handle); 925 sensor_motion_no_move_unset_cb(sensor_handle);
954 926
955 obj = eeze_sensor_obj_get(EEZE_SENSOR_TYPE_MOTION_NO_MOVE);
956 if (obj == NULL) 927 if (obj == NULL)
957 { 928 {
958 ERR("No matching sensor object found in list."); 929 ERR("No matching sensor object given.");
959 return; 930 return;
960 } 931 }
961 /* We have to set this ourselves because we don't get it for this type */ 932 /* We have to set this ourselves because we don't get it for this type */
962 obj->accuracy = -1; 933 obj->accuracy = -1;
963 obj->timestamp = clock_convert(timestamp); 934 obj->timestamp = clock_convert(timestamp);
964 ecore_event_add(EEZE_SENSOR_EVENT_NO_MOVE, obj, NULL, NULL); 935 ecore_event_add(EEZE_SENSOR_EVENT_NO_MOVE, obj, _dummy_free, NULL);
965 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_NO_MOVE)); 936 sensor_stop(sensor_handle, eeze_to_tizen(EEZE_SENSOR_TYPE_MOTION_NO_MOVE));
966} 937}
967 938
@@ -1189,90 +1160,93 @@ eeze_sensor_tizen_cb_set(Eeze_Sensor *handle, Eeze_Sensor_Type sensor_type, void
1189 * data. This is handled in the core and not in the different modules though. 1160 * data. This is handled in the core and not in the different modules though.
1190 */ 1161 */
1191static Eina_Bool 1162static Eina_Bool
1192eeze_sensor_tizen_async_read(Eeze_Sensor_Type sensor_type, void *user_data) 1163eeze_sensor_tizen_async_read(Eeze_Sensor_Obj *obj, void *user_data)
1193{ 1164{
1194 sensor_type_e type; 1165 sensor_type_e type;
1195 1166
1196 type = eeze_to_tizen(sensor_type); 1167 if (user_data)
1168 obj->user_data = user_data;
1169
1170 type = eeze_to_tizen(obj->type);
1197 1171
1198 sensor_start(sensor_handle, type); 1172 sensor_start(sensor_handle, type);
1199 1173
1200 switch (type) 1174 switch (type)
1201 { 1175 {
1202 case SENSOR_ACCELEROMETER: 1176 case SENSOR_ACCELEROMETER:
1203 sensor_accelerometer_set_cb(sensor_handle, 0, accelerometer_read_cb, NULL); 1177 sensor_accelerometer_set_cb(sensor_handle, 0, accelerometer_read_cb, obj);
1204 break; 1178 break;
1205 1179
1206 case SENSOR_GRAVITY: 1180 case SENSOR_GRAVITY:
1207 sensor_gravity_set_cb(sensor_handle, 0, gravity_read_cb, NULL); 1181 sensor_gravity_set_cb(sensor_handle, 0, gravity_read_cb, obj);
1208 break; 1182 break;
1209 1183
1210 case SENSOR_LINEAR_ACCELERATION: 1184 case SENSOR_LINEAR_ACCELERATION:
1211 sensor_linear_acceleration_set_cb(sensor_handle, 0, linear_acceleration_read_cb, NULL); 1185 sensor_linear_acceleration_set_cb(sensor_handle, 0, linear_acceleration_read_cb, obj);
1212 break; 1186 break;
1213 1187
1214 case SENSOR_DEVICE_ORIENTATION: 1188 case SENSOR_DEVICE_ORIENTATION:
1215 sensor_device_orientation_set_cb(sensor_handle, 0, device_orientation_read_cb, NULL); 1189 sensor_device_orientation_set_cb(sensor_handle, 0, device_orientation_read_cb, obj);
1216 break; 1190 break;
1217 1191
1218 case SENSOR_MAGNETIC: 1192 case SENSOR_MAGNETIC:
1219 sensor_magnetic_set_cb(sensor_handle, 0, magnetic_read_cb, NULL); 1193 sensor_magnetic_set_cb(sensor_handle, 0, magnetic_read_cb, obj);
1220 break; 1194 break;
1221 1195
1222 case SENSOR_ORIENTATION: 1196 case SENSOR_ORIENTATION:
1223 sensor_orientation_set_cb(sensor_handle, 0, orientation_read_cb, NULL); 1197 sensor_orientation_set_cb(sensor_handle, 0, orientation_read_cb, obj);
1224 break; 1198 break;
1225 1199
1226 case SENSOR_GYROSCOPE: 1200 case SENSOR_GYROSCOPE:
1227 sensor_gyroscope_set_cb(sensor_handle, 0, gyroscope_read_cb, NULL); 1201 sensor_gyroscope_set_cb(sensor_handle, 0, gyroscope_read_cb, obj);
1228 break; 1202 break;
1229 1203
1230 case SENSOR_LIGHT: 1204 case SENSOR_LIGHT:
1231 sensor_light_set_cb(sensor_handle, 0, light_read_cb, NULL); 1205 sensor_light_set_cb(sensor_handle, 0, light_read_cb, obj);
1232 break; 1206 break;
1233 1207
1234 case SENSOR_PROXIMITY: 1208 case SENSOR_PROXIMITY:
1235 sensor_proximity_set_cb(sensor_handle, 0, proximity_read_cb, NULL); 1209 sensor_proximity_set_cb(sensor_handle, 0, proximity_read_cb, obj);
1236 break; 1210 break;
1237 1211
1238 case SENSOR_MOTION_SNAP: 1212 case SENSOR_MOTION_SNAP:
1239 sensor_motion_snap_set_cb(sensor_handle, snap_read_cb, NULL); 1213 sensor_motion_snap_set_cb(sensor_handle, snap_read_cb, obj);
1240 break; 1214 break;
1241 1215
1242 case SENSOR_MOTION_SHAKE: 1216 case SENSOR_MOTION_SHAKE:
1243 sensor_motion_shake_set_cb(sensor_handle, shake_read_cb, NULL); 1217 sensor_motion_shake_set_cb(sensor_handle, shake_read_cb, obj);
1244 break; 1218 break;
1245 1219
1246 case SENSOR_MOTION_DOUBLETAP: 1220 case SENSOR_MOTION_DOUBLETAP:
1247 sensor_motion_doubletap_set_cb(sensor_handle, doubletap_read_cb, NULL); 1221 sensor_motion_doubletap_set_cb(sensor_handle, doubletap_read_cb, obj);
1248 break; 1222 break;
1249 1223
1250 case SENSOR_MOTION_PANNING: 1224 case SENSOR_MOTION_PANNING:
1251 sensor_motion_panning_set_cb(sensor_handle, panning_read_cb, NULL); 1225 sensor_motion_panning_set_cb(sensor_handle, panning_read_cb, obj);
1252 break; 1226 break;
1253 1227
1254 case SENSOR_MOTION_PANNING_BROWSE: 1228 case SENSOR_MOTION_PANNING_BROWSE:
1255 sensor_motion_panning_browse_set_cb(sensor_handle, panning_browse_read_cb, NULL); 1229 sensor_motion_panning_browse_set_cb(sensor_handle, panning_browse_read_cb, obj);
1256 break; 1230 break;
1257 1231
1258 case SENSOR_MOTION_TILT: 1232 case SENSOR_MOTION_TILT:
1259 sensor_motion_tilt_set_cb(sensor_handle, tilt_read_cb, NULL); 1233 sensor_motion_tilt_set_cb(sensor_handle, tilt_read_cb, obj);
1260 break; 1234 break;
1261 1235
1262 case SENSOR_MOTION_FACEDOWN: 1236 case SENSOR_MOTION_FACEDOWN:
1263 sensor_motion_facedown_set_cb(sensor_handle, facedown_read_cb, NULL); 1237 sensor_motion_facedown_set_cb(sensor_handle, facedown_read_cb, obj);
1264 break; 1238 break;
1265 1239
1266 case SENSOR_MOTION_DIRECTCALL: 1240 case SENSOR_MOTION_DIRECTCALL:
1267 sensor_motion_directcall_set_cb(sensor_handle, directcall_read_cb, NULL); 1241 sensor_motion_directcall_set_cb(sensor_handle, directcall_read_cb, obj);
1268 break; 1242 break;
1269 1243
1270 case SENSOR_MOTION_SMART_ALERT: 1244 case SENSOR_MOTION_SMART_ALERT:
1271 sensor_motion_smart_alert_set_cb(sensor_handle, smart_alert_read_cb, NULL); 1245 sensor_motion_smart_alert_set_cb(sensor_handle, smart_alert_read_cb, obj);
1272 break; 1246 break;
1273 1247
1274 case SENSOR_MOTION_NO_MOVE: 1248 case SENSOR_MOTION_NO_MOVE:
1275 sensor_motion_no_move_set_cb(sensor_handle, no_move_read_cb, NULL); 1249 sensor_motion_no_move_set_cb(sensor_handle, no_move_read_cb, obj);
1276 break; 1250 break;
1277 1251
1278 default: 1252 default:
@@ -1341,8 +1315,10 @@ eeze_sensor_tizen_init(void)
1341 /* FIXME add other motion events in here */ 1315 /* FIXME add other motion events in here */
1342 sensor_start(sensor_handle, SENSOR_MOTION_FACEDOWN); 1316 sensor_start(sensor_handle, SENSOR_MOTION_FACEDOWN);
1343 sensor_start(sensor_handle, SENSOR_MOTION_DOUBLETAP); 1317 sensor_start(sensor_handle, SENSOR_MOTION_DOUBLETAP);
1344 sensor_motion_doubletap_set_cb(sensor_handle, doubletap_cb, NULL); 1318 sensor_motion_doubletap_set_cb(sensor_handle, doubletap_cb,
1345 sensor_motion_facedown_set_cb(sensor_handle, facedown_cb, NULL); 1319 eeze_sensor_obj_get(EEZE_SENSOR_TYPE_DOUBLETAP));
1320 sensor_motion_facedown_set_cb(sensor_handle, facedown_cb,
1321 eeze_sensor_obj_get(EEZE_SENSOR_TYPE_FACEDOWN));
1346 1322
1347 return EINA_TRUE; 1323 return EINA_TRUE;
1348} 1324}
diff --git a/src/modules/eeze/sensor/udev/udev.c b/src/modules/eeze/sensor/udev/udev.c
index a23bf5e84d..3e7e6b3e17 100644
--- a/src/modules/eeze/sensor/udev/udev.c
+++ b/src/modules/eeze/sensor/udev/udev.c
@@ -22,6 +22,14 @@ static Eeze_Sensor_Module *esensor_module;
22 22
23static Eina_List *devices; 23static Eina_List *devices;
24 24
25static void
26_dummy_free(void *user_data EINA_UNUSED, void *func_data EINA_UNUSED)
27{
28/* Don't free the event data after dispatching the event. We keep track of
29 * it on our own
30 */
31}
32
25static Eina_Bool 33static Eina_Bool
26udev_init(void) 34udev_init(void)
27{ 35{
@@ -110,18 +118,12 @@ udev_read(Eeze_Sensor_Obj *obj)
110} 118}
111 119
112static Eina_Bool 120static Eina_Bool
113udev_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED) 121udev_async_read(Eeze_Sensor_Obj *obj, void *user_data)
114{ 122{
115 Eeze_Sensor_Obj *obj = NULL; 123 if (user_data)
124 obj->user_data = user_data;
116 125
117 obj = eeze_sensor_obj_get(sensor_type); 126 switch (obj->type)
118 if (obj == NULL)
119 {
120 ERR("No matching sensor object found in list.");
121 return EINA_FALSE;
122 }
123
124 switch (sensor_type)
125 { 127 {
126 case EEZE_SENSOR_TYPE_TEMPERATURE: 128 case EEZE_SENSOR_TYPE_TEMPERATURE:
127 obj->accuracy = -1; 129 obj->accuracy = -1;
@@ -129,12 +131,11 @@ udev_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED)
129 obj->data[1] = 0; 131 obj->data[1] = 0;
130 obj->data[2] = 0; 132 obj->data[2] = 0;
131 obj->timestamp = ecore_time_get(); 133 obj->timestamp = ecore_time_get();
132 ecore_event_add(EEZE_SENSOR_EVENT_TEMPERATURE, obj, NULL, NULL); 134 ecore_event_add(EEZE_SENSOR_EVENT_TEMPERATURE, obj, _dummy_free, NULL);
133 break; 135 break;
134 136
135 default: 137 default:
136 ERR("Not possible to read from this sensor type."); 138 ERR("Not possible to read from this sensor type.");
137 free(obj);
138 return EINA_FALSE; 139 return EINA_FALSE;
139 } 140 }
140 return EINA_TRUE; 141 return EINA_TRUE;