Sha256: 8378d8e1ae17e2a7b01046bbbff1506441055f504d48ae9bdaa506f104541fc0

Contents?: true

Size: 1.01 KB

Versions: 17

Compression:

Stored size: 1.01 KB

Contents

module PatronusFati
  module MessageModels
    Ssid = CapStruct.new(
      :mac, :checksum, :type, :ssid, :beaconinfo, :cryptset, :cloaked,
      :firsttime, :lasttime, :maxrate, :beaconrate
    )
    Ssid.set_data_filter(:mac) { |val| val.downcase }
    Ssid.set_data_filter(:checksum, :firsttime, :lasttime, :maxrate,
                         :beaconrate) { |val| val.to_i }
    Ssid.set_data_filter(:cloaked) { |val| val.to_i == 1 }
    Ssid.set_data_filter(:cryptset) do |val|
      val = val.to_i
      next [SSID_CRYPT_MAP[0]] if val == 0
      SSID_CRYPT_MAP.select { |k, _| (k & val) != 0 }.map { |_, v| v }
    end

    # Attempt to map the returned SSID type to one we know about it and convert
    # it to a string. In the event we don't know it will leave this as an
    # integer field.
    #
    # @param [String] ssid_type The string is actually an integer value in
    #   numeric form (this is how it's received from the network).
    Ssid.set_data_filter(:type) { |val| SSID_TYPE_MAP[val.to_i] || val.to_i }
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
patronus_fati-0.8.16 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.15 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.14 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.13 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.12 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.11 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.10 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.9 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.8 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.7 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.6 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.5 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.4 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.3 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.2 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.1 lib/patronus_fati/message_models/ssid.rb
patronus_fati-0.8.0 lib/patronus_fati/message_models/ssid.rb