Move ADB communications to AdbClient class - to make it accessible by other components.

http://reviews.llvm.org/D8535

llvm-svn: 233021
diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.h b/lldb/source/Plugins/Platform/Android/AdbClient.h
new file mode 100644
index 0000000..382e304
--- /dev/null
+++ b/lldb/source/Plugins/Platform/Android/AdbClient.h
@@ -0,0 +1,69 @@
+//===-- AdbClient.h ---------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef liblldb_AdbClient_h_
+#define liblldb_AdbClient_h_
+
+// C Includes
+
+// C++ Includes
+
+#include <list>
+#include <string>
+
+// Other libraries and framework includes
+// Project includes
+
+#include "lldb/Core/Error.h"
+
+namespace lldb_private {
+
+class AdbClient
+{
+public:
+    using DeviceIDList = std::list<std::string>;
+
+    AdbClient () = default;
+    explicit AdbClient (const std::string &device_id);
+
+    void
+    SetDeviceID (const std::string& device_id);
+
+    Error
+    GetDevices (DeviceIDList &device_list);
+
+    Error
+    SetPortForwarding (const uint16_t port);
+
+    Error
+    DeletePortForwarding (const uint16_t port);
+
+private:
+    Error
+    Connect ();
+
+    Error
+    SendMessage (const std::string &packet);
+
+    Error
+    SendDeviceMessage (const std::string &packet);
+
+    Error
+    ReadMessage (std::string &message);
+
+    Error
+    ReadResponseStatus ();
+
+    std::string m_device_id;
+    ConnectionFileDescriptor m_conn;
+};
+
+} // namespace lldb_private
+
+#endif  // liblldb_AdbClient_h_