Skip to content

Commit

Permalink
Add D-Bus template files
Browse files Browse the repository at this point in the history
The jinja template files are necessary, but they had not been included
in the PR somehow.

Signed-off-by: Gunnar Andersson <gunnar_dev@[email protected]>
  • Loading branch information
Gunnar Andersson committed Aug 20, 2023
1 parent 6593efe commit e028780
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 4 deletions.
14 changes: 14 additions & 0 deletions ifex/templates/D-Bus/AST.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{# Collect namespace names for naming of interface. (This does not generate any text) #}
{% for n in item.namespaces %}
{{ add_namespace(n) }}
{% endfor %}

{# Start of generation here #}
<!DOCTYPE node PUBLIC
"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd" >
<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
{% for n in item.namespaces %}
{{ gen(n) }}
{% endfor %}
</node>
Empty file.
4 changes: 4 additions & 0 deletions ifex/templates/D-Bus/Enumeration.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if item.description != None %}
<!-- Enumeration {{item.name}} = {{item.description.strip()}} -->
{% endif %}
<!-- Enumeration {{item.name}} values are : {% for o in item.options %}{{o.name}} = {{o.value}}, {% endfor %} -->
1 change: 1 addition & 0 deletions ifex/templates/D-Bus/Error.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!-- FIXME generate error here for {{error.name}} -->
5 changes: 1 addition & 4 deletions ifex/templates/D-Bus/Event.tpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{% if item.description != "" %}<!-- Event (D-Bus signal): {{ item.description }} -->{% endif %}
<signal name="{{item.name}}">
{% for x in item.output: %}
<arg direction="in" type="{{ gen_dbus_type(x.datatype) }}" name="{{x.name}}"/>
{% endfor %}
{% for x in item.input: %}
<arg direction="out" type="{{ gen_dbus_type(x.datatype) }}" name="{{x.name}}"/>
<arg type="{{ gen_dbus_type(x.datatype) }}" name="{{x.name}}"/>
{% endfor %}
</signal>
Empty file.
18 changes: 18 additions & 0 deletions ifex/templates/D-Bus/Interface.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<interface name="{{get_interface_name(item.name)}}">
{% for x in item.methods + item.properties + item.events %}
{{ gen(x) }}
{% endfor %}

{# Definition of named structs and other datatypes have little meaning in D-Bus, but we can generate some comments about them: #}
{% for x in item.structs %}
{{gen(x)}}
{% endfor %}

{% for x in item.typedefs %}
{{gen(x)}}
{% endfor %}

{% for x in item.enumerations %}
{{gen(x)}}
{% endfor %}
</interface>
5 changes: 5 additions & 0 deletions ifex/templates/D-Bus/Member.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% if item.description != None %}
<!-- member {{item.name}} of type {{item.datatype}} = {{item.description.strip()}} -->
{% else %}
<!-- member {{item.name}} of type {{item.datatype}} -->
{% endif %}
31 changes: 31 additions & 0 deletions ifex/templates/D-Bus/Method.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{% if item.description != None %}
{# Here is how real doc tags can be created #}
{# But comments are enough if the XML will not be used to generated docs #}
{# <doc:doc><doc:description><doc:para>{{item.description.strip(" \t\n")}}</doc:para></doc:description></doc:doc> #}
<!-- Method: {{item.name}} = {{item.description.strip(" \t\n")}} -->
{% endif %}
<method name="{{item.name}}">

{% for arg in item.input %}
{% if arg.description != None %}
<!-- Input: {{arg.name}} = {{arg.description.strip(" \t\n")}} -->
{% endif %}
<arg name="{{arg.name}}" direction="in" type="{{gen_dbus_type(arg.datatype)}}"/>
{% endfor %}

{% for arg in item.output %}
{% if arg.description != None %}
<!-- Output: {{arg.name}} = {{arg.description.strip(" \t\n")}} -->
{% endif %}
<arg name="{{arg.name}}" direction="out" type="{{gen_dbus_type(arg.datatype)}}"/>
{% endfor %}

{% for arg in item.errors %}
{% if arg.description != None %}
<!-- FIXME: Generate error here, {{arg.name}} ({{arg.description}}) -->
{% else %}
<!-- FIXME: Generate error here, {{arg.name}} -->
{% endif %}
{% endfor %}
</method>

16 changes: 16 additions & 0 deletions ifex/templates/D-Bus/Namespace.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% if item.interface != None %}
{{gen(item.interface)}}
{% endif %}

{# Definition of named structs and other datatypes have little meaning in D-Bus, but we can generate some comments about them: #}
{% for x in item.structs %}
{{gen(x)}}
{% endfor %}

{% for x in item.typedefs %}
{{gen(x)}}
{% endfor %}

{% for x in item.enumerations %}
{{gen(x)}}
{% endfor %}
Empty file added ifex/templates/D-Bus/Option.tpl
Empty file.
4 changes: 4 additions & 0 deletions ifex/templates/D-Bus/Property.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{% if item.description != None %}
<!-- Property: {{item.name}} = {{item.description.strip(" \t\n")}} -->
{% endif %}
<property name="{{item.name}}" type="{{gen_dbus_type(item.datatype)}}"/>
12 changes: 12 additions & 0 deletions ifex/templates/D-Bus/Struct.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% if item.description != None %}
<!-- Struct {{item.name}} = {{item.description.strip()}} -->
{% endif %}
<!-- Struct {{item.name}} defined as: { {% for m in item.members %}{{m.name}} ({{m.datatype}}), {% endfor %} } -->
<!-- Struct {{item.name}} members details: -->
{% for m in item.members %}
{% if m.description != None %}
<!-- member {{item.name}}:{{m.name}} of type {{m.datatype}} = {{m.description.strip()}} -->
{% else %}
<!-- member {{item.name}}:{{m.name}} of type {{m.datatype}} -->
{% endif %}
{% endfor %}
Empty file.

0 comments on commit e028780

Please sign in to comment.