Skip to content

Commit

Permalink
arrayed parameters now suppoerted in command packet template
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbsco committed Apr 7, 2024
1 parent 83dead9 commit 7de2d23
Showing 1 changed file with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,23 @@ Command {{ name }} {{ command.suite.component.instance_name }}-{{ command.name }
{% for literals in field.datatype.model.literals %}
State {{ literals.name }} {{ literals.value }}
{% endfor %}{% endif -%}{% endfor %}
ID_Parameter Adamant_Commant_Id 64 16 UINT MIN MAX {{ command.id }} "Adamant command ID"
ID_Parameter Adamant_Command_Id 64 16 UINT MIN MAX {{ command.id }} "Adamant command ID"
{# The command argument definitions. #}
{% if command.type %}{% if command.type_model %}{% for field_name, field in command.type_model.fields.items() %}
Append_Parameter {% if field.type_model.name %}{{ field.type_model.name }}.{% endif %}{{ field.name }} {% if field.format.type %}{{ field.format.type[1:] }}{% endif %}{% if field.type_model.size %}{{ field.type_model.size }}{% endif %}
{% if field.format.type %}{% if 'F' in field.format.type[0] %} FLOAT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}
{% elif 'U' in field.format.type[0] %} UINT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}
{% elif 'E' in field.format.type[0] %} UINT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}
{% elif 'I' in field.format.type[0] %} INT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}{% endif %}
{% if command.type %}{% if command.type_model %}{% for field in command.type_model.flatten() %}
{% if 'x' in (field.format|string)[2] %}Append_Array_Parameter {{ (field.format|string)[1] }}
{%- if 'F' in (field.format|string)[0] %} FLOAT
{%- elif 'U' in (field.format|string)[0] %} UINT
{%- elif 'E' in (field.format|string)[0] %} UINT
{%- elif 'I' in (field.format|string)[0] %} INT{% endif %} {{ (field.format|string)[1]|int * (field.format|string)[3:]|int }} "{{ field.description|replace('\n','') }}"
{% else %}Append_Parameter {% if field.type_model.name %}{{ field.type_model.name }}.{% endif %}{{ field.name }} {% if field.format.type %}{{ field.format.type[1:] }}{% endif %}{% if field.type_model.size %}{{ field.type_model.size }}{% endif %}
{% if 'F' in (field.format|string)[0] %} FLOAT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}
{% elif 'U' in (field.format|string)[0] %} UINT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}
{% elif 'E' in (field.format|string)[0] %} UINT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}
{% elif 'I' in (field.format|string)[0] %} INT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}
{% else %} UINT MIN MAX {% if command.default_value %}{{ command.default_value }}{% else %}0{% endif %}{% endif %} "{{ field.description|replace('\n','') }}"
{% if field.format.type and 'E' in field.format.type[0] %}{% for literals in field.type_model.literals %}
{% if field.format and 'E' in (field.format|string)[0] %}{% for literals in field.type_model.literals %}
State {{ literals.name }} {{ literals.value }}
{% endfor %}{% endif %}
{% endfor %}{% endif %}{% endif %}
{% endfor %}{% endif %}{% endif %}

{% endfor %}

0 comments on commit 7de2d23

Please sign in to comment.