blob: 235fc56e95e96fba735886c3f0f2fc48cc4369c2 [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 {
Tamas Berghammerdb264a62015-03-31 09:52:22 +000027namespace platform_android {
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000028
29class AdbClient
30{
31public:
32 using DeviceIDList = std::list<std::string>;
33
Oleksiy Vyalov6f001062015-03-25 17:58:13 +000034 static Error
Chaoren Lin3ea689b2015-05-01 16:49:28 +000035 CreateByDeviceID(const std::string &device_id, AdbClient &adb);
Oleksiy Vyalov6f001062015-03-25 17:58:13 +000036
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000037 AdbClient () = default;
38 explicit AdbClient (const std::string &device_id);
39
Oleksiy Vyalov6f001062015-03-25 17:58:13 +000040 const std::string&
41 GetDeviceID() const;
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000042
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
52private:
53 Error
54 Connect ();
55
Oleksiy Vyalov6f001062015-03-25 17:58:13 +000056 void
57 SetDeviceID (const std::string& device_id);
58
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000059 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
Tamas Berghammerdb264a62015-03-31 09:52:22 +000075} // namespace platform_android
Oleksiy Vyalov05a55de2015-03-23 21:03:02 +000076} // namespace lldb_private
77
78#endif // liblldb_AdbClient_h_