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 extern.louie 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

Note

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

logCategory = 'ssdp'
root_devices
shutdown()[source]
datagramReceived(data, xxx_todo_changeme)[source]

Handle a received multicast datagram.

register(manifestation, usn, st, location, server='Linux, 4.18.0-2-amd64, UPnP/1.0, Cohen3, 0.8.2', 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]