GUPnP.ContextManager

g GObject.Object GObject.Object GUPnP.ContextManager GUPnP.ContextManager GObject.Object->GUPnP.ContextManager

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

create (port)

class

create_full (uda_version, family, port)

get_context_filter ()

get_port ()

get_socket_family ()

get_uda_version ()

manage_control_point (control_point)

manage_root_device (root_device)

rescan_control_points ()

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

context-filter

GUPnP.ContextFilter

r

The Context Filter to use

family

Gio.SocketFamily

r/w/co

Address family to create contexts for

port

int

r/w/co

Port to create contexts for

uda-version

GSSDP.UDAVersion

r/w/co

UDA version the created contexts will implement

Signals

Inherited:

GObject.Object (1)

Name

Short Description

context-available

Signals the availability of new GUPnP.Context.

context-unavailable

Signals the unavailability of a GUPnP.Context.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class GUPnP.ContextManager(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

GUPnP.ContextManagerClass

A manager for [class`GUPnP`.Context] instances.

This utility class that takes care of dynamic creation and destruction of GUPnP.Context objects for all available network interfaces as they go up (connect) and down (disconnect), respectively.

The final implementation depends either on the underlying operating system or can configured during compile time.

It also provides a simple filtering facility if required. See [method`GUPnP`.ContextManager.get_context_filter] and [class`GUPnP`.ContextFilter] for details.

New in version 0.14.0.

classmethod create(port)
Parameters:

port (int) – Port to create contexts for, or 0 if you don’t care what port is used.

Returns:

A new GUPnP.ContextManager object.

Return type:

GUPnP.ContextManager

Factory-method to create a new GUPnP.ContextManager. The final type of the GUPnP.ContextManager depends on the compile-time selection or - in case of NetworkManager - on its availability during run-time. If it is not available, the implementation falls back to the basic Unix context manager instead.

Equivalent to calling GUPnP.ContextManager.create_full (GSSDP.UDAVersion.VERSION_1_0, Gio.SocketFamily.IPV4, port);

New in version 0.18.0.

classmethod create_full(uda_version, family, port)
Parameters:
Returns:

A new GUPnP.ContextManager object.

Return type:

GUPnP.ContextManager

Factory-method to create a new GUPnP.ContextManager. The final type of the GUPnP.ContextManager depends on the compile-time selection or - in case of NetworkManager - on its availability during run-time. If it is not available, the implementation falls back to the basic Unix context manager instead.

New in version 1.2.0.

get_context_filter()
Returns:

The GUPnP.ContextFilter associated with this context manager.

Return type:

GUPnP.ContextFilter

Get the GUPnP.ContextFilter associated with self.

New in version 1.4.0.

get_port()
Returns:

The network port associated with this context manager.

Return type:

int

Get the network port associated with this context manager.

New in version 0.20.0.

get_socket_family()
Returns:

The socket family

Return type:

Gio.SocketFamily

Get the Gio.SocketFamily the contexts are created for. Can be Gio.SocketFamily.IPV6, Gio.SocketFamily.IPV4 or Gio.SocketFamily.INVALID for both

New in version 1.2.0.

get_uda_version()
Returns:

The UDA protocol version

Return type:

GSSDP.UDAVersion

Get the UDA protocol version the contexts are implementing

New in version 1.2.0.

manage_control_point(control_point)
Parameters:

control_point (GUPnP.ControlPoint) – The GUPnP.ControlPoint to be taken care of

By calling this function, you are asking self to keep a reference to control_point until its associated GUPnP.Context is no longer available. You usually want to call this function from your [signal`GUPnP`.ContextManager::context-available] handler after you create a GUPnP.ControlPoint object for the newly available context. You usually then give up your own reference to the control point so it will be automatically destroyed if its context is no longer available.

This function is mainly useful when implementing an UPnP client.

``c void on_context_available (GUPnPContextManager *manager, GUPnPContext *context, gpointer user_data) {

GUPnPControlPoint *cp = gupnp_control_point_new (context, “urn:schemas-upnp-org:device:MediaRenderer:1”); gupnp_context_manager_manage_control_point (manager, cp); // Subscribe to control point’s signals etc. g_object_unref (cp);

}

New in version 0.14.0.

manage_root_device(root_device)
Parameters:

root_device (GUPnP.RootDevice) – The GUPnP.RootDevice to be taken care of

By calling this function, you are asking self to keep a reference to root_device when its associated GUPnP.Context is no longer available. You usually want to call this function from [signal`GUPnP`.ContextManager::context-available] handler after you create a GUPnP.RootDevice object for the newly available context.

You usually then give up your own reference to the root device so it will be automatically destroyed if its context is no longer available.

This function is mainly useful when implementing an UPnP client.

```c void on_context_available (GUPnP.ContextManager *manager, GUPnP.Context *context, object user_data) { GLib.Error *error = None;

GUPnP.RootDevice *rd = GUPnP.RootDevice.new (context, “BasicLight1.xml”, “.”, &error); GUPnP.ContextManager.manage_root_device (manager, rd); // Subscribe to control point’s signals etc. GObject.Object.unref (rd); } ```

New in version 0.14.0.

rescan_control_points()

This function starts a rescan on every control point managed by self. Only the active control points send discovery messages. This function should be called when servers are suspected to have disappeared.

New in version 0.20.3.

Signal Details

GUPnP.ContextManager.signals.context_available(context_manager, context)
Signal Name:

context-available

Flags:

RUN_FIRST

Parameters:

Signals the availability of new GUPnP.Context.

GUPnP.ContextManager.signals.context_unavailable(context_manager, context)
Signal Name:

context-unavailable

Flags:

RUN_FIRST

Parameters:

Signals the unavailability of a GUPnP.Context.

Property Details

GUPnP.ContextManager.props.context_filter
Name:

context-filter

Type:

GUPnP.ContextFilter

Default Value:

None

Flags:

READABLE

The context filter to use.

GUPnP.ContextManager.props.family
Name:

family

Type:

Gio.SocketFamily

Default Value:

Gio.SocketFamily.INVALID

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The socket family to create contexts for. Use Gio.SocketFamily.INVALID for any or Gio.SocketFamily.IPV4 for IPv4 contexts or Gio.SocketFamily.IPV6 for IPv6 contexts

New in version 1.2.0.

GUPnP.ContextManager.props.port
Name:

port

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Port the contexts listen on, or 0 if you don’t care what port is used by GUPnP.Context objects created by this object.

GUPnP.ContextManager.props.uda_version
Name:

uda-version

Type:

GSSDP.UDAVersion

Default Value:

GSSDP.UDAVersion.VERSION_UNSPECIFIED

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The UDA version the contexts will support. Use GSSDP.UDAVersion.VERSION_UNSPECIFIED for using the default UDA version.

New in version 1.2.0.