Module: RUPNP::SSDP

Defined in:
lib/rupnp/ssdp.rb,
lib/rupnp/ssdp/multicast_connection.rb

Overview

SSDP module. This a discovery part of UPnP.

Author:

  • Sylvain Daubert

Defined Under Namespace

Modules: SearchResponder Classes: Listener, MSearchResponder, MulticastConnection, Notifier, Searcher, USearchResponder

Constant Summary collapse

KNOWN_TARGETS =

Some shorcut for common targets

{
  :all  => 'ssdp:all',
  :root => 'upnp:rootdevice'
}

Class Method Summary collapse

Class Method Details

.listen(options = {}) ⇒ Object

Listen for devices’ announces

Parameters:



33
34
35
36
# File 'lib/rupnp/ssdp.rb', line 33

def self.listen(options={})
  EM.open_datagram_socket(MULTICAST_IP, DISCOVERY_PORT,
                          SSDP::Listener, options)
end

.notify(type, stype, options = {}) ⇒ Object

Notify announces

Parameters:



40
41
42
43
# File 'lib/rupnp/ssdp.rb', line 40

def self.notify(type, stype, options={})
  EM.open_datagram_socket(MULTICAST_IP, DISCOVERY_PORT,
                          SSDP::Notifier, type, stype, options)
end

.search(target = :all, options = {}) ⇒ Object

Search devices

Parameters:



26
27
28
29
# File 'lib/rupnp/ssdp.rb', line 26

def self.search(target=:all, options={})
  options[:search_target] =  KNOWN_TARGETS[target] || target
  EM.open_datagram_socket '0.0.0.0', 0, SSDP::Searcher, options
end