-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAdbClient.h
More file actions
49 lines (34 loc) · 1.01 KB
/
AdbClient.h
File metadata and controls
49 lines (34 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#pragma once
#include "CommandExecution.h"
class AdbClient
{
public:
AdbClient();
static std::future<CommandExecution::CommandResult> run_async(const CString& command);
static CString run(const CString& command);
static std::vector<CString> DetectDevices();
static bool InstallAPK(const CString& deviceId, std::vector<CString> apks, bool force = false);
~AdbClient();
struct AdbResponse {
std::string status;
std::string data;
};
bool isAdbServerRunning();
bool startAdbServer();
bool stopAdbServer();
std::vector<std::string> getConnectedDevices();
AdbResponse executeCommand(const std::string& command);
;
private:
static const int ADB_PORT = 5037;
static const std::string ADB_HOST;
WSADATA wsaData;
bool wsaInitialized = false;
bool initializeWsa();
void cleanupWsa();
SOCKET createAndConnectSocket();
AdbResponse receiveData(SOCKET sock);
AdbResponse receiveErrorMessage(SOCKET sock);
bool isProcessRunning(const TCHAR* processName);
AdbResponse sendCommand(const std::string& command);
};