summaryrefslogtreecommitdiff
path: root/test/system-device.c
blob: 466150b6bc74dc2900d8654d6758182bc150f2fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * 
 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
 * PROPRIETARY/CONFIDENTIAL
 * 
 * This software is the confidential and proprietary information of SAMSUNG 
 * ELECTRONICS ("Confidential Information"). You agree and acknowledge that 
 * this software is owned by Samsung and you shall not disclose such 
 * Confidential Information and shall use it only in accordance with the terms 
 * of the license agreement you entered into with SAMSUNG ELECTRONICS. SAMSUNG 
 * make no representations or warranties about the suitability of the software, 
 * either express or implied, including but not limited to the implied 
 * warranties of merchantability, fitness for a particular purpose, or 
 * non-infringement. SAMSUNG shall not be liable for any damages suffered by 
 * licensee arising out of or related to this software.
 * 
 */

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <glib.h>
#include <device.h>

int main(int argc, char *argv[])
{
	int pct;
	bool is_full;
	int brt, max, cnt;

	if(device_battery_get_percent(&pct) == DEVICE_ERROR_NONE){
		printf("battery percent is %d %%\n", pct);
	}else{
		printf("device_battery_get_percent error\n");
	}

	if(device_battery_is_full(&is_full) == DEVICE_ERROR_NONE){
		printf("battery is %s\n", is_full ? "full" : "not full");
	}else{
		printf("device_battery_is_full error\n");
	}

	if(device_get_max_brightness(0, &max) == DEVICE_ERROR_NONE){
		printf("display brightness max is %d\n", max);
	}else{
		printf("device_get_max_brightness error\n");
	}

    cnt = device_get_display_count();
    printf("display count is %d\n", cnt);

	if(argc > 1){
		brt = atoi(argv[1]);
	}else{
		brt = max / 2;
	}
	if(device_set_brightness(0, brt) == DEVICE_ERROR_NONE){
		printf("set brightness %d\n", brt);
	}else{
		printf("device_set_brightness error\n");
	}

	if(device_get_brightness(0, &brt) == DEVICE_ERROR_NONE){
		printf("display brightness is %d\n", brt);
	}else{
		printf("device_get_brightness error\n");
	}

	return 0;
}