We use this driver with a generic wrapper to expose the tag functionality. We therefore have a method that looks like this:
public static ITag MapToLibPlcTag(Type type)
{
return type switch
{
Type _ when type == typeof(bool) => new TagBool(),
Type _ when type == typeof(int) => new TagDint(),
// .. etc.
_ => throw new NotSupportedException();
};
}
This exposes the ITag to our wrapper, but we do need some of the functionality that is 'hidden' in the TagOfT<> for polling mechanisms, like the AutoSyncReadInterval and all of the events (ReadStarted, ReadCompleted etc.).
There is no way to expose a TagOfT<> instead of the ITag, because that needs a compile-time generic where we only have a runtime System.Type.
Is there a reason that these properties aren't exposed through the ITag interface?
EDIT
It seems that at the time the ITag interface was introduced (#77), these properties did not exist yet. Is my conclusion correct that when the new properties were introduced they should have been added to the ITag?
We use this driver with a generic wrapper to expose the tag functionality. We therefore have a method that looks like this:
This exposes the
ITag
to our wrapper, but we do need some of the functionality that is 'hidden' in theTagOfT<>
for polling mechanisms, like theAutoSyncReadInterval
and all of the events (ReadStarted
,ReadCompleted
etc.).There is no way to expose a
TagOfT<>
instead of theITag
, because that needs a compile-time generic where we only have a runtimeSystem.Type
.Is there a reason that these properties aren't exposed through the
ITag
interface?EDIT It seems that at the time the
ITag
interface was introduced (#77), these properties did not exist yet. Is my conclusion correct that when the new properties were introduced they should have been added to theITag
?