MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / create_adb_controller

Function create_adb_controller

sample/cpp/main.cpp:73–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73MaaController* create_adb_controller()
74{
75 auto list_handle = MaaToolkitAdbDeviceListCreate();
76 auto destroy = [&]() {
77 MaaToolkitAdbDeviceListDestroy(list_handle);
78 };
79
80 MaaToolkitAdbDeviceFind(list_handle);
81
82 size_t size = MaaToolkitAdbDeviceListSize(list_handle);
83 if (size == 0) {
84 std::cout << "No device found" << std::endl;
85
86 destroy();
87 return nullptr;
88 }
89
90 const int kIndex = 0; // for demo, we just use the first device
91 auto device_handle = MaaToolkitAdbDeviceListAt(list_handle, kIndex);
92
93 std::string agent_path = "share/MaaAgentBinary";
94 auto controller_handle = MaaAdbControllerCreate(
95 MaaToolkitAdbDeviceGetAdbPath(device_handle),
96 MaaToolkitAdbDeviceGetAddress(device_handle),
97 MaaToolkitAdbDeviceGetScreencapMethods(device_handle),
98 MaaToolkitAdbDeviceGetInputMethods(device_handle),
99 MaaToolkitAdbDeviceGetConfig(device_handle),
100 agent_path.c_str());
101
102 destroy();
103
104 return controller_handle;
105}
106
107MaaController* create_win32_controller()
108{

Callers 1

mainFunction · 0.70

Tested by

no test coverage detected