Oleksiy Vyalov | 05a55de | 2015-03-23 21:03:02 +0000 | [diff] [blame] | 1 | //===-- AdbClient.h ---------------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef liblldb_AdbClient_h_ |
| 11 | #define liblldb_AdbClient_h_ |
| 12 | |
| 13 | // C Includes |
| 14 | |
| 15 | // C++ Includes |
| 16 | |
| 17 | #include <list> |
| 18 | #include <string> |
| 19 | |
| 20 | // Other libraries and framework includes |
| 21 | // Project includes |
| 22 | |
| 23 | #include "lldb/Core/Error.h" |
Oleksiy Vyalov | 6f00106 | 2015-03-25 17:58:13 +0000 | [diff] [blame^] | 24 | #include "lldb/Host/ConnectionFileDescriptor.h" |
Oleksiy Vyalov | 05a55de | 2015-03-23 21:03:02 +0000 | [diff] [blame] | 25 | |
| 26 | namespace lldb_private { |
| 27 | |
| 28 | class AdbClient |
| 29 | { |
| 30 | public: |
| 31 | using DeviceIDList = std::list<std::string>; |
| 32 | |
Oleksiy Vyalov | 6f00106 | 2015-03-25 17:58:13 +0000 | [diff] [blame^] | 33 | static Error |
| 34 | CreateByDeviceID (const char* device_id, AdbClient &adb); |
| 35 | |
Oleksiy Vyalov | 05a55de | 2015-03-23 21:03:02 +0000 | [diff] [blame] | 36 | AdbClient () = default; |
| 37 | explicit AdbClient (const std::string &device_id); |
| 38 | |
Oleksiy Vyalov | 6f00106 | 2015-03-25 17:58:13 +0000 | [diff] [blame^] | 39 | const std::string& |
| 40 | GetDeviceID() const; |
Oleksiy Vyalov | 05a55de | 2015-03-23 21:03:02 +0000 | [diff] [blame] | 41 | |
| 42 | Error |
| 43 | GetDevices (DeviceIDList &device_list); |
| 44 | |
| 45 | Error |
| 46 | SetPortForwarding (const uint16_t port); |
| 47 | |
| 48 | Error |
| 49 | DeletePortForwarding (const uint16_t port); |
| 50 | |
| 51 | private: |
| 52 | Error |
| 53 | Connect (); |
| 54 | |
Oleksiy Vyalov | 6f00106 | 2015-03-25 17:58:13 +0000 | [diff] [blame^] | 55 | void |
| 56 | SetDeviceID (const std::string& device_id); |
| 57 | |
Oleksiy Vyalov | 05a55de | 2015-03-23 21:03:02 +0000 | [diff] [blame] | 58 | Error |
| 59 | SendMessage (const std::string &packet); |
| 60 | |
| 61 | Error |
| 62 | SendDeviceMessage (const std::string &packet); |
| 63 | |
| 64 | Error |
| 65 | ReadMessage (std::string &message); |
| 66 | |
| 67 | Error |
| 68 | ReadResponseStatus (); |
| 69 | |
| 70 | std::string m_device_id; |
| 71 | ConnectionFileDescriptor m_conn; |
| 72 | }; |
| 73 | |
| 74 | } // namespace lldb_private |
| 75 | |
| 76 | #endif // liblldb_AdbClient_h_ |