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.



8
9
10
# File 'lib/lifx_dash/snoop.rb', line 8

def initialize(network_iface_id)
  @iface = network_iface_id
end

Instance Attribute Details

#ifaceObject (readonly)

Returns the value of attribute iface.



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

def iface
  @iface
end

Instance Method Details

#runObject



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

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