| 1 | package HTTP::MobileAgent::Vodafone; | ||||||||||
| 2 | |||||||||||
| 3 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 9 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 9 | $VERSION = 0.19; | |||||||||
| 6 | |||||||||||
| 7 | 9 | ▶ | use base qw(HTTP::MobileAgent); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 9 | __PACKAGE__->make_accessors( | |||||||||
| 10 | qw(name version model packet_compliant | ||||||||||
| 11 | serial_number vendor vendor_version java_info) | ||||||||||
| 12 | ); | ||||||||||
| 13 | |||||||||||
| 14 | 69 | ▶ | sub is_j_phone { shift->is_vodafone } | ||||||||
|
Subroutine
is_j_phone: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 15 | |||||||||||
| 16 | 79 | ▶ | sub is_vodafone { 1 } | ||||||||
|
Subroutine
is_vodafone: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 17 | |||||||||||
| 18 | 5 | ▶ | sub carrier { 'V' } | ||||||||
|
Subroutine
carrier: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 19 | |||||||||||
| 20 | 5 | ▶ | sub carrier_longname { 'Vodafone' } | ||||||||
|
Subroutine
carrier_longname: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 21 | |||||||||||
| 22 | |||||||||||
| 23 | sub is_type_c { | ||||||||||
| 24 | 7 | ▶ | my $self = shift; | ||||||||
|
Subroutine
is_type_c: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 25 | 7 | ▶ | return if $self->is_type_3gc; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | 4 | ▶ | return 1 if $self->version =~ /^3\./; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 3 | ▶ | return 1 if $self->version =~ /^2\./; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | sub is_type_p { | ||||||||||
| 31 | 7 | ▶ | my $self = shift; | ||||||||
|
Subroutine
is_type_p: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 32 | 7 | ▶ | return if $self->is_type_3gc; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 4 | ▶ | return 1 if $self->version =~ /^4\./; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | sub is_type_w { | ||||||||||
| 37 | 7 | ▶ | my $self = shift; | ||||||||
|
Subroutine
is_type_w: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 38 | 7 | ▶ | return if $self->is_type_3gc; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 4 | ▶ | return 1 if $self->version =~ /^5\./; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | } | ||||||||||
| 41 | |||||||||||
| 42 | sub is_type_3gc { | ||||||||||
| 43 | 26 | ▶ | return shift->{type_3gc}; | ||||||||
|
Subroutine
is_type_3gc: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | |||||||||||
| 47 | sub parse { | ||||||||||
| 48 | 72 | ▶ | my $self = shift; | ||||||||
|
Subroutine
parse: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||
| 49 | |||||||||||
| 50 | 72 | ▶ | return $self->_parse_3gc if($self->user_agent =~ /^Vodafone/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 69 | ▶ | return $self->_parse_motorola_3gc if($self->user_agent =~ /^MOT-/); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | |||||||||||
| 53 | 67 | $self->{type_3gc} = 0; | |||||||||
| 54 | |||||||||||
| 55 | 67 | my($main, @rest) = split / /, $self->user_agent; | |||||||||
| 56 | |||||||||||
| 57 | 67 | ▶ | if (@rest) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | # J-PHONE/4.0/J-SH51/SNJSHA3029293 SH/0001aa Profile/MIDP-1.0 Configuration/CLDC-1.0 Ext-Profile/JSCL-1.1.0 | ||||||||||
| 59 | 21 | $self->{packet_compliant} = 1; | |||||||||
| 60 | 21 | @{$self}{qw(name version model serial_number)} = split m!/!, $main; | |||||||||
| 61 | 21 | ▶ | if ($self->{serial_number}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 20 | ▶ | $self->{serial_number} =~ s/^SN// or return $self->no_match; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 21 | my $vendor = shift @rest; | |||||||||
| 66 | 21 | @{$self}{qw(vendor vendor_version)} = split m!/!, $vendor; | |||||||||
| 67 | |||||||||||
| 68 | 21 | my %java_info = map split(m!/!), @rest; | |||||||||
| 69 | 21 | $self->{java_info} = \%java_info; | |||||||||
| 70 | } | ||||||||||
| 71 | else { | ||||||||||
| 72 | # J-PHONE/2.0/J-DN02 | ||||||||||
| 73 | 46 | @{$self}{qw(name version model)} = split m!/!, $main; | |||||||||
| 74 | 46 | ▶ | $self->{vendor} = ($self->{model} =~ /J-([A-Z]+)/)[0] if $self->{model}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | #for 3gc orz | ||||||||||
| 80 | sub _parse_3gc { | ||||||||||
| 81 | 3 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_parse_3gc: called CC=3 SCAR=11.0
| |||||||||||
| 82 | |||||||||||
| 83 | #Vodafone/1.0/V802SE/SEJ001 Browser/SEMC-Browser/4.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 | ||||||||||
| 84 | #Vodafone/1.0/V702NK/NKJ001 Series60/2.6 Profile/MIDP-2.0 Configuration/CLDC-1.1' | ||||||||||
| 85 | |||||||||||
| 86 | 3 | my($main, @rest) = split / /, $self->user_agent; | |||||||||
| 87 | 3 | $self->{packet_compliant} = 1; | |||||||||
| 88 | 3 | $self->{type_3gc} = 1; | |||||||||
| 89 | |||||||||||
| 90 | 3 | @{$self}{qw(name version model _maker serial_number)} = split m!/!, $main; | |||||||||
| 91 | 3 | ▶ | if ($self->{serial_number}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 92 | 2 | ▶ | $self->{serial_number} =~ s/^SN// or return $self->no_match; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 93 | } | ||||||||||
| 94 | |||||||||||
| 95 | #model from x-jphone-msname | ||||||||||
| 96 | 3 | $self->{model} = $self->get_header('x-jphone-msname'); | |||||||||
| 97 | |||||||||||
| 98 | 3 | my($java_info) = $self->user_agent =~ /(Profile.*)$/; | |||||||||
| 99 | 3 | my %java_info = map split(m!/!), split / /,$java_info; | |||||||||
| 100 | 3 | $self->{java_info} = \%java_info; | |||||||||
| 101 | |||||||||||
| 102 | } | ||||||||||
| 103 | |||||||||||
| 104 | #for motorola 3gc | ||||||||||
| 105 | sub _parse_motorola_3gc{ | ||||||||||
| 106 | 2 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_parse_motorola_3gc: called CC=1 SCAR=0.0
| |||||||||||
| 107 | 2 | my($main, @rest) = split / /, $self->user_agent; | |||||||||
| 108 | |||||||||||
| 109 | #MOT-V980/80.2B.04I MIB/2.2.1 Profile/MIDP-2.0 Configuration/CLDC-1.1 | ||||||||||
| 110 | |||||||||||
| 111 | 2 | $self->{packet_compliant} = 1; | |||||||||
| 112 | 2 | $self->{type_3gc} = 1; | |||||||||
| 113 | |||||||||||
| 114 | 2 | @{$self}{qw(name)} = split m!/!, $main; | |||||||||
| 115 | |||||||||||
| 116 | 2 | shift @rest; | |||||||||
| 117 | 2 | my %java_info = map split(m!/!), @rest; | |||||||||
| 118 | 2 | $self->{java_info} = \%java_info; | |||||||||
| 119 | |||||||||||
| 120 | #model from x-jphone-msname | ||||||||||
| 121 | 2 | $self->{model} = $self->get_header('x-jphone-msname'); | |||||||||
| 122 | } | ||||||||||
| 123 | |||||||||||
| 124 | sub _make_display { | ||||||||||
| 125 | 1 | ▶ | my $self = shift; | ||||||||
|
Subroutine
_make_display: called CC=2 SCAR=7.0
| |||||||||||
| 126 | 1 | my($width, $height) = split /\*/, $self->get_header('x-jphone-display'); | |||||||||
| 127 | |||||||||||
| 128 | 1 | my($color, $depth); | |||||||||
| 129 | 1 | ▶ | if (my $c_str = $self->get_header('x-jphone-color')) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 130 | 1 | ($color, $depth) = $c_str =~ /^([CG])(\d+)$/; | |||||||||
| 131 | } | ||||||||||
| 132 | |||||||||||
| 133 | 1 | return HTTP::MobileAgent::Display->new( | |||||||||
| 134 | width => $width, | ||||||||||
| 135 | height => $height, | ||||||||||
| 136 | color => $color eq 'C', | ||||||||||
| 137 | depth => $depth, | ||||||||||
| 138 | ); | ||||||||||
| 139 | } | ||||||||||
| 140 | |||||||||||
| 141 | 9 | 1; | |||||||||
| 142 | __END__ | ||||||||||