| 20 | } |
| 21 | |
| 22 | bool ScreencapRawByNetcat::init() |
| 23 | { |
| 24 | LogFunc; |
| 25 | |
| 26 | auto addr_opt = request_netcat_address(); |
| 27 | if (!addr_opt) { |
| 28 | return false; |
| 29 | } |
| 30 | netcat_address_ = std::move(*addr_opt); |
| 31 | |
| 32 | auto serial_host = argv_replace_["{ADB_SERIAL}"]; |
| 33 | auto shp = serial_host.find(':'); |
| 34 | std::string local = "127.0.0.1"; |
| 35 | if (shp != std::string::npos) { |
| 36 | local = serial_host.substr(0, shp); |
| 37 | } |
| 38 | |
| 39 | io_factory_ = std::make_shared<ServerSockIOFactory>(local, 0); |
| 40 | |
| 41 | return true; |
| 42 | } |
| 43 | |
| 44 | std::optional<cv::Mat> ScreencapRawByNetcat::screencap() |
| 45 | { |