Class: Biscuit::Monitor::AccessPointScanner

Inherits:
Object
  • Object
show all
Defined in:
lib/biscuit-monitor/access_point_scanner.rb

Constant Summary collapse

SCAN_ACCESS_POINTS =
%x[/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --scan --xml]

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#found_access_pointsObject (readonly)

Returns the value of attribute found_access_points.



12
13
14
# File 'lib/biscuit-monitor/access_point_scanner.rb', line 12

def found_access_points
  @found_access_points
end

#scanned_onObject (readonly)

Returns the value of attribute scanned_on.



12
13
14
# File 'lib/biscuit-monitor/access_point_scanner.rb', line 12

def scanned_on
  @scanned_on
end

Instance Method Details

#execObject



14
15
16
17
18
19
20
# File 'lib/biscuit-monitor/access_point_scanner.rb', line 14

def exec
  @scanned_on = Time.now.utc

  @found_access_points = raw_found_access_points.map do |access_point|
    { ssid: access_point["SSID"].strip, ssid_name: access_point["SSID_STR"], bssid: access_point["BSSID"], rssi: access_point["RSSI"], scanned_on: @scanned_on }
  end
end

#raw_found_access_pointsObject



22
23
24
# File 'lib/biscuit-monitor/access_point_scanner.rb', line 22

def raw_found_access_points
  @raw_found_access_points ||= Nokogiri::PList(SCAN_ACCESS_POINTS)
end

#scanObject



26
27
28
# File 'lib/biscuit-monitor/access_point_scanner.rb', line 26

def scan
  SCAN_ACCESS_POINTS
end