blob: 5ce708036a270b3925590ee0f38aac9b1d9dce39 [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
Elliott Hughes078f0fc2015-04-29 08:35:59 -07006#include <string>
7
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -08008/* connect to adb, connect to the named service, and return
9** a valid fd for interacting with that service upon success
10** or a negative number on failure
11*/
Elliott Hughes078f0fc2015-04-29 08:35:59 -070012int adb_connect(const char* service, std::string* error);
13int _adb_connect(const char* service, std::string* error);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080014
15/* connect to adb, connect to the named service, return 0 if
16** the connection succeeded AND the service returned OKAY
17*/
Elliott Hughes078f0fc2015-04-29 08:35:59 -070018int adb_command(const char* service, std::string* error);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080019
20/* connect to adb, connect to the named service, return
21** a malloc'd string of its response upon success or NULL
22** on failure.
23*/
Elliott Hughes078f0fc2015-04-29 08:35:59 -070024char* adb_query(const char* service, std::string* error);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080025
26/* Set the preferred transport to connect to.
27*/
28void adb_set_transport(transport_type type, const char* serial);
29
Stefan Hilzingerd0eacb82010-04-19 12:21:12 +010030/* Set TCP specifics of the transport to use
31*/
32void adb_set_tcp_specifics(int server_port);
33
Matt Gumbeld7b33082012-11-14 10:16:17 -080034/* Set TCP Hostname of the transport to use
35*/
36void adb_set_tcp_name(const char* hostname);
37
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080038/* Return the console port of the currently connected emulator (if any)
39 * of -1 if there is no emulator, and -2 if there is more than one.
40 * assumes adb_set_transport() was alled previously...
41 */
42int adb_get_emulator_console_port(void);
43
44/* send commands to the current emulator instance. will fail if there
45 * is zero, or more than one emulator connected (or if you use -s <serial>
46 * with a <serial> that does not designate an emulator)
47 */
Dan Albertbac34742015-02-25 17:51:28 -080048int adb_send_emulator_command(int argc, const char** argv);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080049
Elliott Hughes078f0fc2015-04-29 08:35:59 -070050// Reads a standard adb status response (OKAY|FAIL) and
51// returns true in the event of OKAY, false in the event of FAIL
52// or protocol error.
53bool adb_status(int fd, std::string* error);
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080054
The Android Open Source Projectdd7bc332009-03-03 19:32:55 -080055#endif