summaryrefslogtreecommitdiff
path: root/legacy/eeze
diff options
context:
space:
mode:
authorStefan Schmidt <stefan@datenfreihafen.org>2012-09-28 09:10:47 +0000
committerStefan Schmidt <stefan@datenfreihafen.org>2012-09-28 09:10:47 +0000
commitae81bcdcd5425ae8905f5ce6deb1195ed1776be9 (patch)
treecd9dc2e7836edee9fe0e2e2581165ba404f0bb3d /legacy/eeze
parentc7d300cae36f39b4758966ad128fecc535e0d62d (diff)
eeze/sensor: Fix fake module to set timestamp to microseconds since epoch.
Seconds is not really a suitable resolution for sensor data read outs. This also aligns it with the tizen module and the public API. The sleep is no longer needed in the test program either. SVN revision: 77191
Diffstat (limited to 'legacy/eeze')
-rw-r--r--legacy/eeze/src/bin/eeze_sensor_test.c2
-rw-r--r--legacy/eeze/src/modules/eeze_sensor_fake.c16
2 files changed, 11 insertions, 7 deletions
diff --git a/legacy/eeze/src/bin/eeze_sensor_test.c b/legacy/eeze/src/bin/eeze_sensor_test.c
index a996ef382e..afc082a390 100644
--- a/legacy/eeze/src/bin/eeze_sensor_test.c
+++ b/legacy/eeze/src/bin/eeze_sensor_test.c
@@ -129,8 +129,6 @@ main(void)
129 else 129 else
130 printf("Could not find a light sensor!\n"); 130 printf("Could not find a light sensor!\n");
131 131
132 sleep(1);
133
134 /* Get updated values on a sensor. Read out is synchronous */ 132 /* Get updated values on a sensor. Read out is synchronous */
135 eeze_sensor_read(sens); 133 eeze_sensor_read(sens);
136 if (!sens) printf("can't find an light sensor!\n"); 134 if (!sens) printf("can't find an light sensor!\n");
diff --git a/legacy/eeze/src/modules/eeze_sensor_fake.c b/legacy/eeze/src/modules/eeze_sensor_fake.c
index 194b5c5cda..0a45b67b0a 100644
--- a/legacy/eeze/src/modules/eeze_sensor_fake.c
+++ b/legacy/eeze/src/modules/eeze_sensor_fake.c
@@ -3,7 +3,7 @@
3#endif 3#endif
4 4
5#include <stdio.h> 5#include <stdio.h>
6#include <time.h> 6#include <sys/time.h>
7 7
8#include <Eina.h> 8#include <Eina.h>
9#include <Ecore.h> 9#include <Ecore.h>
@@ -38,6 +38,7 @@ Eina_Bool
38fake_read(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *lobj) 38fake_read(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *lobj)
39{ 39{
40 Eeze_Sensor_Obj *obj = NULL; 40 Eeze_Sensor_Obj *obj = NULL;
41 struct timeval tv;
41 42
42 obj = eeze_sensor_obj_get(sensor_type); 43 obj = eeze_sensor_obj_get(sensor_type);
43 if (obj == NULL) 44 if (obj == NULL)
@@ -56,7 +57,8 @@ fake_read(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *lobj)
56 obj->data[0] = 7; 57 obj->data[0] = 7;
57 obj->data[1] = 23; 58 obj->data[1] = 23;
58 obj->data[2] = 42; 59 obj->data[2] = 42;
59 obj->timestamp = time(NULL); 60 gettimeofday(&tv, NULL);
61 obj->timestamp = ((tv.tv_sec * 1000000) + tv.tv_usec);
60 break; 62 break;
61 63
62 case EEZE_SENSOR_TYPE_LIGHT: 64 case EEZE_SENSOR_TYPE_LIGHT:
@@ -65,7 +67,8 @@ fake_read(Eeze_Sensor_Type sensor_type, Eeze_Sensor_Obj *lobj)
65 case EEZE_SENSOR_TYPE_TEMPERATURE: 67 case EEZE_SENSOR_TYPE_TEMPERATURE:
66 obj->accuracy = 0; 68 obj->accuracy = 0;
67 obj->data[0] = 7; 69 obj->data[0] = 7;
68 obj->timestamp = time(NULL); 70 gettimeofday(&tv, NULL);
71 obj->timestamp = ((tv.tv_sec * 1000000) + tv.tv_usec);
69 break; 72 break;
70 73
71 default: 74 default:
@@ -82,6 +85,7 @@ Eina_Bool
82fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED) 85fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED)
83{ 86{
84 Eeze_Sensor_Obj *obj = NULL; 87 Eeze_Sensor_Obj *obj = NULL;
88 struct timeval tv;
85 89
86 obj = eeze_sensor_obj_get(sensor_type); 90 obj = eeze_sensor_obj_get(sensor_type);
87 if (obj == NULL) 91 if (obj == NULL)
@@ -101,7 +105,8 @@ fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED)
101 obj->data[0] = 7; 105 obj->data[0] = 7;
102 obj->data[1] = 23; 106 obj->data[1] = 23;
103 obj->data[2] = 42; 107 obj->data[2] = 42;
104 obj->timestamp = time(NULL); 108 gettimeofday(&tv, NULL);
109 obj->timestamp = ((tv.tv_sec * 1000000) + tv.tv_usec);
105 break; 110 break;
106 111
107 case EEZE_SENSOR_TYPE_LIGHT: 112 case EEZE_SENSOR_TYPE_LIGHT:
@@ -110,7 +115,8 @@ fake_async_read(Eeze_Sensor_Type sensor_type, void *user_data EINA_UNUSED)
110 case EEZE_SENSOR_TYPE_TEMPERATURE: 115 case EEZE_SENSOR_TYPE_TEMPERATURE:
111 obj->accuracy = 0; 116 obj->accuracy = 0;
112 obj->data[0] = 7; 117 obj->data[0] = 7;
113 obj->timestamp = time(NULL); 118 gettimeofday(&tv, NULL);
119 obj->timestamp = ((tv.tv_sec * 1000000) + tv.tv_usec);
114 break; 120 break;
115 121
116 case EEZE_SENSOR_TYPE_MOTION_SNAP: 122 case EEZE_SENSOR_TYPE_MOTION_SNAP: