blob: 9af176fccfa73da29f6554d49ec0c73f06f326f0 [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
Dan Albert818fb4b2015-02-18 00:18:25 -08006#ifdef __cplusplus
7extern "C" {
8#endif
9
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080010/* connect to adb, connect to the named service, and return
11** a valid fd for interacting with that service upon success
12** or a negative number on failure
13*/
14int adb_connect(const char *service);
15int _adb_connect(const char *service);
16
17/* connect to adb, connect to the named service, return 0 if
18** the connection succeeded AND the service returned OKAY
19*/
20int adb_command(const char *service);
21
22/* connect to adb, connect to the named service, return
23** a malloc'd string of its response upon success or NULL
24** on failure.
25*/
26char *adb_query(const char *service);
27
28/* Set the preferred transport to connect to.
29*/
30void adb_set_transport(transport_type type, const char* serial);
31
Stefan Hilzingerd0eacb82010-04-19 12:21:12 +010032/* Set TCP specifics of the transport to use
33*/
34void adb_set_tcp_specifics(int server_port);
35
Matt Gumbeld7b33082012-11-14 10:16:17 -080036/* Set TCP Hostname of the transport to use
37*/
38void adb_set_tcp_name(const char* hostname);
39
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080040/* Return the console port of the currently connected emulator (if any)
41 * of -1 if there is no emulator, and -2 if there is more than one.
42 * assumes adb_set_transport() was alled previously...
43 */
44int adb_get_emulator_console_port(void);
45
46/* send commands to the current emulator instance. will fail if there
47 * is zero, or more than one emulator connected (or if you use -s <serial>
48 * with a <serial> that does not designate an emulator)
49 */
Dan Albertbac34742015-02-25 17:51:28 -080050int adb_send_emulator_command(int argc, const char** argv);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080051
52/* return verbose error string from last operation */
53const char *adb_error(void);
54
55/* read a standard adb status response (OKAY|FAIL) and
56** return 0 in the event of OKAY, -1 in the event of FAIL
57** or protocol error
58*/
59int adb_status(int fd);
60
Dan Albert818fb4b2015-02-18 00:18:25 -080061#ifdef __cplusplus
62}
63#endif
64
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080065#endif