Commit | Line | Data |
---|---|---|
d42e7319 JB |
1 | /* |
2 | * Copyright (c) 2013 Simon Busch <morphis@gravedo.de> | |
3 | * | |
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 | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
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. | |
15 | * | |
16 | */ | |
17 | ||
18 | #include <memory.h> | |
19 | #include <assert.h> | |
20 | #include <stdio.h> | |
21 | #include <android/hardware/lights.h> | |
22 | ||
23 | int main(int argc, char **argv) | |
24 | { | |
25 | struct hw_module_t *hwmod = 0; | |
26 | struct light_device_t *notifications = 0; | |
27 | struct light_state_t notification_state; | |
28 | ||
29 | hw_get_module(LIGHTS_HARDWARE_MODULE_ID, (const hw_module_t**) &hwmod); | |
30 | assert(hwmod != NULL); | |
31 | ||
32 | assert(light_device_open(hwmod, LIGHT_ID_NOTIFICATIONS, ¬ifications) == 0); | |
33 | assert(notifications != 0); | |
34 | ||
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; | |
40 | ||
41 | assert(notifications->set_light(notifications, ¬ification_state) == 0); | |
42 | ||
43 | light_device_close(notifications); | |
44 | ||
45 | return 0; | |
46 | } | |
47 | ||
48 | // vim:ts=4:sw=4:noexpandtab |