aboutsummaryrefslogtreecommitdiffstats
path: root/android/ui-ctl-ui.h
blob: 4359ba1605746186943983ca8559922529e974bf (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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/* Copyright (C) 2010 The Android Open Source Project
**
** This software is licensed under the terms of the GNU General Public
** License version 2, as published by the Free Software Foundation, and
** may be copied, distributed, and modified under those terms.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
*/

#ifndef _ANDROID_UI_CONTROL_UI_H
#define _ANDROID_UI_CONTROL_UI_H

/*
 * Contains UI-side of UI control protocols. For the simplicity of implementation
 * there are two UI control services: "ui-core-control" that handle UI controls
 * initiated in the UI, and "core-ui-control" that handle UI controls initiated
 * in the core. The reason for hawing two services is that some of the UI
 * controls expect the core to respond with some data. The simplest way to
 * differentiate core commands from core responses to the UI commands, is to have
 * two separate services: one sends commands only, and another sends only
 * responses.
 */

#include "sockets.h"
#include "android/ui-ctl-common.h"

/* Establishes connection with UI control services in the core.
 * Param:
 *  console_socket Core's console socket.
 * Return:
 *  0 on success, or < 0 on failure.
 */
int clientuictl_create(SockAddress* console_socket);

/*
 * UI->Core API
 */

/* Sends AUI_UICTL_SET_COARSE_ORIENTATION message to the core.
 * Return:
 *  0 on success, or < 0 on failure.
 */
int clientuictl_set_coarse_orientation(AndroidCoarseOrientation orient);

/* Sends AUI_UICTL_TOGGLE_NETWORK message to the core.
 * Return:
 *  0 on success, or < 0 on failure.
 */
int clientuictl_toggle_network();

/* Sends AUI_UICTL_TRACE_CONTROL message to the core.
 * Param:
 *  start - Starts (> 0), or stops (== 0) tracing.
 * Return:
 *  0 on success, or < 0 on failure.
 */
int clientuictl_trace_control(int start);

/* Sends AUI_UICTL_CHK_NETWORK_DISABLED message to the core.
 * Return:
 *  0 if network is enabled, 1 if it is disabled, or < 0 on failure.
 */
int clientuictl_check_network_disabled();

/* Sends AUI_UICTL_GET_NETSPEED message to the core.
 * Param:
 *  index - Index of an entry in the NetworkSpeed array.
 *  netspeed - Upon success contains allocated and initialized NetworkSpeed
 *  instance for the given index. Note that strings addressed by "name" and
 *  "display" fileds in the returned NetworkSpeed instance are containd inside
 *  the buffer allocated for the returned NetworkSpeed instance. Caller of this
 *  routine must eventually free the buffer returned in this parameter.
 * Return:
 *  0 on success, or < 0 on failure.
 */
int clientuictl_get_netspeed(int index, NetworkSpeed** netspeed);

/* Sends AUI_UICTL_GET_NETDELAY message to the core.
 * Param:
 *  index - Index of an entry in the NetworkLatency array.
 *  netdelay - Upon success contains allocated and initialized NetworkLatency
 *  instance for the given index. Note that strings addressed by "name" and
 *  "display" fileds in the returned NetworkLatency instance are containd inside
 *  the buffer allocated for the returned NetworkLatency instance. Caller of this
 *  routine must eventually free the buffer returned in this parameter.
 * Return:
 *  0 on success, or < 0 on failure.
 */
int clientuictl_get_netdelay(int index, NetworkLatency** netdelay);

/* Sends AUI_UICTL_GET_QEMU_PATH message to the core.
 * Param:
 *  type, filename - Query parameters
 *  netdelay - Upon success contains allocated and initialized NetworkLatency
 *  instance for the given index. Note that strings addressed by "name" and
 *  "display" fileds in the returned NetworkLatency instance are containd inside
 *  the buffer allocated for the returned NetworkLatency instance. Caller of this
 *  routine must eventually free the buffer returned in this parameter.
 * Return:
 *  0 on success, or < 0 on failure.
 */
int clientuictl_get_qemu_path(int type, const char* filename, char** path);

#endif /* _ANDROID_UI_CONTROL_UI_H */