summaryrefslogtreecommitdiff
path: root/utils/ipc/generators/libcamera_templates
diff options
context:
space:
mode:
Diffstat (limited to 'utils/ipc/generators/libcamera_templates')
-rw-r--r--utils/ipc/generators/libcamera_templates/definition_functions.tmpl2
-rw-r--r--utils/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl2
-rw-r--r--utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl2
-rw-r--r--utils/ipc/generators/libcamera_templates/proxy_functions.tmpl10
-rw-r--r--utils/ipc/generators/libcamera_templates/serializer.tmpl6
5 files changed, 16 insertions, 6 deletions
diff --git a/utils/ipc/generators/libcamera_templates/definition_functions.tmpl b/utils/ipc/generators/libcamera_templates/definition_functions.tmpl
index 94bb4918..8b8509f3 100644
--- a/utils/ipc/generators/libcamera_templates/definition_functions.tmpl
+++ b/utils/ipc/generators/libcamera_templates/definition_functions.tmpl
@@ -9,7 +9,7 @@
# \param enum Enum object whose definition is to be generated
#}
{%- macro define_enum(enum) -%}
-enum {{enum.mojom_name}} {
+enum{{" class" if enum|is_scoped}} {{enum.mojom_name}} {
{%- for field in enum.fields %}
{{field.mojom_name}} = {{field.numeric_value}},
{%- endfor %}
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
index 415ec283..160601f7 100644
--- a/utils/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
+++ b/utils/ipc/generators/libcamera_templates/module_ipa_interface.h.tmpl
@@ -69,7 +69,7 @@ public:
{%- for method in interface_event.methods %}
Signal<
{%- for param in method.parameters -%}
- {{"const " if not param|is_pod}}{{param|name}}{{" &" if not param|is_pod}}
+ {{"const " if not param|is_pod}}{{param|name}}{{" &" if not param|is_pod and not param|is_enum}}
{{- ", " if not loop.last}}
{%- endfor -%}
> {{method.mojom_name}};
diff --git a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl
index c308dd10..ed270f5c 100644
--- a/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl
+++ b/utils/ipc/generators/libcamera_templates/module_ipa_proxy.h.tmpl
@@ -46,7 +46,7 @@ public:
{%- for method in interface_event.methods %}
Signal<
{%- for param in method.parameters -%}
- {{"const " if not param|is_pod}}{{param|name}}{{" &" if not param|is_pod}}
+ {{"const " if not param|is_pod}}{{param|name}}{{" &" if not param|is_pod and not param|is_enum}}
{{- ", " if not loop.last}}
{%- endfor -%}
> {{method.mojom_name}};
diff --git a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
index cbcfb64a..2be65d43 100644
--- a/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
+++ b/utils/ipc/generators/libcamera_templates/proxy_functions.tmpl
@@ -62,7 +62,9 @@
{%- else %}
std::tie({{param.mojom_name}}Buf, std::ignore) =
{%- endif %}
-{%- if param|is_enum %}
+{%- if param|is_flags %}
+ IPADataSerializer<{{param|name_full}}>::serialize({{param.mojom_name}}
+{%- elif param|is_enum %}
IPADataSerializer<uint32_t>::serialize(static_cast<uint32_t>({{param.mojom_name}})
{%- else %}
IPADataSerializer<{{param|name}}>::serialize({{param.mojom_name}}
@@ -105,7 +107,9 @@
#}
{%- macro deserialize_param(param, pointer, loop, buf, fds, iter, data_size) -%}
{{"*" if pointer}}{{param.mojom_name}} =
-{%- if param|is_enum %}
+{%- if param|is_flags %}
+IPADataSerializer<{{param|name_full}}>::deserialize(
+{%- elif param|is_enum %}
static_cast<{{param|name_full}}>(IPADataSerializer<uint32_t>::deserialize(
{%- else %}
IPADataSerializer<{{param|name}}>::deserialize(
@@ -133,7 +137,7 @@ IPADataSerializer<{{param|name}}>::deserialize(
{%- if param|needs_control_serializer %}
&controlSerializer_
{%- endif -%}
-){{")" if param|is_enum}};
+){{")" if param|is_enum and not param|is_flags}};
{%- endmacro -%}
diff --git a/utils/ipc/generators/libcamera_templates/serializer.tmpl b/utils/ipc/generators/libcamera_templates/serializer.tmpl
index 77bae36f..323e1293 100644
--- a/utils/ipc/generators/libcamera_templates/serializer.tmpl
+++ b/utils/ipc/generators/libcamera_templates/serializer.tmpl
@@ -34,6 +34,10 @@
std::tie({{field.mojom_name}}, std::ignore) =
{%- if field|is_pod %}
IPADataSerializer<{{field|name}}>::serialize(data.{{field.mojom_name}});
+ {%- elif field|is_flags %}
+ IPADataSerializer<{{field|name_full}}>::serialize(data.{{field.mojom_name}});
+ {%- elif field|is_enum_scoped %}
+ IPADataSerializer<uint{{field|bit_width}}_t>::serialize(static_cast<uint{{field|bit_width}}_t>(data.{{field.mojom_name}}));
{%- elif field|is_enum %}
IPADataSerializer<uint{{field|bit_width}}_t>::serialize(data.{{field.mojom_name}});
{%- endif %}
@@ -96,6 +100,8 @@
{{- check_data_size(field_size, 'dataSize', field.mojom_name, 'data')}}
{%- if field|is_pod %}
ret.{{field.mojom_name}} = IPADataSerializer<{{field|name}}>::deserialize(m, m + {{field_size}});
+ {%- elif field|is_flags %}
+ ret.{{field.mojom_name}} = IPADataSerializer<{{field|name_full}}>::deserialize(m, m + {{field_size}});
{%- else %}
ret.{{field.mojom_name}} = static_cast<{{field|name_full}}>(IPADataSerializer<uint{{field|bit_width}}_t>::deserialize(m, m + {{field_size}}));
{%- endif %}