GUPnP.ContextManager¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r |
The Context Filter to use |
||
r/w/co |
Address family to create contexts for |
||
r/w/co |
Port to create contexts for |
||
r/w/co |
UDA version the created contexts will implement |
Signals¶
- Inherited:
Name |
Short Description |
|---|---|
Signals the availability of new |
|
Signals the unavailability of a |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent_instance |
r |
Class Details¶
- class GUPnP.ContextManager(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
A manager for [class`GUPnP`.Context] instances.
This utility class that takes care of dynamic creation and destruction of
GUPnP.Contextobjects 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.ContextManagerobject.- Return type:
Factory-method to create a new
GUPnP.ContextManager. The final type of theGUPnP.ContextManagerdepends 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:
uda_version (
GSSDP.UDAVersion) –GSSDP.UDAVersionthe created contexts should implement (UDA 1.0 or 1.1). ForGSSDP.UDAVersion.VERSION_UNSPECIFIEDfor default.family (
Gio.SocketFamily) –Gio.SocketFamilyto create the context forport (
int) – Port to create contexts for, or 0 if you don’t care what port is used.
- Returns:
A new
GUPnP.ContextManagerobject.- Return type:
Factory-method to create a new
GUPnP.ContextManager. The final type of theGUPnP.ContextManagerdepends 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.ContextFilterassociated with this context manager.- Return type:
Get the
GUPnP.ContextFilterassociated with self.New in version 1.4.0.
- get_port()¶
- Returns:
The network port associated with this context manager.
- Return type:
Get the network port associated with this context manager.
New in version 0.20.0.
- get_socket_family()¶
- Returns:
The socket family
- Return type:
Get the
Gio.SocketFamilythe contexts are created for. Can beGio.SocketFamily.IPV6,Gio.SocketFamily.IPV4orGio.SocketFamily.INVALIDfor bothNew in version 1.2.0.
- get_uda_version()¶
- Returns:
The UDA protocol version
- Return type:
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) – TheGUPnP.ControlPointto be taken care of
By calling this function, you are asking self to keep a reference to control_point until its associated
GUPnP.Contextis no longer available. You usually want to call this function from your [signal`GUPnP`.ContextManager::context-available] handler after you create aGUPnP.ControlPointobject 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) – TheGUPnP.RootDeviceto be taken care of
By calling this function, you are asking self to keep a reference to root_device when its associated
GUPnP.Contextis no longer available. You usually want to call this function from [signal`GUPnP`.ContextManager::context-available] handler after you create aGUPnP.RootDeviceobject 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,objectuser_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:
- Parameters:
context_manager (
GUPnP.ContextManager) – The object which received the signalcontext (
GUPnP.Context) – The now availableGUPnP.Context
Signals the availability of new
GUPnP.Context.
- Signal Name:
context-unavailable- Flags:
- Parameters:
context_manager (
GUPnP.ContextManager) – The object which received the signalcontext (
GUPnP.Context) – The now unavailableGUPnP.Context
Signals the unavailability of a
GUPnP.Context.
Property Details¶
- GUPnP.ContextManager.props.context_filter¶
- Name:
context-filter- Type:
- Default Value:
- Flags:
The context filter to use.
- GUPnP.ContextManager.props.family¶
- Name:
family- Type:
- Default Value:
- Flags:
The socket family to create contexts for. Use
Gio.SocketFamily.INVALIDfor any orGio.SocketFamily.IPV4for IPv4 contexts orGio.SocketFamily.IPV6for IPv6 contextsNew in version 1.2.0.
- GUPnP.ContextManager.props.port¶
- Name:
port- Type:
- Default Value:
0- Flags:
Port the contexts listen on, or 0 if you don’t care what port is used by
GUPnP.Contextobjects created by this object.
- GUPnP.ContextManager.props.uda_version¶
- Name:
uda-version- Type:
- Default Value:
- Flags:
The UDA version the contexts will support. Use
GSSDP.UDAVersion.VERSION_UNSPECIFIEDfor using the default UDA version.New in version 1.2.0.