Class: Y2Network::WirelessScanner

Inherits:
Object
  • Object
show all
Includes:
Yast::Logger
Defined in:
src/lib/y2network/wireless_scanner.rb

Overview

Scans for wireless cells (access points and ad-hoc cells)

It uses the iwlist command line utility to get the cells information.

Examples:

Getting cells through the an interfaced named "wlo1"

scanner = WirelessScanner.new("wlo1")
scanner.cells #=> [#<Y2Network::WirelessNetwork...>]

Defined Under Namespace

Classes: AuthMode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iface_name) ⇒ WirelessScanner

Constructor

Parameters:

  • iface_name (String)

    Name of the interface that will be used to scan for devices



64
65
66
# File 'src/lib/y2network/wireless_scanner.rb', line 64

def initialize(iface_name)
  @iface_name = iface_name
end

Instance Attribute Details

#iface_nameString (readonly)

Returns Name of the interface to scan for devices.

Returns:

  • (String)

    Name of the interface to scan for devices



59
60
61
# File 'src/lib/y2network/wireless_scanner.rb', line 59

def iface_name
  @iface_name
end

Instance Method Details

#cellsArray<WirelessNetwork>

Returns the wireless cells

Returns:



72
73
74
75
76
77
78
79
# File 'src/lib/y2network/wireless_scanner.rb', line 72

def cells
  raw_cells_from_iwlist(fetch_iwlist).map do |cell|
    cell_from_raw_data(cell)
  end
rescue Cheetah::ExecutionFailed => e
  log.error "Could not fetch the list of wireless cells: #{e.inspect}"
  []
end