Android-ADB

 view release on metacpan or  search on metacpan

lib/Android/ADB.pm  view on Meta::CPAN

use Android::ADB::Device;
use Carp;
use File::Slurp;
use IPC::Open2;

sub new {
	my ($class, %args) = @_;
	$args{path} //= $ENV{ADB};
	$args{path} //= 'adb';
	$args{args} //= [];
	bless \%args, $class
}

sub run {
	my ($self, @args) = @_;
	my ($out, $in);
	my @dev_args = $self->{device_serial} ? ('-s', $self->{device_serial}) : ();
	my $pid = open2 $out, $in, $self->{path}, @{$self->{args}}, @args;
	my $result = read_file $out;
	close $out;
	close $in;

lib/Android/ADB/Device.pm  view on Meta::CPAN

use strict;
use warnings;

use parent qw/Class::Accessor::Fast/;

our $VERSION = '0.001';

sub new {
	my ($class, $serial, $state, @attrs) = @_;
	my %attrs = map { split ':', $_, 2 } @attrs;
	bless { serial => $serial, state => $state, %attrs }, $class
}

__PACKAGE__->mk_ro_accessors(qw/serial state usb product model device/);

1;
__END__

=encoding utf-8

=head1 NAME

lib/Android/ADB/Device.pm  view on Meta::CPAN

  say $devices[0]->state; # e.g. offline, bootloader, sideload, or device

  # The available attributes depend on your device
  say $devices[0]->usb;     # e.g. 2-1
  say $devices[0]->product; # e.g. angler
  say $devices[0]->model;   # e.g. MI_MAX
  say $devices[0]->device;  # e.g. angler

=head1 DESCRIPTION

Information about an Android device in form of a blessed hash with a
few accessors. See SYNPOSIS for a list of accessors.

=head1 SEE ALSO

L<Android::ADB>

=head1 AUTHOR

Marius Gavrilescu, E<lt>marius@ieval.roE<gt>



( run in 2.090 seconds using v1.01-cache-2.11-cpan-b32c08c6d1a )