Class: Jpmobile::Mobile::Au
- Inherits:
-
AbstractMobile
- Object
- AbstractMobile
- Jpmobile::Mobile::Au
- Defined in:
- lib/jpmobile/mobile/au.rb
Overview
au携帯電話
CDMA 1X, CDMA 1X WINを含む。
Constant Summary
- USER_AGENT_REGEXP =
対応するUser-Agentの正規表現 User-Agent文字列中に “UP.Browser” を含むVodafoneの端末があるので注意が必要
/^(?:KDDI|UP.Browser\/.+?)-(.+?) /- MAIL_ADDRESS_REGEXP =
対応するメールアドレスの正規表現
/^.+@ezweb\.ne\.jp$/- LOCATION_UNSUPPORTED_DEVICE_ID =
簡易位置情報取得に対応していないデバイスID www.au.kddi.com/ezfactory/tec/spec/eznavi.html
["PT21", "TS25", "KCTE", "TST9", "KCU1", "SYT5", "KCTD", "TST8", "TST7", "KCTC", "SYT4", "KCTB", "KCTA", "TST6", "KCT9", "TST5", "TST4", "KCT8", "SYT3", "KCT7", "MIT1", "MAT3", "KCT6", "TST3", "KCT5", "KCT4", "SYT2", "MAT1", "MAT2", "TST2", "KCT3", "KCT2", "KCT1", "TST1", "SYT1"]
- GPS_UNSUPPORTED_DEVICE_ID =
GPS取得に対応していないデバイスID
["PT21", "KC26", "SN28", "SN26", "KC23", "SA28", "TS25", "SA25", "SA24", "SN23", "ST14", "KC15", "SN22", "KC14", "ST13", "SN17", "SY15", "CA14", "HI14", "TS14", "KC13", "SN15", "SN16", "SY14", "ST12", "TS13", "CA13", "MA13", "HI13", "SN13", "SY13", "SN12", "SN14", "ST11", "DN11", "SY12", "KCTE", "TST9", "KCU1", "SYT5", "KCTD", "TST8", "TST7", "KCTC", "SYT4", "KCTB", "KCTA", "TST6", "KCT9", "TST5", "TST4", "KCT8", "SYT3", "KCT7", "MIT1", "MAT3", "KCT6", "TST3", "KCT5", "KCT4", "SYT2", "MAT1", "MAT2", "TST2", "KCT3", "KCT2", "KCT1", "TST1", "SYT1"]
Instance Method Summary (collapse)
-
- (Object) device_id
デバイスIDを返す.
-
- (Object) display
画面情報を Display クラスのインスタンスで返す。.
-
- (Object) position
位置情報があれば Position のインスタンスを返す。無ければ nil を返す。.
-
- (Object) subno
(also: #ident_subscriber)
EZ番号(サブスクライバID)があれば返す。無ければ nil を返す。.
-
- (Boolean) supports_cookie?
cookieに対応しているか?.
-
- (Boolean) supports_gps?
GPS位置情報取得に対応している場合は true を返す。.
-
- (Boolean) supports_location?
簡易位置情報取得に対応している場合は true を返す。.
Methods inherited from AbstractMobile
#ident, #ident_device, #initialize, valid_ip?, #valid_ip?
Constructor Details
This class inherits a constructor from Jpmobile::Mobile::AbstractMobile
Instance Method Details
- (Object) device_id
デバイスIDを返す
75 76 77 78 79 80 81 |
# File 'lib/jpmobile/mobile/au.rb', line 75 def device_id if @request.env['HTTP_USER_AGENT'] =~ USER_AGENT_REGEXP return $1 else nil end end |
- (Object) display
画面情報を Display クラスのインスタンスで返す。
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/jpmobile/mobile/au.rb', line 57 def display return @__display if @__display p_w = p_h = col_p = cols = nil if r = @request.env['HTTP_X_UP_DEVCAP_SCREENPIXELS'] p_w, p_h = r.split(/,/,2).map {|x| x.to_i} end if r = @request.env['HTTP_X_UP_DEVCAP_ISCOLOR'] col_p = (r == '1') end if r = @request.env['HTTP_X_UP_DEVCAP_SCREENDEPTH'] a = r.split(/,/) cols = 2 ** a[0].to_i end @__display = Jpmobile::Display.new(p_w, p_h, nil, nil, col_p, cols) end |
- (Object) position
位置情報があれば Position のインスタンスを返す。無ければ nil を返す。
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/jpmobile/mobile/au.rb', line 30 def position return @__posotion if defined? @__posotion return @__posotion = nil if ( params["lat"].nil? || params['lat'] == '' || params["lon"].nil? || params["lon"] == '' ) l = Jpmobile::Position.new l. = params.reject {|x,v| !["ver", "datum", "unit", "lat", "lon", "alt", "time", "smaj", "smin", "vert", "majaa", "fm"].include?(x) } case params["unit"] when "1" l.lat = params["lat"].to_f l.lon = params["lon"].to_f when "0", "dms" raise "Invalid dms form" unless params["lat"] =~ /^([+-]?\d+)\.(\d+)\.(\d+\.\d+)$/ l.lat = Jpmobile::Position.dms2deg($1,$2,$3) raise "Invalid dms form" unless params["lon"] =~ /^([+-]?\d+)\.(\d+)\.(\d+\.\d+)$/ l.lon = Jpmobile::Position.dms2deg($1,$2,$3) else return @__posotion = nil end if params["datum"] == "1" # ただし、params["datum"]=="tokyo"のとき(簡易位置情報)のときは、 # 実際にはWGS84系のデータが渡ってくる # http://www.au.kddi.com/ezfactory/tec/spec/eznavi.html l.tokyo2wgs84! end return @__posotion = l end |
- (Object) subno Also known as: ident_subscriber
EZ番号(サブスクライバID)があれば返す。無ければ nil を返す。
24 25 26 |
# File 'lib/jpmobile/mobile/au.rb', line 24 def subno @request.env["HTTP_X_UP_SUBNO"] end |
- (Boolean) supports_cookie?
cookieに対応しているか?
94 95 96 97 98 99 100 101 |
# File 'lib/jpmobile/mobile/au.rb', line 94 def protocol = @request.respond_to?(:scheme) ? @request.scheme : @request.protocol rescue "none" if protocol =~ /\Ahttps/ false else true end end |
- (Boolean) supports_gps?
GPS位置情報取得に対応している場合は true を返す。
89 90 91 |
# File 'lib/jpmobile/mobile/au.rb', line 89 def supports_gps? ! GPS_UNSUPPORTED_DEVICE_ID.include?(device_id) end |
- (Boolean) supports_location?
簡易位置情報取得に対応している場合は true を返す。
84 85 86 |
# File 'lib/jpmobile/mobile/au.rb', line 84 def supports_location? ! LOCATION_UNSUPPORTED_DEVICE_ID.include?(device_id) end |