Merge "sensors:ndk-example-app: rewrite to work with multiple sensors"
diff --git a/lights_example/example-app/Android.mk b/lights_example/example-app/Android.mk
index 2f7feec..6e3caae 100644
--- a/lights_example/example-app/Android.mk
+++ b/lights_example/example-app/Android.mk
@@ -21,6 +21,7 @@
LOCAL_MODULE := lights-hal-example-app
LOCAL_MODULE_TAGS := optional
LOCAL_SRC_FILES := hal-example-app.cpp
+LOCAL_CFLAGS := -Wall -Werror
LOCAL_SHARED_LIBRARIES := \
libc \
libhardware \
diff --git a/lights_example/example-app/hal-example-app.cpp b/lights_example/example-app/hal-example-app.cpp
index ea5faf4..f014bd0 100644
--- a/lights_example/example-app/hal-example-app.cpp
+++ b/lights_example/example-app/hal-example-app.cpp
@@ -38,30 +38,28 @@
}
struct light_state_t state = {
- color: 1,
- flashMode: LIGHT_FLASH_NONE,
- flashOnMS: 0,
- flashOffMS: 0,
- brightnessMode: 0,
- };
- struct light_state_t state_flash = {
- color: 1,
- flashMode: LIGHT_FLASH_TIMED,
- flashOnMS: 50,
- flashOffMS: 50,
- brightnessMode: 0,
+ .color = 0,
+ .flashMode = LIGHT_FLASH_NONE,
+ .flashOnMS = 0,
+ .flashOffMS = 0,
+ .brightnessMode = 0,
};
- // On for three seconds.
+ // Turn light on for three seconds.
+ state.color = 1;
light_device->set_light(light_device, &state);
sleep(3);
// Flash for three seconds.
- light_device->set_light(light_device, &state_flash);
+ state.flashMode = LIGHT_FLASH_TIMED;
+ state.flashOnMS = 50;
+ state.flashOffMS = 50;
+ light_device->set_light(light_device, &state);
sleep(3);
- // Off.
+ // Turn light off.
state.color = 0;
+ state.flashMode = LIGHT_FLASH_NONE;
light_device->set_light(light_device, &state);
light_device->common.close(