System datatypes (hardware identifiers, connection handles, OB/event refs)
Beside the ordinary process datatypes, an S7-1500 symbol table contains a family of system datatypes — hardware identifiers (HW_ANY, HW_IO, HW_IOSYSTEM, HW_SUBMODULE, HW_DEVICE, HW_MODULE, …), connection handles (CONN_ANY, CONN_OUC, CONN_RID), and OB / event / AOM references (OB_*, EVENT_*, AOM_IDENT, …). The library currently doesn't handle them anywhere.
On the wire they are plain integers (a numeric hardware/connection ID), so the C# reference driver treats each as an alias of a basic integer type.
Current state
- Neither
s7.typeinfo.Softdatatype (used by browse()) nor the SoftDataType table (softdatatype→DataType/size + the name→type dict in _s7commplus_*) define codes ≥ 144.
browse() therefore filters them out (they are not in SUPPORTED_SOFTDATATYPES); and even if surfaced they could not be decoded, since there is no entry for them in the read mapping.
C# reference mapping (thomas-v2/S7CommPlusDriver, LGPL-3.0 — ClientApi/PlcTags.cs TagFactory)
HW_*, CONN_ANY, CONN_OUC → WORD (u16)
AOM_IDENT, EVENT_*, CONN_RID → DWORD (u32)
OB_* → INT (i16)
PORT, RTM, DB_ANY → UINT (u16)
REMOTE → ANY
(softdatatype codes are in the ~128–180 range, e.g. HW_ANY=144, HW_IO=149, CONN_OUC=170.)
Proposed work — two steps
Step 1 — declare + read.
- Add the system softdatatype codes to the
Softdatatype / SoftDataType enums.
- Map each to its underlying integer wire type + size so
read_symbolic() / read_tag() can decode them (a system tag returns its numeric ID).
- Unit tests with constructed PValue buffers, one per integer-width category.
Step 2 — surface in browse().
4. Add them to SUPPORTED_SOFTDATATYPES so the tree builder emits them as leaves.
5. Decide what data_type reports: the semantic type name (HW_ANY) or the underlying base type (Word). The C# driver keeps the semantic name for display while reading as the base int; reporting the base type is the least-invasive option, since the existing decode mapping then handles it unchanged.
Validation
Against a live S7-1500: with Step 2, the browse() symbol count reaches full parity with the C# reference symbol table; spot-read a handful of system tags and confirm the numeric ID matches a direct read_symbolic() by access-sequence.
Related: #4 (browse() currently emits process datatypes only).
System datatypes (hardware identifiers, connection handles, OB/event refs)
Beside the ordinary process datatypes, an S7-1500 symbol table contains a family of system datatypes — hardware identifiers (
HW_ANY,HW_IO,HW_IOSYSTEM,HW_SUBMODULE,HW_DEVICE,HW_MODULE, …), connection handles (CONN_ANY,CONN_OUC,CONN_RID), and OB / event / AOM references (OB_*,EVENT_*,AOM_IDENT, …). The library currently doesn't handle them anywhere.On the wire they are plain integers (a numeric hardware/connection ID), so the C# reference driver treats each as an alias of a basic integer type.
Current state
s7.typeinfo.Softdatatype(used bybrowse()) nor theSoftDataTypetable (softdatatype→DataType/size + the name→type dict in_s7commplus_*) define codes ≥ 144.browse()therefore filters them out (they are not inSUPPORTED_SOFTDATATYPES); and even if surfaced they could not be decoded, since there is no entry for them in the read mapping.C# reference mapping (thomas-v2/S7CommPlusDriver, LGPL-3.0 —
ClientApi/PlcTags.csTagFactory)HW_*,CONN_ANY,CONN_OUC→WORD(u16)AOM_IDENT,EVENT_*,CONN_RID→DWORD(u32)OB_*→INT(i16)PORT,RTM,DB_ANY→UINT(u16)REMOTE→ANY(softdatatype codes are in the ~128–180 range, e.g.
HW_ANY=144,HW_IO=149,CONN_OUC=170.)Proposed work — two steps
Step 1 — declare + read.
Softdatatype/SoftDataTypeenums.read_symbolic()/read_tag()can decode them (a system tag returns its numeric ID).Step 2 — surface in
browse().4. Add them to
SUPPORTED_SOFTDATATYPESso the tree builder emits them as leaves.5. Decide what
data_typereports: the semantic type name (HW_ANY) or the underlying base type (Word). The C# driver keeps the semantic name for display while reading as the base int; reporting the base type is the least-invasive option, since the existing decode mapping then handles it unchanged.Validation
Against a live S7-1500: with Step 2, the
browse()symbol count reaches full parity with the C# reference symbol table; spot-read a handful of system tags and confirm the numeric ID matches a directread_symbolic()by access-sequence.Related: #4 (
browse()currently emits process datatypes only).