Should (some specific) tag parameters be able to be modified after initialization?
timyhac opened this issue · 3 comments
The .NET library bans setting tag parameters after initialization: https://github.com/libplctag/libplctag.NET/blob/master/src/libplctag/NativeTagWrapper.cs#L657
For many parameters this is logical, as the tag handle has resources associated with it that would not make sense if those parameters changed (e.g. name
, elem_count
).
For other parameters, it is not obvious that this is the logical choice (e.g. auto_sync_read_ms
).
Should (some specific) tag parameters be able to be modified after initialization?
One use case would be to temporarily suspend auto read by setting the AutoSyncReadInterval
property of a tag to null
.
Originally posted by @timyhac in #336 (comment)
It seems that there is already the ability to do this for ReadCacheMillisecondDuration
and Timeout
- I don't recall the rationale for allowing for these but not other properties.
It looks like the only way to achieve this is by using the plc_tag_set_int_attribute
function available in the core library. The supported attributes of this are documented here.
So it looks like only these three should be supported:
ReadCacheMillisecondDuration
,DebugLevel
.Timeout
(because this attribute is part of the .NET tag model, not the core libplctag tag model) is supported.
When I created this issue, I was under the impression that the core library already supported suspending auto-read for a period of time. According to the documentation, this is not possible.
The only action here is to make it possible to expose the ability to set the DebugLevel on a tag.