coherence.upnp.core.device (module)

Devices

This module contains two classes describing UPnP devices.

Device

The base class for all devices.

RootDevice

A device representing a root device.

class Device(parent=None, udn=None)[source]

Bases: eventdispatcher.eventdispatcher.EventDispatcher, coherence.log.LogAble

Represents a UPnP’s device, but this is not a root device, it’s the base class used for any device. See RootDevice if you want a root device.

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

  • The emitted events changed:

    • Coherence.UPnP.Device.detection_completed => device_detection_completed

    • Coherence.UPnP.Device.remove_client => device_remove_client

  • New events: device_service_notified, device_got_client

  • Changes some class variables to benefit from the EventDispatcher’s properties:

logCategory = 'device'
client

Defined by ControlPoint. It should be one of:

Whenever a client is set an event will be sent notifying it by on_client().

icons

A list of the device icons.

devices

A list of the device devices.

services

A list of the device services.

detection_completed

To know whenever the device detection has completed. Defaults to False and it will be set automatically to True by the class method receiver().

as_dict()[source]
remove(*args)[source]
receiver(*args, **kwargs)[source]
service_detection_failed(device)[source]
get_id()[source]
get_uuid()[source]
get_embedded_devices()[source]
get_embedded_device_by_type(type)[source]
get_services()[source]
get_service_by_type(type)[source]
add_service(service)[source]

Add a service to the device. Also we check if service already notified, and trigger the callback if needed. We also connect the device to service in case the service still not completed his detection in order that the device knows when the service has completed his detection.

Parameters

service (object) – A service which should be an initialized instance of Service

remove_service_with_usn(service_usn)[source]
add_device(device)[source]
get_friendly_name()[source]
get_device_type()[source]
get_friendly_device_type()[source]
get_markup_name()[source]
get_device_type_version()[source]
set_client(client)[source]
get_client()[source]
on_client(*args)[source]

Automatically triggered whenever a client is set or changed. Emmit an event notifying that the client has changed.

New in version 0.9.0.

renew_service_subscriptions()[source]

iterate over device’s services and renew subscriptions

unsubscribe_service_subscriptions()[source]

Iterate over device’s services and unsubscribe subscriptions

parse_device(d)[source]
get_location()[source]
get_usn()[source]
get_upnp_version()[source]
get_urlbase()[source]
get_presentation_url()[source]
get_parent_id()[source]
make_fullyqualified(url)[source]
as_tuples()[source]
class RootDevice(infos)[source]

Bases: coherence.upnp.core.device.Device

Description for a root device.

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

  • The emitted events changed:

    • Coherence.UPnP.RootDevice.detection_completed => root_device_detection_completed

    • Coherence.UPnP.RootDevice.removed => root_device_removed

root_detection_completed

To know whenever the root device detection has completed. Defaults to False and it will be set automatically to True by the class method device_detect().

remove(*args)[source]
get_usn()[source]
get_st()[source]
get_location()[source]
get_upnp_version()[source]
get_urlbase()[source]
get_host()[source]
is_local()[source]
is_remote()[source]
device_detect(*args, **kwargs)[source]

This method is automatically triggered whenever the property of the base class Device.detection_completed is set to True. Here we perform some more operations, before the RootDevice emits an event notifying that the root device detection has completed.

add_device(device)[source]
get_devices()[source]
parse_description()[source]
make_fullyqualified(url)[source]

Be aware that this function returns a byte string