summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2013-04-10 14:48:29 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2013-04-10 17:19:21 +0100
commit7d17130db6659244e0c601a4573aadf845eeaba5 (patch)
tree2055ba1298c3b8a55f479bb611e58495233668dc /src
parent84fa062d6e958d4a8fd547c96ef571eab6106e4a (diff)
eeze/sensor: Check if sens is valid the same way we do in other cases.
Diffstat (limited to 'src')
-rw-r--r--src/bin/eeze/eeze_sensor_test.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/bin/eeze/eeze_sensor_test.c b/src/bin/eeze/eeze_sensor_test.c
index 2fa7e6ecfb..3e800204e9 100644
--- a/src/bin/eeze/eeze_sensor_test.c
+++ b/src/bin/eeze/eeze_sensor_test.c
@@ -147,13 +147,17 @@ main(void)
147 * values. Depending on the hardware this can take a long time. If you don't have special 147 * values. Depending on the hardware this can take a long time. If you don't have special
148 * requirements the cached values should be used. */ 148 * requirements the cached values should be used. */
149 sens = eeze_sensor_new(EEZE_SENSOR_TYPE_LIGHT); 149 sens = eeze_sensor_new(EEZE_SENSOR_TYPE_LIGHT);
150 eeze_sensor_read(sens); 150 if (sens)
151 if (!sens) printf("can't find an light sensor!\n"); 151 {
152 if (!eeze_sensor_x_get(sens, &x)) printf("fail get x\n"); 152 eeze_sensor_read(sens);
153 if (!eeze_sensor_accuracy_get(sens, &acc)) printf("fail get accuracy\n"); 153 if (!eeze_sensor_x_get(sens, &x)) printf("fail get x\n");
154 if (!eeze_sensor_timestamp_get(sens, &timestamp)) printf("fail get timestamp\n"); 154 if (!eeze_sensor_accuracy_get(sens, &acc)) printf("fail get accuracy\n");
155 printf("Light output: accuracy %i, lux %f at time: %lli\n", acc, x, timestamp); 155 if (!eeze_sensor_timestamp_get(sens, &timestamp)) printf("fail get timestamp\n");
156 eeze_sensor_free(sens); 156 printf("Light output: accuracy %i, lux %f at time: %lli\n", acc, x, timestamp);
157 eeze_sensor_free(sens);
158 }
159 else
160 printf("Could not find an light sensor!\n");
157 161
158 printf("=== Test async reads / events: ===\n"); 162 printf("=== Test async reads / events: ===\n");
159 /* Async read request for sensors. You have to register an event handler for 163 /* Async read request for sensors. You have to register an event handler for