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

Method connect

source/MaaAdbControlUnit/Manager/AdbControlUnitMgr.cpp:43–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43bool AdbControlUnitMgr::connect()
44{
45 if (!connection_.connect()) {
46 LogError << "failed to connect" << VAR(adb_path_) << VAR(adb_serial_);
47 return false;
48 }
49
50 clear_observer();
51
52 if (screencap_methods_ != MaaAdbScreencapMethod_None) {
53 screencap_ = std::make_shared<ScreencapAgent>(screencap_methods_, agent_path_);
54 screencap_->parse(config_);
55 screencap_->set_replacement(unit_replacement_);
56
57 if (!screencap_->init()) {
58 LogError << "failed to init screencap";
59 return false;
60 }
61
62 register_observer(screencap_);
63 }
64 else {
65 LogWarn << "screencap_methods_ is MaaAdbScreencapMethod_None";
66 }
67
68 if (input_methods_ != MaaAdbInputMethod_None) {
69 input_ = std::make_shared<InputAgent>(input_methods_, agent_path_);
70 input_->parse(config_);
71 input_->set_replacement(unit_replacement_);
72
73 if (!input_->init()) {
74 LogError << "failed to init input";
75 return false;
76 }
77
78 register_observer(input_);
79 }
80 else {
81 LogWarn << "input_methods_ is MaaAdbInputMethod_None";
82 }
83
84 return true;
85}
86
87bool AdbControlUnitMgr::connected() const
88{

Callers

nothing calls this directly

Calls 4

set_replacementMethod · 0.80
connectMethod · 0.65
parseMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected