blob: f372b244021c21bbd2f3bfdb88a91988427c6e2e [file] [log] [blame]
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +00001//===-- 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 Vyalov6f001062015-03-25 17:58:13 +000024#include "lldb/Host/ConnectionFileDescriptor.h"
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000025
26namespace lldb_private {
27
28class AdbClient
29{
30public:
31 using DeviceIDList = std::list<std::string>;
32
Oleksiy Vyalov6f001062015-03-25 17:58:13 +000033 static Error
34 CreateByDeviceID (const char* device_id, AdbClient &adb);
35
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000036 AdbClient () = default;
37 explicit AdbClient (const std::string &device_id);
38
Oleksiy Vyalov6f001062015-03-25 17:58:13 +000039 const std::string&
40 GetDeviceID() const;
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000041
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
51private:
52 Error
53 Connect ();
54
Oleksiy Vyalov6f001062015-03-25 17:58:13 +000055 void
56 SetDeviceID (const std::string& device_id);
57
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000058 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_