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" 24 #include "lldb/Host/ConnectionFileDescriptor.h" 25 26 namespace lldb_private { 27 namespace platform_android { 28 29 class AdbClient 30 { 31 public: 32 using DeviceIDList = std::list<std::string>; 33 34 static Error 35 CreateByDeviceID(const std::string &device_id, AdbClient &adb); 36 37 AdbClient () = default; 38 explicit AdbClient (const std::string &device_id); 39 40 const std::string& 41 GetDeviceID() const; 42 43 Error 44 GetDevices (DeviceIDList &device_list); 45 46 Error 47 SetPortForwarding (const uint16_t port); 48 49 Error 50 DeletePortForwarding (const uint16_t port); 51 52 private: 53 Error 54 Connect (); 55 56 void 57 SetDeviceID (const std::string& device_id); 58 59 Error 60 SendMessage (const std::string &packet); 61 62 Error 63 SendDeviceMessage (const std::string &packet); 64 65 Error 66 ReadMessage (std::string &message); 67 68 Error 69 ReadResponseStatus (); 70 71 std::string m_device_id; 72 ConnectionFileDescriptor m_conn; 73 }; 74 75 } // namespace platform_android 76 } // namespace lldb_private 77 78 #endif // liblldb_AdbClient_h_ 79