Re: GUPnP.ServiceProxy.send_action_hash() invalid parameters
- From: Jens Georg <mail jensge org>
- To: Yullia Tatarinova <yullia tatarinova gmail com>, gupnp-list gnome org
- Subject: Re: GUPnP.ServiceProxy.send_action_hash() invalid parameters
- Date: Thu, 04 Feb 2016 23:06:00 +0100
Hi,
Unfortunately that's a bug in GUPnP that prevents its usage with GI.
sorry about that.
We have no clear solution for that currently.
(Also, please don't use send_hash, it's broken and cannot be fixed)
Hi all,
I'm trying to use Python GUPnP with ContentDirectory service.
While executing send_action_hash or send_action_list I got an
exception:
TypeError: send_action_list() takes exactly 6 arguments (7 given)
or
TypeError: send_action_hash() takes exactly 4 arguments (5 given)
Code is :
from gi.repository import GUPnP, GLib
def device_available (cp, proxy):
print ("Found " + proxy.get_friendly_name())
content_dir = proxy.get_service("urn:schemas-upnp-
org:service:ContentDirectory")
if content_dir is not None:
in_data = {
}
out_data = {
}
b, out = content_dir.send_action_hash("Browse", None,
in_data, out_data)
b, out =
content_dir.send_action_list("Browse",None, in_data.keys(),
in_data.values(),
out_data.keys(), out_data.values())
ccontext = GUPnP.Context.new(None, None, 0)
cp = GUPnP.ControlPoint.new(ccontext, "upnp:rootdevice")
cp.set_active(True)
cp.connect("device-proxy-available", device_available)
GLib.MainLoop().run()
Content of my /usr/share/gir-1.0/GUPnP-1.0.gir with these methods is:
<method name="send_action_hash"
c:identifier="gupnp_service_proxy_send_action_hash"
deprecated="1"
deprecated-version="0.20.9">
<doc xml:space="preserve">See
gupnp_service_proxy_send_action(); this version takes a pair of
#GHashTable<!-- -->s for runtime determined parameter lists.
Do not use this function in newly written code; it cannot guarantee
the
order of arguments and thus breaks interaction with many
devices.</doc>
<doc-deprecated xml:space="preserve">Use
gupnp_service_proxy_send_action() or
gupnp_service_proxy_send_action_list()</doc-deprecated>
<return-value transfer-ownership="none">
<doc xml:space="preserve">%TRUE if sending the action was
succesful.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="proxy" transfer-ownership="none">
<doc xml:space="preserve">A #GUPnPServiceProxy</doc>
<type name="ServiceProxy" c:type="GUPnPServiceProxy*"/>
</instance-parameter>
<parameter name="action" transfer-ownership="none">
<doc xml:space="preserve">An action</doc>
<type name="utf8" c:type="const char*"/>
</parameter>
<parameter name="error" transfer-ownership="none">
<doc xml:space="preserve">The location where to store any
error, or %NULL</doc>
<type name="GLib.Error" c:type="GError**"/>
</parameter>
<parameter name="in_hash" transfer-ownership="none">
<doc xml:space="preserve">A #GHashTable of in
parameter name and #GValue pairs</doc>
<type name="GLib.HashTable" c:type="GHashTable*">
<type name="utf8"/>
<type name="GObject.Value"/>
</type>
</parameter>
<parameter name="out_hash"
direction="inout"
caller-allocates="0"
transfer-ownership="full">
<doc xml:space="preserve">A #GHashTable
of out parameter name and initialized #GValue pairs</doc>
<type name="GLib.HashTable" c:type="GHashTable*">
<type name="utf8"/>
<type name="GObject.Value"/>
</type>
</parameter>
</parameters>
</method>
<method name="send_action_list"
c:identifier="gupnp_service_proxy_send_action_list">
<doc xml:space="preserve">The synchronous variant of
#gupnp_service_proxy_begin_action_list and
#gupnp_service_proxy_end_action_list.</doc>
<return-value transfer-ownership="none">
<doc xml:space="preserve">%TRUE if sending the action was
succesful.</doc>
<type name="gboolean" c:type="gboolean"/>
</return-value>
<parameters>
<instance-parameter name="proxy" transfer-ownership="none">
<doc xml:space="preserve">A #GUPnPServiceProxy</doc>
<type name="ServiceProxy" c:type="GUPnPServiceProxy*"/>
</instance-parameter>
<parameter name="action" transfer-ownership="none">
<doc xml:space="preserve">An action</doc>
<type name="utf8" c:type="const char*"/>
</parameter>
<parameter name="error" transfer-ownership="none">
<doc xml:space="preserve">The location where to store any
error, or %NULL</doc>
<type name="GLib.Error" c:type="GError**"/>
</parameter>
<parameter name="in_names" transfer-ownership="none">
<doc xml:space="preserve">#GList of 'in' parameter
names (as strings)</doc>
<type name="GLib.List" c:type="GList*">
<type name="utf8"/>
</type>
</parameter>
<parameter name="in_values" transfer-ownership="none">
<doc xml:space="preserve">#GList of values (as
#GValue) that line up with @in_names</doc>
<type name="GLib.List" c:type="GList*">
<type name="GObject.Value"/>
</type>
</parameter>
<parameter name="out_names" transfer-ownership="none">
<doc xml:space="preserve">#GList of 'out' parameter
names (as strings)</doc>
<type name="GLib.List" c:type="GList*">
<type name="utf8"/>
</type>
</parameter>
<parameter name="out_types" transfer-ownership="none">
<doc xml:space="preserve">#GList of types (as #GType)
that line up with @out_names</doc>
<type name="GLib.List" c:type="GList*">
<type name="GType"/>
</type>
</parameter>
<parameter name="out_values"
direction="out"
caller-allocates="0"
transfer-ownership="full">
<doc xml:space="preserve">#GList of values
(as #GValue) that line up with @out_names and @out_types.</doc>
<type name="GLib.List" c:type="GList**">
<type name="GObject.Value"/>
</type>
</parameter>
</parameters>
</method>
pdb show next results:
-> b, out = content_dir.send_action_hash("Browse", None, in_data,
out_data)
(Pdb) type(content_dir)
<class 'gi.repository.GUPnP.ServiceProxy'>
(Pdb) content_dir.send_action_hash.__doc__
'send_action_hash(self, action:str, error:error, in_hash:dict,
out_hash:dict) -> out_hash:dict'
(Pdb) content_dir.send_action_list.__doc__
'send_action_list(self, action:str, error:error, in_names:list,
in_values:list, out_names:list, out_types:list) -> out_values:list'
(Pdb) p GUPnP
<gi.module.DynamicModule 'GUPnP' from '/usr/lib/girepository-
1.0/GUPnP-1.0.typelib'>
What I'm wrong or am I right? Could somebody give me some information
about possible issues or how to call these methods with
correct parameters or maybe how to form correct .gir file? There is
no any information about such issues in
the internet.
Type of service while debugging is ServiceProxy .
_______________________________________________
gupnp-list mailing list
gupnp-list gnome org
https://mail.gnome.org/mailman/listinfo/gupnp-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]