| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 1 | #ifndef _ADB_CLIENT_H_ | 
|  | 2 | #define _ADB_CLIENT_H_ | 
|  | 3 |  | 
|  | 4 | #include "adb.h" | 
|  | 5 |  | 
| Elliott Hughes | 078f0fc | 2015-04-29 08:35:59 -0700 | [diff] [blame] | 6 | #include <string> | 
|  | 7 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 8 | /* 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 Hughes | 6452a89 | 2015-04-29 12:28:13 -0700 | [diff] [blame] | 12 | int adb_connect(const std::string& service, std::string* error); | 
|  | 13 | int _adb_connect(const std::string& service, std::string* error); | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 14 |  | 
|  | 15 | /* connect to adb, connect to the named service, return 0 if | 
|  | 16 | ** the connection succeeded AND the service returned OKAY | 
|  | 17 | */ | 
| Elliott Hughes | 6452a89 | 2015-04-29 12:28:13 -0700 | [diff] [blame] | 18 | int adb_command(const std::string& service, std::string* error); | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 19 |  | 
| Elliott Hughes | 6452a89 | 2015-04-29 12:28:13 -0700 | [diff] [blame] | 20 | // Connects to the named adb service and fills 'result' with the response. | 
|  | 21 | // Returns true on success; returns false and fills 'error' on failure. | 
|  | 22 | bool adb_query(const std::string& service, std::string* result, std::string* error); | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 23 |  | 
|  | 24 | /* Set the preferred transport to connect to. | 
|  | 25 | */ | 
|  | 26 | void adb_set_transport(transport_type type, const char* serial); | 
|  | 27 |  | 
| Stefan Hilzinger | d0eacb8 | 2010-04-19 12:21:12 +0100 | [diff] [blame] | 28 | /* Set TCP specifics of the transport to use | 
|  | 29 | */ | 
|  | 30 | void adb_set_tcp_specifics(int server_port); | 
|  | 31 |  | 
| Matt Gumbel | d7b3308 | 2012-11-14 10:16:17 -0800 | [diff] [blame] | 32 | /* Set TCP Hostname of the transport to use | 
|  | 33 | */ | 
|  | 34 | void adb_set_tcp_name(const char* hostname); | 
|  | 35 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 36 | /* 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 | */ | 
|  | 40 | int  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 | */ | 
| Dan Albert | bac3474 | 2015-02-25 17:51:28 -0800 | [diff] [blame] | 46 | int  adb_send_emulator_command(int  argc, const char**  argv); | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 47 |  | 
| Elliott Hughes | 078f0fc | 2015-04-29 08:35:59 -0700 | [diff] [blame] | 48 | // Reads a standard adb status response (OKAY|FAIL) and | 
|  | 49 | // returns true in the event of OKAY, false in the event of FAIL | 
|  | 50 | // or protocol error. | 
|  | 51 | bool adb_status(int fd, std::string* error); | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 52 |  | 
| The Android Open Source Project | dd7bc33 | 2009-03-03 19:32:55 -0800 | [diff] [blame] | 53 | #endif |