Class: Apscanner::Sensor

Inherits:
Object
  • Object
show all
Defined in:
lib/apscanner/entities/sensor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Sensor

Returns a new instance of Sensor.



6
7
8
9
10
11
12
13
# File 'lib/apscanner/entities/sensor.rb', line 6

def initialize(options = {})
  @port = options[:port]
  @ip_address = options[:ip_address]
  @community = options[:community]
  @uuid = options[:uuid]
  @type = options[:type].to_sym
  @access_points = []
end

Instance Attribute Details

#access_pointsObject (readonly)

Returns the value of attribute access_points.



3
4
5
# File 'lib/apscanner/entities/sensor.rb', line 3

def access_points
  @access_points
end

#communityObject (readonly)

Returns the value of attribute community.



3
4
5
# File 'lib/apscanner/entities/sensor.rb', line 3

def community
  @community
end

#ip_addressObject (readonly)

Returns the value of attribute ip_address.



3
4
5
# File 'lib/apscanner/entities/sensor.rb', line 3

def ip_address
  @ip_address
end

#portObject (readonly)

Returns the value of attribute port.



3
4
5
# File 'lib/apscanner/entities/sensor.rb', line 3

def port
  @port
end

#typeObject

Returns the value of attribute type.



4
5
6
# File 'lib/apscanner/entities/sensor.rb', line 4

def type
  @type
end

#uuidObject (readonly)

Returns the value of attribute uuid.



3
4
5
# File 'lib/apscanner/entities/sensor.rb', line 3

def uuid
  @uuid
end

Instance Method Details

#scanObject



15
16
17
18
19
20
21
# File 'lib/apscanner/entities/sensor.rb', line 15

def scan
  t0 = Time.now
  @access_points = SnmpManager.new(self).run
  Apscanner.logger.info("Scanned #{@access_points.count} APs from " \
                        "#{@ip_address} in #{(Time.now - t0).round(2)}s.")
  self
end