How can I receive multiple int32 values, ie when I am receiving one value i need to specify it as type=i ,
<method name="foo3" >
<annotation name="org.dsource.dbus.d.Returns" value="bar"/>
<arg name="bar" type="i" direction="in"/>
</method>
but it is not allowing me to specify as, when I am doing so I am getting the error as expecting value is null
<method name="foo3" >
<annotation name="org.dsource.dbus.d.Returns" value="bar"/>
<arg name="bar" type="ii" direction="in"/>
</method>
then I have tried
<method name="foo3" >
<annotation name="org.dsource.dbus.d.Returns" value="bar"/>
<arg name="bar" type="(ii)" direction="in"/>
</method>
The error message is :
Error org.freedesktop.DBus.Error.InvalidArgs: Type of message, '(ii)',
does not match expected type '((ii))'
It is giving the error as expected value is ((ii)), What I need to get is I need to change the expected value as (ii).. please give me answer
Thanks in advance
You can use it as ,
<method name='YourMethod'>"
<arg type='i' name='name1' direction='in'/>"
<arg type='i' name='name2' direction='in'/>"
</method>"
and you can use (ii) tuple format to call the method
Related
I am attempting to annotate an xml file so that dbus-codegen generates a method that uses GVariant * instead of a native type like gchar.
Here is the xml code I am working with.
<node>
<interface name="org.bluez.GattCharacteristic1">
<method name="WriteValue">
<arg name="value" type="ay" direction="in"/>
</method>
</interface>
</node>
I have read the following stackoverflow post:
Sending a byte array (type `ay`) over D-Bus using GDBus
After reading that post I have tried the following:
1)Edit the xml file to include annotations
<node>
<interface name="org.bluez.GattCharacteristic1">
<method name="WriteValue">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true">
<arg name="value" type="ay" direction="in"/>
</annotation>
</method>
</interface>
</node>
then do:
gdbus-codegen --interface-prefix org.bluez --c-generate-object-manager --generate-c-code generated-code org.bluez.xml
This did not generate what I wanted.
2)Use the --annotate switch on gdbus-codegen:
gdbus-codegen --annotate "org.bluez.GattCharacteristic1.WriteValue()" org.gtk.GDBus.C.ForceGVariant true --interface-prefix org.bluez --c-generate-object-manager --generate-c-code generated-code org.bluez.xml
This did not generate what I wanted.
The only way I have been successful is to change the "ay" in the following code to "a(y):
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true">
<arg name="value" type="a(y)" direction="in"/>
</annotation>'
However this causes other problems.
So how do I get a WriteValue method with the following declaration:
gboolean gatt_characteristic1_call_write_value_sync
(GattCharacteristic1 *proxy,
GVariant *arg_value,
GCancellable *cancellable,
GError **error)
instead of:
gboolean gatt_characteristic1_call_write_value_sync (
GattCharacteristic1 *proxy,
const gchar *arg_value,
GCancellable *cancellable,
GError **error)
Can some please tell me what I am doing wrong.
thank you.
As documented in the D-Bus specification’s section on the introspection data format, you need to use <annotation> as a self-closing element, rather than surrounding the <arg> element.
So you want:
<node>
<interface name="org.bluez.GattCharacteristic1">
<method name="WriteValue">
<arg name="value" type="ay" direction="in">
<annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
</arg>
</method>
</interface>
</node>
You can also see examples of this in the GLib source code.
I am pretty new in WSO2 ESB and I have the following problem trying to retrieve the value of a property and put into an XML document that I am generating.
So, I have the following situation, in my ESB flow I have defined this property named TRANSACTION and having register as value:
<property name="TRANSACTION" scope="default" type="STRING" value="register"/>
Then in my flow I am generating an XML document (it works fine), using a payloadFactory mediator, in this way:
<payloadFactory media-type="xml">
<format>
<register password="$14" username="$13" xmlns="http://ws.wso2.org/dataservice">
<location>
<wiews>$1</wiews>
<pid>$2</pid>
<name>$3</name>
<address>$4</address>
<country>$5</country>
<lat>$6</lat>
<lon>$7</lon>
</location>
<sampledoi>$8</sampledoi>
<sampleid>$9</sampleid>
<date>$10</date>
<method>$11</method>
<genus>$12</genus>
</register>
</format>
<args>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_wiews/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_pid/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_name/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_address/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_country/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_lat/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:hold_lon/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:sample_doi/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:sample_id/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:date/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:method/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:genus/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:username/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:password/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
</args>
</payloadFactory>
That genetes an XML document like this:
<?xml version="1.0" encoding="UTF-8" ?>
<register username="myUserName" password="myPswd">
<sampleid>CGN00001</sampleid>
<genus>Hordeum2</genus>
...................................
...................................
...................................
I want use the value of my TRANSACTION property to create the name of the first tag of my XML document, in this:
<register password="$14" username="$13" xmlns="http://ws.wso2.org
the register name have to be a $15 variable that use the TRANSACTION property value. I think that I can define it in some way into the ... list but I don't know how. At this time in this list I only have value retrieved from a DSS service output, in this case I think that I have to put the value of my TRANSACTION property, but how?
So, is it possible to something like this:
<$15 password="$14" username="$13" xmlns="http://ws.wso2.org
to dinamically insert the tag name?
As far as I know, you can't do that with payloadFactory but you can use a default name for your root node and just after payloadFactory mediator, add this javascript :
<script language="js"><![CDATA[
mc.getEnvelope().getBody().getFirstElement().setLocalName(mc.getProperty("TRANSACTION"));
]]></script>
An other solution would be to use XSLT
How can I pass give multiple complete types in gdbus introspection xml. Example,
<method name="Frobate">
<arg name="foo" type="ii" direction="in"/>
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
When I tried this format, I am getting the error as
Error org.freedesktop.DBus.Error.InvalidArgs: Type of message, '(ii)',
does not match expected type '(null)'
when I am using
<method name="Frobate">
<arg name="foo" type="(ii)" direction="in"/>
<annotation name="org.freedesktop.DBus.Deprecated" value="true"/>
</method>
the error becomes,
Error org.freedesktop.DBus.Error.InvalidArgs: Type of message, '(ii)',
does not match expected type '((ii))'
By this way you can give multiple complete types,
<method name='YourMethod'>"
<arg type='i' name='name1' direction='in'/>"
<arg type='i' name='name2' direction='in'/>"
</method>
I am trying to add a CSS file to my Docbook HTML output. Most examples say:
xsltproc --stringparam html.stylesheet corpstyle.css chunk.xsl myfile.xml
Ours is a Saxon based toolkit... So accordingly, I changed the build file to:
<java jar="${DocBook}/saxon/saxon.jar" fork="true" dir="${gen.dir}/html-multi">
<arg line="com.icl.saxon.StyleSheet"/>
<arg line="${basedir}/book.xml "/>
<arg line="${DocBook}/html/chunk.xsl "/>
<arg line="html.stylesheet=mycss.css"/>
</java>
When running ant, this results in:
Bad param=value on the command line.
How do I set this up?
That seems more like an Ant problem, try
<java jar="${DocBook}/saxon/saxon.jar" fork="true" dir="${gen.dir}/html-multi">
<arg line="${basedir}/book.xml "/>
<arg line="${DocBook}/html/chunk.xsl "/>
<arg line="html.stylesheet=mycss.css"/>
</java>
as it seems the main class is taken from the jar argument.
I am extending a DBus interface on a linux build machine using Qt. The existing interface works fine and I need to add another parameter
The XML generation method generation is:
<method name="get_card_info">
<arg type="b" name="success" direction="out" />
<arg type="s" name="version" direction="out" />
<arg type="s" name="serial" direction="out" />
<arg type="s" name="BeginDate" direction="out" />
<arg type="s" name="ExpirationDate" direction="out" />
<arg type="s" name="RenewalDate" direction="out" />
<arg type="s" name="ZipCode" direction="out" />
<arg type="s" name="ZipCodeExtension" direction="out" />
<!-- <arg type="u" name="cardStatus" direction="out" /> -->
</method>
The code works fine until I uncomment the commented out line, at which point qdbusxml2cpp reports:
interface_dbus_p.h:39:103: error: wrong number of template arguments (9, should be 8)
This is even if I comment out all calls to this function; indeed this is before the linking code even gets compiled; this is all from the qdbusxml2cpp call.
The XML will compile if I change this to six, seven or eight items, but if I increase it to nine it crashes.
I've changed no other configuration files except the XML code.
What's wrong? Is there a limit of eight parameters?
Found it; yes there is a limit, thanks to QDBusPendingReply
"The QDBusPendingReply is a template class with up to 8 template parameters. Those parameters are the types that will be used to extract the contents of the reply's data."
So no more than 8 parameters for me :(