blob: 0ec47ca897e39d9ee9ef0c5fd3f7dff337810c02 [file] [log] [blame]
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08001#ifndef _ADB_CLIENT_H_
2#define _ADB_CLIENT_H_
3
4#include "adb.h"
5
6/* connect to adb, connect to the named service, and return
7** a valid fd for interacting with that service upon success
8** or a negative number on failure
9*/
10int adb_connect(const char *service);
11int _adb_connect(const char *service);
12
13/* connect to adb, connect to the named service, return 0 if
14** the connection succeeded AND the service returned OKAY
15*/
16int adb_command(const char *service);
17
18/* connect to adb, connect to the named service, return
19** a malloc'd string of its response upon success or NULL
20** on failure.
21*/
22char *adb_query(const char *service);
23
24/* Set the preferred transport to connect to.
25*/
26void adb_set_transport(transport_type type, const char* serial);
27
Stefan Hilzingerd0eacb82010-04-19 12:21:12 +010028/* Set TCP specifics of the transport to use
29*/
30void adb_set_tcp_specifics(int server_port);
31
Matt Gumbeld7b33082012-11-14 10:16:17 -080032/* Set TCP Hostname of the transport to use
33*/
34void adb_set_tcp_name(const char* hostname);
35
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080036/* Return the console port of the currently connected emulator (if any)
37 * of -1 if there is no emulator, and -2 if there is more than one.
38 * assumes adb_set_transport() was alled previously...
39 */
40int adb_get_emulator_console_port(void);
41
42/* send commands to the current emulator instance. will fail if there
43 * is zero, or more than one emulator connected (or if you use -s <serial>
44 * with a <serial> that does not designate an emulator)
45 */
46int adb_send_emulator_command(int argc, char** argv);
47
48/* return verbose error string from last operation */
49const char *adb_error(void);
50
51/* read a standard adb status response (OKAY|FAIL) and
52** return 0 in the event of OKAY, -1 in the event of FAIL
53** or protocol error
54*/
55int adb_status(int fd);
56
57#endif