libplctag/libplctag.NET

Expose more TagOfT properties to ITag interface

Devqon opened this issue · 2 comments

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?

Sorry for not replying to this - I think your detective work is correct also, I will add the extra events and properties shortly.

Hi @Devqon - this is completed in libplctag.NET v1.4.0