module Milight::V6::Discover
Search for Mi-Light devices.
Constants
- AUTH_TOKEN
Public Instance Methods
search()
click to toggle source
# File lib/milight/v6/discover.rb, line 14 def search socket = Milight::V6::Socket.new("<broadcast>", 5987) bytes = [0x10, 0x00, 0x00, 0x00, 0x24, 0x02, 0xEE, 0x3E, 0x02] + AUTH_TOKEN socket.send_bytes(bytes) controllers = [] loop do bytes, address = socket.receive_bytes break if bytes.nil? token = bytes[14, AUTH_TOKEN.length] controllers << Milight::V6::Controller.new(address) if token == AUTH_TOKEN end socket.close controllers end