Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quasar implementation of UaVariant CacheVariables prevent writing array from client #321

Open
xaxis-ii opened this issue Jan 17, 2024 · 0 comments

Comments

@xaxis-ii
Copy link

xaxis-ii commented Jan 17, 2024

The default generated AddressSpace implementation of UaVariant-type CacheVariables prevents clients from writing back arrays matching the current datatype, since the valueRank is always set to -1 for non-array types (including UaVariant), despite the server being allowed/able to write in an array-type variant value.

A suggested fix would be setting the valueRank for UaVariant CacheVariables to -3 (which in the open62541 implementation corresponds to scalar or 1D-array; see open62541 docs - Information Modelling) when generating the AddressSpace class. A possible implementation would be the addition of the following two lines to AddressSpace/templates/designToClassBody.jinja:

141         {# configure valueRank and arrayDimensions #}
142         {% if cv.array|length>0 %}
143           m_{{cv.get('name')}}->setValueRank( 1 ); // 1D-array
144           {
145             UaUInt32Array arrayDimensions;
146             arrayDimensions.create(1);
147             m_{{cv.get('name')}}->setArrayDimensions(arrayDimensions);
148           }
149 +       {% elif cv.get('dataType') == 'UaVariant' %}
150 +         m_{{cv.get('name')}}->setValueRank( -3 ); // scalar or 1D-array
151         {% else %}
152           m_{{cv.get('name')}}->setValueRank( -1 ); // scalar
153         {% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant