# -*-perl-*-
# keitairc/lib/plugins/00location_receiver
# °ÌÃÖ¾ðÊóÁ÷¿®¡¢¤Î¥³¡¼¥ë¥Ð¥Ã¥¯
-# ¸½ºß¤Þ¤À au ÀìÍÑ
#
-# see KDDI au: µ»½Ñ¾ðÊó > ´Ê°×°ÌÃÖ¾ðÊó
-# http://www.au.kddi.com/ezfactory/tec/spec/eznavi.html
-#
-# $Id: 00location_receiver,v 1.3 2008-01-14 14:05:48 morimoto Exp $
+# $Id: 00location_receiver,v 1.4 2008-02-23 20:43:36 morimoto Exp $
# $Source: /home/ishikawa/work/keitairc/tmp/keitairc/lib/plugins/00location_receiver,v $
+
use Net::HTTP;
use XML::Simple;
use Encode;
+# WGS84·Ï¤òÅϤ¹¤³¤È
sub get_rgeocode_xml {
my ($lat, $lon) = @_;
my $s = Net::HTTP->new(Host => 'refits.cgk.affrc.go.jp') || return;
# ¤Î¬ÃϷϤÏWGS84·Ï¤Î¥Ç¡¼¥¿¤ò»ÈÍÑ¡£
# from http://www.au.kddi.com/ezfactory/tec/spec/eznavi.html
+ # NTT DoCoMo
if($ci->is_docomo()){
# i¥¨¥ê¥¢¤ÏPOST¤ÇÍè¤ë
# ACTN=OK&LAT=%2B35.44.27.996&LON=%2B139.35.37.932&GEO=wgs84&XACC=1&POSINFO=2
}
my ($tx, $ty) = wgs84_to_tokyo($wx, $wy);
- my $xml_code = get_rgeocode_xml($tx, $ty);
+ my $xml_code = get_rgeocode_xml($wx, $wy);
unless($xml_code){
$p->{error} = 1;
$p->{rgeocode_noresponse} = 1;
return $view->render('location_receiver.html', $p);
}
+ # Softbank
+ # HTTP¥Ø¥Ã¥À¡¼¤Îx-jphone-geocode¤Ë°ÌÃÖ¾ðÊó¤¬ÄÌÃΤµ¤ì¤Þ¤¹¡£
+ # x-jphone-geocode: 354053%1A1394557%1A(½»½ê¤¬SJIS¤Ç¥¨
+ # ¥ó¥³¡¼¥É¤µ¤ì¤¿¤â¤Î) "%1A"(SUB)¤Ç¶èÀÚ¤é¤ì¤Æ lat, lon,
+ # ½»½ê(SJIS¤Ç¥¨¥ó¥³¡¼¥É)¤Î·Á¼°¤Ë¤Ê¤ê¤Þ¤¹¡£½»½ê¤Ï¥É¥¥å
+ # ¥á¥ó¥È¤ò¸«¤ë¸Â¤êSJIS¤Ç¥¨¥¹¥±¡¼¥×¤·¤¿¤â¤Î¤È¤Ê¤Ã¤Æ¤¤¤Þ
+ # ¤¹¤¬¡¢Àµ¤·¤¯¥Ç¥³¡¼¥É¤Ç¤¤Ê¤¤¾ì¹ç¤¬¤¢¤ê¤Þ¤·¤¿¡£¤³¤Î¾ð
+ # Êó¤ÏÍøÍѤ·¤Ê¤¤Êý¤¬Îɤ¤¤Î¤«¤âÃΤì¤Þ¤»¤ó¡£
+ # see http://www.utilz.jp/wiki/Gps
if($ci->is_softbank()){
- # HTTP¥Ø¥Ã¥À¡¼¤Îx-jphone-geocode¤Ë°ÌÃÖ¾ðÊó¤¬ÄÌÃΤµ¤ì¤Þ¤¹¡£
- # x-jphone-geocode: 354053%1A1394557%1A(½»½ê¤¬SJIS¤Ç¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿¤â¤Î)
- # "%1A"(SUB)¤Ç¶èÀÚ¤é¤ì¤Æ lat, lon, ½»½ê(SJIS¤Ç
- # ¥¨¥ó¥³¡¼¥É)¤Î·Á¼°¤Ë¤Ê¤ê¤Þ¤¹¡£½»½ê¤Ï¥É¥¥å¥á¥ó
- # ¥È¤ò¸«¤ë¸Â¤êSJIS¤Ç¥¨¥¹¥±¡¼¥×¤·¤¿¤â¤Î¤È¤Ê¤Ã¤Æ
- # ¤¤¤Þ¤¹¤¬¡¢Àµ¤·¤¯¥Ç¥³¡¼¥É¤Ç¤¤Ê¤¤¾ì¹ç¤¬¤¢¤ê¤Þ
- # ¤·¤¿¡£¤³¤Î¾ðÊó¤ÏÍøÍѤ·¤Ê¤¤Êý¤¬Îɤ¤¤Î¤«¤âÃΤì
- # ¤Þ¤»¤ó¡£
- # see http://www.utilz.jp/wiki/Gps
my ($lat, $lon);
if(defined $request->{_headers}->{'x-jphone-geocode'}){
($lat, $lon) = split(/%1A/, $request->{_headers}->{'x-jphone-geocode'});
}
my ($wx, $wy) = (dms_to_degree($lat), dms_to_degree($lon));
my ($tx, $ty) = wgs84_to_tokyo($wx, $wy);
- my $xml_code = get_rgeocode_xml($tx, $ty);
+ my $xml_code = get_rgeocode_xml($wx, $wy);
unless($xml_code){
$p->{error} = 1;
$p->{rgeocode_noresponse} = 1;
return $view->render('location_receiver.html', $p);
}
+ # see KDDI au: µ»½Ñ¾ðÊó > ´Ê°×°ÌÃÖ¾ðÊó
+ # http://www.au.kddi.com/ezfactory/tec/spec/eznavi.html
if($ci->is_ezweb()){
# au W53S location ¤ÎÌá¤êÎã
# 3/?datum=tokyo&unit=dms&lat=35.44.51.75&lon=139.35.15.0
$h{lon} =~ s/^%2b//i; # au GPSOne¤Î¾ì¹ç
my ($wx, $wy) = (dms_to_degree($h{lat}), dms_to_degree($h{lon}));
my ($tx, $ty) = wgs84_to_tokyo($wx, $wy);
- my $xml_code = get_rgeocode_xml($tx, $ty);
+ my $xml_code = get_rgeocode_xml($wx, $wy);
unless($xml_code){
$p->{error} = 1;
$p->{rgeocode_noresponse} = 1;