Class: RUPNP::SSDP::Notifier

Inherits:
MulticastConnection show all
Includes:
HTTP
Defined in:
lib/rupnp/ssdp/notifier.rb

Overview

Searcher class for searching devices

Author:

  • Sylvain Daubert

Constant Summary collapse

DEFAULT_NOTIFY_TRY =

Number of SEARCH datagrams to send

2

Constants included from LogMixin

LogMixin::LOG_LEVEL

Instance Method Summary collapse

Methods included from HTTP

#get_http_headers, #get_http_verb, #is_http_status_ok?

Methods inherited from MulticastConnection

#peer_info

Methods included from LogMixin

#log

Constructor Details

#initialize(type, subtype, options = {}) ⇒ Notifier

Returns a new instance of Notifier.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :try_number (Integer)
  • :ttl (Integer)
  • :ip (String)


16
17
18
19
20
21
22
23
# File 'lib/rupnp/ssdp/notifier.rb', line 16

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

Instance Method Details

#post_initObject



26
27
28
29
30
31
32
33
# File 'lib/rupnp/ssdp/notifier.rb', line 26

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

#receive_data(data) ⇒ Object



36
37
# File 'lib/rupnp/ssdp/notifier.rb', line 36

def receive_data(data)
end