Class Jpmobile::Mobile::Softbank
In: lib/jpmobile/mobile/softbank.rb
Parent: AbstractMobile

Softbank携帯電話

Vodafone, Jphoneのスーパクラス。

Methods

Constants

USER_AGENT_REGEXP = /^SoftBank/   対応するuser-agentの正規表現

Public Instance methods

画面情報を Display クラスのインスタンスで返す。

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 32
32:     def display
33:       p_w = p_h = col_p = cols = nil
34:       if r = @request.env['HTTP_X_JPHONE_DISPLAY']
35:         p_w, p_h = r.split(/\*/,2).map {|x| x.to_i}
36:       end
37:       if r = @request.env['HTTP_X_JPHONE_COLOR']
38:         case r
39:         when /^C/
40:           col_p = true
41:         when /^G/
42:           col_p = false
43:         end
44:         if r =~ /^.(\d+)$/
45:           cols = $1.to_i
46:         end
47:       end
48:       Jpmobile::Display.new(p_w, p_h, nil, nil, col_p, cols)
49:     end
ident()

Alias for serial_number

位置情報があれば Position のインスタンスを返す。無ければ nil を返す。

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 19
19:     def position
20:       if params["pos"] =~ /^([NS])(\d+)\.(\d+)\.(\d+\.\d+)([WE])(\d+)\.(\d+)\.(\d+\.\d+)$/
21:         raise "Unsupported datum" if params["geo"] != "wgs84"
22:         l = Jpmobile::Position.new
23:         l.lat = ($1=="N" ? 1 : -1) * Jpmobile::Position.dms2deg($2,$3,$4)
24:         l.lon = ($5=="E" ? 1 : -1) * Jpmobile::Position.dms2deg($6,$7,$8)
25:         l.options = params.reject {|x,v| !["pos","geo","x-acr"].include?(x) }
26:         return l
27:       else
28:         return nil
29:       end
30:     end

製造番号を返す。無ければ nil を返す。

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 14
14:     def serial_number
15:       @request.user_agent =~ /SN(.+?) /
16:       return $1
17:     end

cookieに対応しているか?

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 53
53:     def supports_cookie?
54:       true
55:     end

[Validate]