2
* Copyright (c) 2013 Simon Busch <morphis@gravedo.de>
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
21
#include <android/hardware/lights.h>
23
int main(int argc, char **argv)
25
struct hw_module_t *hwmod = 0;
26
struct light_device_t *notifications = 0;
27
struct light_state_t notification_state;
29
hw_get_module(LIGHTS_HARDWARE_MODULE_ID, (const hw_module_t**) &hwmod);
30
assert(hwmod != NULL);
32
assert(light_device_open(hwmod, LIGHT_ID_NOTIFICATIONS, ¬ifications) == 0);
33
assert(notifications != 0);
35
memset(¬ification_state, 0, sizeof(struct light_state_t));
36
notification_state.color = 0xffffffff;
37
notification_state.flashMode = LIGHT_FLASH_TIMED;
38
notification_state.flashOnMS = 1000;
39
notification_state.flashOffMS = 1000;
41
assert(notifications->set_light(notifications, ¬ification_state) == 0);
43
light_device_close(notifications);
48
// vim:ts=4:sw=4:noexpandtab