package goadb import ( "fmt" "log" "strings" ) // IsConnected checks if the device is currently connected via ADB func (d *Device) IsConnected() bool { output, err := ExecuteCommand("devices") if err != nil { log.Println(fmt.Errorf("Failed to determine device status: %w", err)) return false } lines := strings.Split(string(output), "\n") for _, line := range lines { if strings.HasPrefix(line, d.Serial) && strings.Contains(line, "device") { return true } } return false } // Run a command on this specific device func (d *Device) RunCommand(command string) ([]byte, error) { return ExecuteCommand(fmt.Sprintf("-s %s %s", d.Serial, command)) }