| 10 | #include "Tasker/Tasker.h" |
| 11 | |
| 12 | MaaController* MaaAdbControllerCreate( |
| 13 | const char* adb_path, |
| 14 | const char* address, |
| 15 | MaaAdbScreencapMethod screencap_methods, |
| 16 | MaaAdbInputMethod input_methods, |
| 17 | const char* config, |
| 18 | const char* agent_path) |
| 19 | { |
| 20 | LogFunc << VAR(adb_path) << VAR(address) << VAR(screencap_methods) << VAR(input_methods) << VAR(config) << VAR(agent_path); |
| 21 | |
| 22 | if (!adb_path || !address) { |
| 23 | LogError << "adb_path or address is null"; |
| 24 | return nullptr; |
| 25 | } |
| 26 | |
| 27 | if (!config) { |
| 28 | LogError << "config is null"; |
| 29 | return nullptr; |
| 30 | } |
| 31 | |
| 32 | if (!agent_path) { |
| 33 | LogError << "agent_path is null"; |
| 34 | return nullptr; |
| 35 | } |
| 36 | |
| 37 | auto control_unit = |
| 38 | MAA_NS::AdbControlUnitLibraryHolder::create_control_unit(adb_path, address, screencap_methods, input_methods, config, agent_path); |
| 39 | |
| 40 | if (!control_unit) { |
| 41 | LogError << "Failed to create control unit"; |
| 42 | return nullptr; |
| 43 | } |
| 44 | |
| 45 | return new MAA_CTRL_NS::ControllerAgent(std::move(control_unit)); |
| 46 | } |
| 47 | |
| 48 | MaaController* MaaWin32ControllerCreate( |
| 49 | void* hWnd, |
no test coverage detected