Initial commit
[android-adb.git] / lib / Android / ADB / Device.pm
1 package Android::ADB::Device;
2
3 use 5.014000;
4 use strict;
5 use warnings;
6
7 use parent qw/Class::Accessor::Fast/;
8
9 our $VERSION = '0.001';
10
11 sub new {
12 my ($class, $serial, $state, @attrs) = @_;
13 my %attrs = map { split ':', $_, 2 } @attrs;
14 bless { serial => $serial, state => $state, %attrs }, $class
15 }
16
17 __PACKAGE__->mk_ro_accessors(qw/serial state usb product model device/);
18
19 1;
20 __END__
21
22 =encoding utf-8
23
24 =head1 NAME
25
26 Android::ADB::Device - information about an Android device
27
28 =head1 SYNOPSIS
29
30 use Android::ADB;
31 my @devices = $adb->devices;
32 say $devices[0]->serial;
33 say $devices[0]->state; # e.g. offline, bootloader, sideload, or device
34
35 # The available attributes depend on your device
36 say $devices[0]->usb; # e.g. 2-1
37 say $devices[0]->product; # e.g. angler
38 say $devices[0]->model; # e.g. MI_MAX
39 say $devices[0]->device; # e.g. angler
40
41 =head1 DESCRIPTION
42
43 Information about an Android device in form of a blessed hash with a
44 few accessors. See SYNPOSIS for a list of accessors.
45
46 =head1 SEE ALSO
47
48 L<Android::ADB>
49
50 =head1 AUTHOR
51
52 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
53
54 =head1 COPYRIGHT AND LICENSE
55
56 Copyright (C) 2017 by Marius Gavrilescu
57
58 This library is free software; you can redistribute it and/or modify
59 it under the same terms as Perl itself, either Perl version 5.24.2 or,
60 at your option, any later version of Perl 5 you may have available.
61
62
63 =cut
This page took 0.022518 seconds and 4 git commands to generate.