-
Notifications
You must be signed in to change notification settings - Fork 96
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
Type detection of enumerations #263
Comments
@dgl-cw thanks for bringing this up. Could you elaborate what the exact problem is that arises from this? E.g. will there be an error when reading/writing a value? |
When trying to get the symbol, it misidentifies the type as String and procedes to raise an uncought UnicodeDecodeError when trying to decode that non-string. It's maybe just a get_symbol issue.
|
And the variable is declared as this?:
and you try to create a symbol like this? sym = plc.get_symbol("GVL.enum_var") |
Yes, exactly. |
Automatic type detection on an enum fails, as the symbol_type returned by
ADSIGRP_SYM_INFOBYNAMEEX
(inadsGetSymbolInfo
) is the name of the enum itself (e.g.E_something
) instead of the underlying integer type.Some testing showed that
SAdsSymbolEntry.dataType
i.e. the adsDataType of symbol matches the underlying type of the enum e.g.ADST_INT16
forINT
andADST_UINT16
forUINT
.I found this explanation why dataType is not used normally
pyads/pyads/symbol.py
Lines 176 to 179 in fd78232
The text was updated successfully, but these errors were encountered: