Package brisa :: Package upnp :: Package control_point :: Module msearch :: Class MSearch
[hide private]
[frames] | no frames]

Class MSearch

source code

object --+
         |
        MSearch

Represents a MSearch. Contains some control functions for starting and stopping the search. While running, search will be repeated in regular intervals specified at construction or passed to the start() method.

Instance Methods [hide private]
 
__init__(self, ssdp, start=True, interval=DEFAULT_SEARCH_TIME, ssdp_addr='239.255.255.250', ssdp_port=1900)
Constructor for the MSearch class.
source code
boolean
is_running(self)
Returns True if the search is running (it's being repeated in the interval given).
source code
 
start(self, interval=DEFAULT_SEARCH_TIME, search_type=DEFAULT_SEARCH_TYPE)
Starts the search.
source code
 
stop(self)
Stops the search.
source code
 
destroy(self)
Destroys and quits MSearch.
source code
 
double_discover(self, search_type=DEFAULT_SEARCH_TYPE)
Sends a MSearch imediatelly.
source code
 
discover(self, type="ssdp:all")
Mounts and sends the discover message (MSearch).
source code
 
_datagram_received(self, data, (host, port))
Callback for the UDPListener when messages arrive.
source code
 
_cleanup(self)
Clean up references.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  msg_already_started = 'tried to start() MSearch when already s...
  msg_already_stopped = 'tried to stop() MSearch when already st...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, ssdp, start=True, interval=DEFAULT_SEARCH_TIME, ssdp_addr='239.255.255.250', ssdp_port=1900)
(Constructor)

source code 

Constructor for the MSearch class.

Parameters:
  • ssdp (SSDPServer) - ssdp server instance that will receive new device events and subscriptions
  • start (boolean) - if True starts the search when constructed
  • interval (float) - interval between searchs
  • ssdp_addr (string @type ssdp_port integer) - ssdp address for listening (UDP)
  • ssdp_port - ssdp port for listening (UDP)
Overrides: object.__init__

start(self, interval=DEFAULT_SEARCH_TIME, search_type=DEFAULT_SEARCH_TYPE)

source code 

Starts the search.

Parameters:
  • interval (float) - interval between searchs. Default is 600.0 seconds
  • search_type (string) - type of the search, default is "ssdp:all"

double_discover(self, search_type=DEFAULT_SEARCH_TYPE)

source code 

Sends a MSearch imediatelly. Each call to this method will yield a MSearch message, that is, it won't repeat automatically.

discover(self, type="ssdp:all")

source code 

Mounts and sends the discover message (MSearch).

Parameters:
  • type (string) - search type

_datagram_received(self, data, (host, port))

source code 

Callback for the UDPListener when messages arrive.

Parameters:
  • data (string) - raw data received
  • host (string) - host where data came from
  • port (integer) - port where data came from

Class Variable Details [hide private]

msg_already_started

Value:
'tried to start() MSearch when already started'

msg_already_stopped

Value:
'tried to stop() MSearch when already stopped'