adb_client.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef _ADB_CLIENT_H_
  2. #define _ADB_CLIENT_H_
  3. #include "adb.h"
  4. /* connect to adb, connect to the named service, and return
  5. ** a valid fd for interacting with that service upon success
  6. ** or a negative number on failure
  7. */
  8. int adb_connect(const char *service);
  9. int _adb_connect(const char *service);
  10. /* connect to adb, connect to the named service, return 0 if
  11. ** the connection succeeded AND the service returned OKAY
  12. */
  13. int adb_command(const char *service);
  14. /* connect to adb, connect to the named service, return
  15. ** a malloc'd string of its response upon success or NULL
  16. ** on failure.
  17. */
  18. char *adb_query(const char *service);
  19. /* Set the preferred transport to connect to.
  20. */
  21. void adb_set_transport(transport_type type, const char* serial);
  22. /* Set TCP specifics of the transport to use
  23. */
  24. void adb_set_tcp_specifics(int server_port);
  25. /* Return the console port of the currently connected emulator (if any)
  26. * of -1 if there is no emulator, and -2 if there is more than one.
  27. * assumes adb_set_transport() was alled previously...
  28. */
  29. int adb_get_emulator_console_port(void);
  30. /* send commands to the current emulator instance. will fail if there
  31. * is zero, or more than one emulator connected (or if you use -s <serial>
  32. * with a <serial> that does not designate an emulator)
  33. */
  34. int adb_send_emulator_command(int argc, char** argv);
  35. /* return verbose error string from last operation */
  36. const char *adb_error(void);
  37. /* read a standard adb status response (OKAY|FAIL) and
  38. ** return 0 in the event of OKAY, -1 in the event of FAIL
  39. ** or protocol error
  40. */
  41. int adb_status(int fd);
  42. #endif