module RUPNP # Searcher class for searching devices # @author Sylvain Daubert class SSDP::Notifier < SSDP::MulticastConnection include SSDP::HTTP # Number of SEARCH datagrams to send DEFAULT_NOTIFY_TRY = 2 # @param [Hash] options # @option options [Integer] :try_number # @option options [Integer] :ttl # @option options [String] :ip def initialize(type, subtype, options={}) @type = (type == :root) ? 'upnp:rootdevice' : type @subtype = subtype @notify_count = options[:try_number] || DEFAULT_NOTIFY_TRY @options = options super options.delete(:ttl) end # @private def post_init notify = notify_request @notify_count.times do send_datagram notify, MULTICAST_IP, DISCOVERY_PORT log :debug, "#{self.class}: send datagram:\n#{notify}" end close_connection_after_writing end # @private def receive_data(data) end private def notify_request usn = if @type[0..3] == 'uuid' @type else "uuid:#{@options[:uuid]}::#@type" end case @subtype when :alive <