Show
Ignore:
Timestamp:
03/03/08 15:25:26 (5 years ago)
Author:
chiba
Message:

lang/perl/HTTP-MobileAgent?-Plugin-Locator: implement gps_parameter

Location:
lang/perl/HTTP-MobileAgent-Plugin-Locator/branches/get_locator_from_params
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/HTTP-MobileAgent-Plugin-Locator/branches/get_locator_from_params/lib/HTTP/MobileAgent/Plugin/Locator.pm

    r7390 r7392  
    1616    no strict 'refs'; 
    1717    *{"HTTP\::MobileAgent\::gps_compliant"} = \&_gps_compliant; 
     18    *{"HTTP\::MobileAgent\::gps_parameter"} = \&_gps_parameter; 
    1819    *{"HTTP\::MobileAgent\::locator"}       = sub { $class->new( @_ ) }; 
    1920    *{"HTTP\::MobileAgent\::get_location"}  = sub { 
     
    3233    } elsif ( $self->is_softbank ) { 
    3334        return $self->is_type_3gc; 
     35    } 
     36} 
     37 
     38 
     39sub _gps_parameter { 
     40    my ( $self, $params ) = @_; 
     41 
     42    if ( $self->is_docomo ) { 
     43        return (!defined $params->{AREACODE}) ? 1 : 0; 
     44    } 
     45    elsif ( $self->is_ezweb ) { 
     46        return ( $params->{datum} =~ /^\d+$/ ) ? 1 : 0; 
     47    } 
     48    elsif ( $self->is_softbank ) { 
     49        return ( defined $params->{pos} ) ? 1 : 0; 
     50    } 
     51    elsif ( $self->is_airh_phone ) { 
     52        return 0; 
     53    } 
     54    else { 
     55        croak( "Invalid mobile user agent: " . $self->user_agent ); 
    3456    } 
    3557}