33 lines
1.5 KiB
C#
33 lines
1.5 KiB
C#
namespace ZB.MOM.WW.OtOpcUa.Driver.TwinCAT;
|
|
|
|
/// <summary>
|
|
/// Filter system / infrastructure symbols out of a TwinCAT symbol-loader walk. TC PLC
|
|
/// runtimes export plumbing symbols alongside user-declared ones — <c>TwinCAT_SystemInfoVarList</c>,
|
|
/// constants, IO task images, motion-layer internals — that clutter an OPC UA address space
|
|
/// if exposed.
|
|
/// </summary>
|
|
public static class TwinCATSystemSymbolFilter
|
|
{
|
|
/// <summary><c>true</c> when the symbol path matches a known system / infrastructure prefix.</summary>
|
|
public static bool IsSystemSymbol(string instancePath)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(instancePath)) return true;
|
|
|
|
// Runtime-exported info lists.
|
|
if (instancePath.StartsWith("TwinCAT_SystemInfoVarList", StringComparison.OrdinalIgnoreCase)) return true;
|
|
if (instancePath.StartsWith("TwinCAT_", StringComparison.OrdinalIgnoreCase)) return true;
|
|
if (instancePath.StartsWith("Global_Version", StringComparison.OrdinalIgnoreCase)) return true;
|
|
|
|
// Constants pool — read-only, no operator value.
|
|
if (instancePath.StartsWith("Constants.", StringComparison.OrdinalIgnoreCase)) return true;
|
|
|
|
// Anonymous / compiler-generated.
|
|
if (instancePath.StartsWith("__", StringComparison.Ordinal)) return true;
|
|
|
|
// Motion / NC internals routinely surfaced by the symbol loader.
|
|
if (instancePath.StartsWith("Mc_", StringComparison.OrdinalIgnoreCase)) return true;
|
|
|
|
return false;
|
|
}
|
|
}
|