coherence.upnp.core.ssdp (module)

SSDPServer

Implementation of a SSDP server under Twisted and EventDispatcher.

class SSDPServer(test=False, interface='')[source]

Bases: eventdispatcher.eventdispatcher.EventDispatcher, twisted.internet.protocol.DatagramProtocol, coherence.log.LogAble

A class implementing a SSDP server.

    Changed in version 0.9.0:
  • Migrated from louie/dispatcher to EventDispatcher

  • The emitted events changed:

    • datagram_received => datagram_received

    • Coherence.UPnP.SSDP.new_device => new_device

    • Coherence.UPnP.SSDP.removed_device => removed_device

    • Coherence.UPnP.Log => log

  • Added new class variable root_devices which uses EventDispatcher’s properties

Note

The methods notifyReceived() and searchReceived() are called when the appropriate type of datagram is received by the server.

logCategory = 'ssdp'
root_devices

A list of the detected root devices

shutdown()[source]

Shutdowns the server SSDPServer and sends out the bye bye notifications via method doByebye().

datagramReceived(data, xxx_todo_changeme)[source]

Handle a received multicast datagram.

register(manifestation, usn, st, location, server='Linux, 4.15.0-1028-gcp, UPnP/1.0, Cohen3, 0.9.1', cache_control='max-age=1800', silent=False, host=None)[source]

Register a service or device that this SSDP server will respond to.

unRegister(usn)[source]
isKnown(usn)[source]
notifyReceived(headers, xxx_todo_changeme1)[source]

Process a presence announcement. We just remember the details of the SSDP service announced.

send_it(response, destination, delay, usn)[source]
discoveryRequest(headers, xxx_todo_changeme2)[source]

Process a discovery request. The response must be sent to the address specified by (host, port).

doNotify(usn)[source]

Do notification

doByebye(usn)[source]

Do byebye

resendNotify()[source]
check_valid()[source]

Check if the discovered devices are still ok, or if we haven’t received a new discovery response

subscribe(name, callback)[source]
unsubscribe(name, callback)[source]
callback(name, *args)[source]