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

Softbank携帯電話

Vodafone, Jphoneのスーパクラス。

Methods

Constants

USER_AGENT_REGEXP = /^(?:SoftBank|Semulator)/   対応するuser-agentの正規表現
MAIL_ADDRESS_REGEXP = /^.+@(?:softbank\.ne\.jp|disney\.ne\.jp)$/   対応するメールアドレスの正規表現 ディズニーモバイル対応

Public Instance methods

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

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 46
46:     def display
47:       return @__display if @__display
48:       p_w = p_h = col_p = cols = nil
49:       if r = @request.env['HTTP_X_JPHONE_DISPLAY']
50:         p_w, p_h = r.split(/\*/,2).map {|x| x.to_i}
51:       end
52:       if r = @request.env['HTTP_X_JPHONE_COLOR']
53:         case r
54:         when /^C/
55:           col_p = true
56:         when /^G/
57:           col_p = false
58:         end
59:         if r =~ /^.(\d+)$/
60:           cols = $1.to_i
61:         end
62:       end
63:       @__display = Jpmobile::Display.new(p_w, p_h, nil, nil, col_p, cols)
64:     end
ident_device()

Alias for serial_number

ident_subscriber()

Alias for x_jphone_uid

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

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 31
31:     def position
32:       return @__position if defined? @__position
33:       if params["pos"] =~ /^([NS])(\d+)\.(\d+)\.(\d+\.\d+)([WE])(\d+)\.(\d+)\.(\d+\.\d+)$/
34:         raise "Unsupported datum" if params["geo"] != "wgs84"
35:         l = Jpmobile::Position.new
36:         l.lat = ($1=="N" ? 1 : -1) * Jpmobile::Position.dms2deg($2,$3,$4)
37:         l.lon = ($5=="E" ? 1 : -1) * Jpmobile::Position.dms2deg($6,$7,$8)
38:         l.options = params.reject {|x,v| !["pos","geo","x-acr"].include?(x) }
39:         return @__position = l
40:       else
41:         return @__position = nil
42:       end
43:     end

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

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 18
18:     def serial_number
19:       @request.env['HTTP_USER_AGENT'] =~ /SN(.+?) /
20:       return $1
21:     end

cookieに対応しているか?

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 67
67:     def supports_cookie?
68:       true
69:     end

UIDを返す。

[Source]

    # File lib/jpmobile/mobile/softbank.rb, line 25
25:     def x_jphone_uid
26:       @request.env["HTTP_X_JPHONE_UID"]
27:     end

[Validate]