Skip to content

Type detection of enumerations #263

@dgl-cw

Description

@dgl-cw

Automatic type detection on an enum fails, as the symbol_type returned by ADSIGRP_SYM_INFOBYNAMEEX (in adsGetSymbolInfo) 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 for INT and ADST_UINT16 for UINT.
I found this explanation why dataType is not used normally

pyads/pyads/symbol.py

Lines 176 to 179 in fd78232

# info.dataType is an integer mapping to a type in
# constants.ads_type_to_ctype.
# However, this type ignores whether the variable is really an array!
# So are not going to be using this and instead rely on the textual
But it could be used in addition to the symbol_type to detect unknown type names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions