Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screenshot / tap commands #71

Open
daniellwdb opened this issue Dec 4, 2024 · 4 comments
Open

screenshot / tap commands #71

daniellwdb opened this issue Dec 4, 2024 · 4 comments

Comments

@daniellwdb
Copy link

I am not sure about the scope of this library but it would be nice to have utility methods for screenshots and tap commands.

I manged to create a util myself for tap:

fn tap(device: &mut ADBServerDevice, coordinates: Coordinate) {
    device
        .shell_command(
            [format!("input tap {} {}", coordinates.x, coordinates.y)],
            std::io::stdout(),
        )
        .expect("`shell_command` failed")
}

But I can't figure out how to access screenshots:

fn screenshot(device: &mut ADBServerDevice) -> File {
    let mut file = File::create_new("screenshot.png").unwrap();

    device
        .shell_command(["shell:echo && screencap -p 2>/dev/null"], &mut file)
        .unwrap();

    return file;
}
@cocool97
Copy link
Owner

cocool97 commented Dec 4, 2024

Hey !

  • What are input taps used for ? If this is an interesting feature I'm not against adding it into the library
  • For screenshots, you have the framebuffer method on ADBServerDevice that returns the framebuffer of the device under PNG format

@daniellwdb
Copy link
Author

Thanks for pointing out framebuffer! Input tap is used to simulate touch events

@cocool97
Copy link
Owner

cocool97 commented Dec 4, 2024

The feature would be nice to have in the library then ! Would you like to have a look into adding it ?

@daniellwdb
Copy link
Author

I just started to learn Rust so I might be able to with some more experience. Not stopping anyone though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants