-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
55 lines (44 loc) · 1.54 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict';
const ADB = require('appium-adb').ADB;
const DaijishouDebugClient = require('./lib/daijishou_debug_client');
const readline = require('readline').createInterface({
input: process.stdin,
output: process.stdout
});
async function run() {
const adb = await ADB.createADB();
let devices = await adb.getConnectedDevices();
if(devices.length>1) {
console.log('There are more than 1 devices. Please select one by index.');
devices.forEach((device, index)=> {
console.log(`${index} ${device.udid} ${device.state}`);
});
const index = parseInt(await new Promise(resolve => {readline.question("Which device do you want?", resolve)}))
adb.setDevice(devices[index])
}
readline.close()
// await adb.reversePort(PORT, PORT);
console.log(await adb.getForwardList());
const daijishouDebugClient = new DaijishouDebugClient(adb);
daijishouDebugClient.heartbeat((err) => {
console.log(err);
console.log("heartbeat 1");
});
daijishouDebugClient.heartbeat((err) => {
console.log(err);
console.log("heartbeat 2");
});
daijishouDebugClient.console("\\drive list all", (err, result) => {
console.log(err);
console.log(result);
});
daijishouDebugClient.console("\\echo 123", (err, result) => {
console.log(err);
console.log(result);
});
daijishouDebugClient.console("\\echo 123", (err, result) => {
console.log(err);
console.log(result);
});
}
run()