Changeset 792

Show
Ignore:
Timestamp:
10/30/02 00:23:52
Author:
miyagawa
Message:

0.03

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • HTTP-MobileAgent/trunk/Changes

    r777 r792  
    11Revision history for Perl extension HTTP::MobileAgent 
     2 
     30.03  Tue Oct 29 23:53:01 JST 2002 
     4        * Added HTTP::MobileAgent::Display to support various display information 
    25 
    360.02  Mon Sep 23 09:00:40 JST 2002 
  • HTTP-MobileAgent/trunk/MANIFEST

    r773 r792  
    33Makefile.PL 
    44README 
     5bin/makedocomomap 
    56lib/HTTP/MobileAgent.pm 
     7lib/HTTP/MobileAgent/Display.pm 
    68lib/HTTP/MobileAgent/DoCoMo.pm 
     9lib/HTTP/MobileAgent/DoCoMoDisplayMap.pm 
    710lib/HTTP/MobileAgent/EZweb.pm 
    811lib/HTTP/MobileAgent/JPhone.pm 
     
    1417t/03_j_phone.t 
    1518t/04_ezweb.t 
     19t/05_display.t 
  • HTTP-MobileAgent/trunk/lib/HTTP/MobileAgent.pm

    r777 r792  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = 0.02
     5$VERSION = 0.03
    66 
    77use HTTP::MobileAgent::Request; 
     
    1111require HTTP::MobileAgent::EZweb; 
    1212require HTTP::MobileAgent::NonMobile; 
     13require HTTP::MobileAgent::Display; 
    1314 
    1415use vars qw($MobileAgentRE); 
     
    4748# should be implemented in subclasses 
    4849sub parse { die } 
     50sub _make_display { die } 
    4951 
    5052sub name  { shift->{name} } 
     53 
     54sub display { 
     55    my $self = shift; 
     56    unless ($self->{display}) { 
     57        $self->{display} = $self->_make_display; 
     58    } 
     59    return $self->{display}; 
     60} 
    5161 
    5262# utility for subclasses 
     
    96106  } 
    97107 
     108  my $display = $agent->display;        # HTTP::MobileAgent::Display 
     109  if ($display->color) { ... } 
     110 
    98111=head1 DESCRIPTION 
    99112 
     
    134147returns User-Agent name like 'DoCoMo'. 
    135148 
     149=item display 
     150 
     151  my $display = $agent->display; 
     152 
     153returns HTTP::MobileAgent::Display object. See 
     154L<HTTP::MobileAgent::Display> for details. 
     155 
    136156=back 
    137157 
     
    179199L<HTTP::MobileAgent::DoCoMo>, L<HTTP::MobileAgent::JPhone>, 
    180200L<HTTP::MobileAgent::EZweb>, L<HTTP::MobileAgent::NonMobile>, 
    181 L<HTTP::BrowserDetect> 
     201L<HTTP::MobileAgent::Display>, L<HTTP::BrowserDetect> 
    182202 
    183203Reference URL for specification is listed in Pods for each subclass. 
  • HTTP-MobileAgent/trunk/lib/HTTP/MobileAgent/DoCoMo.pm

    r777 r792  
    22 
    33use strict; 
     4use vars qw($VERSION); 
     5$VERSION = 0.03; 
     6 
    47use base qw(HTTP::MobileAgent); 
    58 
     
    811       serial_number is_foma card_id comment) 
    912); 
     13 
     14use HTTP::MobileAgent::DoCoMoDisplayMap qw($DisplayMap); 
    1015 
    1116# various preferences 
     
    116121} 
    117122 
     123sub _make_display { 
     124    my $self = shift; 
     125    my $display = $DisplayMap->{$self->model}; 
     126    return HTTP::MobileAgent::Display->new(%$display); 
     127} 
     128 
    1181291; 
    119130__END__ 
     
    239250=back 
    240251 
    241 =head1 TODO 
    242  
    243 =over 4 
    244  
    245 =item * 
    246  
    247 Region and screen size support availabe at 
    248 http://www.nttdocomo.co.jp/p_s/imode/spec/ryouiki.html 
    249  
    250 (Patches are always welcome ;)) 
    251  
    252 =back 
    253  
    254252=head1 AUTHOR 
    255253 
  • HTTP-MobileAgent/trunk/lib/HTTP/MobileAgent/EZweb.pm

    r777 r792  
    22 
    33use strict; 
     4use vars qw($VERSION); 
     5$VERSION = 0.03; 
     6 
    47use base qw(HTTP::MobileAgent); 
    58 
     
    2023        $self->{name} = $name; 
    2124        $self->{version} = "$version $opt"; 
    22  
    2325        $self->{server} = $server; 
    2426    } 
     
    3537        } 
    3638    } 
     39} 
     40 
     41sub _make_display { 
     42    my $self = shift; 
     43    my($width, $height) = split /,/, $self->get_header('x-up-devcap-screenpixels'); 
     44    my $depth = (split /,/, $self->get_header('x-up-devcap-screendepth'))[0]; 
     45    my $color = $self->get_header('x-up-devcap-iscolor'); 
     46    return HTTP::MobileAgent::Display->new( 
     47        width  => $width, 
     48        height => $height, 
     49        color  => (defined $color && $color eq '1'), 
     50        depth  => 2 ** $depth, 
     51    ); 
    3752} 
    3853 
     
    112127=item * 
    113128 
    114 Parse C<X-UP-*> HTTP headers. 
    115  
    116 =item * 
    117  
    118 Spec information support listed in  
     129Spec information support listed in 
    119130http://www.au.kddi.com/ezfactory/tec/spec/new_win/ezkishu.html 
    120131 
  • HTTP-MobileAgent/trunk/lib/HTTP/MobileAgent/JPhone.pm

    r777 r792  
    22 
    33use strict; 
     4use vars qw($VERSION); 
     5$VERSION = 0.03; 
     6 
    47use base qw(HTTP::MobileAgent); 
    58 
     
    3235        $self->{vendor} = ($self->{model} =~ /J-([A-Z]+)/)[0] if $self->{model}; 
    3336    } 
     37} 
     38 
     39sub _make_display { 
     40    my $self = shift; 
     41    my($width, $height) = split /\*/, $self->get_header('x-jphone-display'); 
     42 
     43    my($color, $depth); 
     44    if (my $c_str = $self->get_header('x-jphone-color')) { 
     45        ($color, $depth) = $c_str =~ /^([CG])(\d+)$/; 
     46    } 
     47 
     48    return HTTP::MobileAgent::Display->new( 
     49        width  => $width, 
     50        height => $height, 
     51        color  => $color eq 'C', 
     52        depth  => $depth, 
     53    ); 
    3454} 
    3555 
     
    131151=item * 
    132152 
    133 Parse C<x-jphone-*> headers. 
    134  
    135 =item * 
    136  
    137153Area information support on http://www.dp.j-phone.com/jsky/position.html 
    138154