mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-04 10:19:17 +02:00
chore: experimental moving to rush
This commit is contained in:
parent
963ac49d14
commit
d80288ec9b
209 changed files with 9508 additions and 27413 deletions
21
libraries/adb/src/commands/tcpip.ts
Normal file
21
libraries/adb/src/commands/tcpip.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import { AdbCommandBase } from './base';
|
||||
|
||||
export class AdbTcpIpCommand extends AdbCommandBase {
|
||||
public async setPort(port: number): Promise<void> {
|
||||
if (port <= 0) {
|
||||
throw new Error(`Invalid port ${port}`);
|
||||
}
|
||||
|
||||
const output = await this.adb.createSocketAndReadAll(`tcpip:${port}`);
|
||||
if (output !== `restarting in TCP mode port: ${port}\n`) {
|
||||
throw new Error('Invalid response');
|
||||
}
|
||||
}
|
||||
|
||||
public async disable(): Promise<void> {
|
||||
const output = await this.adb.createSocketAndReadAll('usb:');
|
||||
if (output !== 'restarting in USB mode\n') {
|
||||
throw new Error('Invalid response');
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue