coherence.upnp.core.ssdp (module) — Cohen3 0.8.0 documentation

# coherence.upnp.core.ssdp (module)

## `SSDPServer`

Implementation of a SSDP server under Twisted and EventDispatcher.

class `SSDPServer`(test=False, interface='')

  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`()

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

  `datagramReceived`(data, xxx_todo_changeme)

    Handle a received multicast datagram.

  `register`(manifestation, usn, st, location, server='Linux, 4.18.0-2-amd64, UPnP/1.0, Cohen3, 0.9.0', cache_control='max-age=1800', silent=False, host=None)

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

  `unRegister`(usn)
  `isKnown`(usn)
  `notifyReceived`(headers, xxx_todo_changeme1)

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

  `send_it`(response, destination, delay, usn)
  `discoveryRequest`(headers, xxx_todo_changeme2)

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

  `doNotify`(usn)

    Do notification

  `doByebye`(usn)

    Do byebye

  `resendNotify`()
  `check_valid`()

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

  `subscribe`(name, callback)
  `unsubscribe`(name, callback)
  `callback`(name, *args)