Class | Jpmobile::Mobile::Softbank |
In: |
lib/jpmobile/mobile/softbank.rb
|
Parent: | AbstractMobile |
USER_AGENT_REGEXP | = | /^SoftBank/ | 対応するuser-agentの正規表現 |
画面情報を Display クラスのインスタンスで返す。
# File lib/jpmobile/mobile/softbank.rb, line 41 41: def display 42: p_w = p_h = col_p = cols = nil 43: if r = @request.env['HTTP_X_JPHONE_DISPLAY'] 44: p_w, p_h = r.split(/\*/,2).map {|x| x.to_i} 45: end 46: if r = @request.env['HTTP_X_JPHONE_COLOR'] 47: case r 48: when /^C/ 49: col_p = true 50: when /^G/ 51: col_p = false 52: end 53: if r =~ /^.(\d+)$/ 54: cols = $1.to_i 55: end 56: end 57: Jpmobile::Display.new(p_w, p_h, nil, nil, col_p, cols) 58: end
位置情報があれば Position のインスタンスを返す。無ければ nil を返す。
# File lib/jpmobile/mobile/softbank.rb, line 27 27: def position 28: if params["pos"] =~ /^([NS])(\d+)\.(\d+)\.(\d+\.\d+)([WE])(\d+)\.(\d+)\.(\d+\.\d+)$/ 29: raise "Unsupported datum" if params["geo"] != "wgs84" 30: l = Jpmobile::Position.new 31: l.lat = ($1=="N" ? 1 : -1) * Jpmobile::Position.dms2deg($2,$3,$4) 32: l.lon = ($5=="E" ? 1 : -1) * Jpmobile::Position.dms2deg($6,$7,$8) 33: l.options = params.reject {|x,v| !["pos","geo","x-acr"].include?(x) } 34: return l 35: else 36: return nil 37: end 38: end
製造番号を返す。無ければ nil を返す。
# File lib/jpmobile/mobile/softbank.rb, line 14 14: def serial_number 15: @request.user_agent =~ /SN(.+?) / 16: return $1 17: end
cookieに対応しているか?
# File lib/jpmobile/mobile/softbank.rb, line 61 61: def supports_cookie? 62: true 63: end