Class: LifxDash::Snoop

Inherits:
Object
  • Object
show all
Defined in:
lib/lifx_dash/snoop.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(network_iface_id) ⇒ Snoop

Returns a new instance of Snoop


6
7
8
# File 'lib/lifx_dash/snoop.rb', line 6

def initialize(network_iface_id)
  @iface = network_iface_id
end

Instance Attribute Details

#ifaceObject (readonly)

Returns the value of attribute iface


4
5
6
# File 'lib/lifx_dash/snoop.rb', line 4

def iface
  @iface
end

Instance Method Details

#runObject


10
11
12
13
14
15
16
# File 'lib/lifx_dash/snoop.rb', line 10

def run
  puts "Snooping for dash button packets on #{iface} ... press [CTRL-c] to stop\n\n"

  LifxDash::Capturer.new(iface).listen do |pkt, mac|
    LOGGER.info "possible Dash button press from MAC address: #{mac} -- pkt summary: #{pkt.peek}"
  end
end