~sergiusens/libhybris/autotests

« back to all changes in this revision

Viewing changes to hybris/tests/test_lights.c

  • Committer: Package Import Robot
  • Author(s): Ricardo Salveti de Araujo
  • Date: 2013-06-04 07:33:11 UTC
  • Revision ID: package-import@ubuntu.com-20130604073311-20ldi2hm1axkvjl1
Tags: upstream-0.1.0+git20130601+dfb2e26
ImportĀ upstreamĀ versionĀ 0.1.0+git20130601+dfb2e26

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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, &notifications) == 0);
 
33
        assert(notifications != 0);
 
34
 
 
35
        memset(&notification_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, &notification_state) == 0);
 
42
 
 
43
        light_device_close(notifications);
 
44
 
 
45
        return 0;
 
46
}
 
47
 
 
48
// vim:ts=4:sw=4:noexpandtab