()
| 587 | } |
| 588 | |
| 589 | public getConnectedDevicesWithDetails(): Array<AndroidDevice & { version: string, name: string }> { |
| 590 | try { |
| 591 | const names = execFileSync(getAdbPath(), ["devices"]) |
| 592 | .toString() |
| 593 | .split("\n") |
| 594 | .map(line => line.trim()) |
| 595 | .filter(line => line !== "") |
| 596 | .filter(line => !line.startsWith("List of devices attached")) |
| 597 | .filter(line => line.split("\t")[1]?.trim() === "device") // Only include devices that are online and ready |
| 598 | .map(line => line.split("\t")[0]); |
| 599 | |
| 600 | return names.map(deviceId => ({ |
| 601 | deviceId, |
| 602 | deviceType: this.getDeviceType(deviceId), |
| 603 | version: this.getDeviceVersion(deviceId), |
| 604 | name: this.getDeviceName(deviceId), |
| 605 | })); |
| 606 | } catch (error) { |
| 607 | console.error("Could not execute adb command, maybe ANDROID_HOME is not set?"); |
| 608 | return []; |
| 609 | } |
| 610 | } |
| 611 | } |
no test coverage detected