mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-04 10:19:17 +02:00
feat(adb): support connect to adb server (#549)
This commit is contained in:
parent
c34eef1d89
commit
3beaad2055
111 changed files with 2926 additions and 1701 deletions
|
@ -1,7 +1,7 @@
|
|||
import { AdbCommandBase } from "./base.js";
|
||||
|
||||
export class AdbTcpIpCommand extends AdbCommandBase {
|
||||
public async setPort(port: number): Promise<void> {
|
||||
public async setPort(port: number): Promise<string> {
|
||||
if (port <= 0) {
|
||||
throw new Error(`Invalid port ${port}`);
|
||||
}
|
||||
|
@ -10,12 +10,14 @@ export class AdbTcpIpCommand extends AdbCommandBase {
|
|||
if (output !== `restarting in TCP mode port: ${port}\n`) {
|
||||
throw new Error("Invalid response");
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
public async disable(): Promise<void> {
|
||||
public async disable(): Promise<string> {
|
||||
const output = await this.adb.createSocketAndWait("usb:");
|
||||
if (output !== "restarting in USB mode\n") {
|
||||
throw new Error("Invalid response");
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue