2 * Flashlight applet (widget) for Maemo.
3 * Copyright (C) 2009 Roman Moravcik
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "../src/flashlight_lib.h"
26 int main (int argc, char **argv)
28 FlashlightContext_t *pContext = NULL;
29 int intensity = 0, status = 0;
31 if (flashlight_init(&pContext) < 0) {
32 printf ("flashlight-test: error initializing flashlight library\n");
36 if (flashlight_open (pContext, "/dev/video0") < 0) {
37 printf ("flashlight-test: error openning device\n");
41 printf ("Enabling flash LEDs in flashlight mode\n");
42 if (flashlight_set_intensity(pContext, 11) < 0) {
43 printf ("flashlight-test: error setting flashlight intensity to 11\n");
47 if (flashlight_get_intensity(pContext, &intensity) < 0) {
48 printf ("flashlight-test: error getting flashlight intensity\n");
51 printf ("Current flashlight intensity is %d\n", intensity);
53 if (flashlight_get_status(pContext, &status) < 0) {
54 printf ("flashlight-test: error getting flashlight status\n");
57 printf ("Current flashlight status is 0x%04x\n", status);
61 printf ("Disabling flash LEDs in flashlight mode\n");
62 if (flashlight_set_intensity(pContext, 0) < 0) {
63 printf ("flashlight-test: error setting flashlight intensity to 0\n");
67 if (flashlight_close (pContext) < 0) {
68 printf ("flashlight-test: error closing device\n");
72 if (flashlight_deinit(pContext) < 0) {
73 printf ("flashlight-test: error deinitializing flashlight library\n");