| 16 | } |
| 17 | |
| 18 | bool Connection::parse(const json::value& config) |
| 19 | { |
| 20 | static const json::array kDefaultConnectArgv = { |
| 21 | "{ADB}", |
| 22 | "connect", |
| 23 | "{ADB_SERIAL}", |
| 24 | }; |
| 25 | static const json::array kDefaultKillServerArgv = { |
| 26 | "{ADB}", |
| 27 | "kill-server", |
| 28 | }; |
| 29 | static const json::array kDefaultTestConnectionArgv = { |
| 30 | "{ADB}", |
| 31 | "-s", |
| 32 | "{ADB_SERIAL}", |
| 33 | "get-state", |
| 34 | }; |
| 35 | // 使用 cat 等待 stdin,最轻量的长期挂起命令 |
| 36 | static const json::array kDefaultMonitorArgv = { |
| 37 | "{ADB}", "-s", "{ADB_SERIAL}", "shell", "cat", |
| 38 | }; |
| 39 | |
| 40 | return parse_command("Connect", config, kDefaultConnectArgv, connect_argv_) |
| 41 | && parse_command("KillServer", config, kDefaultKillServerArgv, kill_server_argv_) |
| 42 | && parse_command("TestConnection", config, kDefaultTestConnectionArgv, test_connection_argv_) |
| 43 | && parse_command("Monitor", config, kDefaultMonitorArgv, monitor_argv_); |
| 44 | } |
| 45 | |
| 46 | bool Connection::connect() |
| 47 | { |
nothing calls this directly
no outgoing calls
no test coverage detected