Comments (7)
Alrighty in that case we'll close the other issue.
from libplctag.net.
Adding constructors to the TagGroup isn't required at all - in fact its probably even more verbose than something like tagGroup.Add(new Tag())
. Hmmmm yes it was just because it was more terse having a TagCreate function where you can provide a few details about the tag - but we could just have them as optional parameters in the constructor instead - which would override any of the same details found in the attribute group.
With the additional async method (with the timeout), we thought that it would still be useful to add a timeout to the non-blocking method. This would be useful as you'd often want it to be non-blocking (so UIs can remain responsive) but still timeout on network connection issues.
The API for HttpClient instead has an optional Timeout property that applies to all calls for a given HttpClient , as opposed to applying it per call. Could make sense? @jkoplo
One benefit of that is that it could be provided in the constructor, and the default behaviour for the constructor could be a blocking call with the provided timeout - but if they chose to delay it they could ask for that too.
var myDint = new Tag<PLC,CLR>(attributeGroup, "MY_DINT", 5000, initNow: false);
await myDint.InitializeAsync(); // non-blocking, and times out after 5000ms
versus
var myDint = new Tag<PLC,CLR>(attributeGroup, "MY_DINT", 5000); // blocks and times out after 5000ms
from libplctag.net.
Following on from the comment about Tag creation from above, I've updated the group branch, the new API is consumed as follows:
var myPlcA = new AttributeGroup()
{
Gateway = "192.168.0.10",
Path = "1,0",
PlcType = PlcType.ControlLogix,
Protocol = Protocol.ab_eip
};
var myPlcB = new AttributeGroup()
{
Gateway = "192.168.0.11",
Path = "1,0",
PlcType = PlcType.ControlLogix,
Protocol = Protocol.ab_eip
};
var dint1a = new Tag<DintMarshaller, int>(myPlcA, "MY_DINT_1D[0]");
var dint2a = new Tag<DintMarshaller, int>(myPlcA, "MY_DINT_1D[1]");
var dint1b = new Tag<DintMarshaller, int>(myPlcB, "MY_DINT_1D[2]");
var dint2b = new Tag<DintMarshaller, int>(myPlcB, "MY_DINT_1D[3]");
var tagGroup = new TagGroup()
{
dint1a, dint2a, dint1b, dint2b
};
var timeout = 1000;
tagGroup.InitializeAll(timeout);
tagGroup.ReadAll(timeout);
var value = dint2b.Value[0];
Console.WriteLine(value);
from libplctag.net.
Do you already know when you plan to merge the Group branch into the master (and maybe also the other branches)? For my project it would be very helpful.
Thx in advance
from libplctag.net.
@AndreasMartinGB - no plans at the moment. It is a reasonably big change from an API perspective, and motivation to integrate it working has dropped somewhat (from me).
Just out of interest - what is your use case here, what interests you about the group branch?
from libplctag.net.
I want to be able to configure the tags to read and write. My idea here was to add the specific base type mapper to the tag group item based on the configuration. From code perspective it would feel cleaner if this would be supported directly but as there is no plan for merging this is also no big deal to do it by my own.
Thx for your answer.
from libplctag.net.
This has not had any serious exploration for some years.
The libplctag.NET project won't add any feature like this unless it were supported in the core library.
from libplctag.net.
Related Issues (20)
- Is it possible to use libplctag.NET for reading and writing tags in Siemens S7-1200? HOT 2
- In the StringPlcMapper, Omron is not present HOT 21
- Array of UDT HOT 4
- Array tag notification on change HOT 1
- Array of BOOL ErrorBadParam HOT 2
- ASP.Net error HOT 6
- Unable to load DLL plctag or one of its dependencies HOT 4
- List all tags in Omron NJ: ErrorUnsupported HOT 20
- How to batch read multiple tags at once? HOT 3
- Tag write timing HOT 4
- DotNetFramework can not work HOT 2
- Read array tags for Omron PLC broken with v1.4.0 HOT 85
- Using `raw_tag_type_bytes` for dynamic tags HOT 2
- Allow `AutoSyncReadInterval` and `AutoSyncWriteInterval` to be set after tag is Initialized HOT 1
- Expose `max_requests_in_flight` on `Tag` or `Tag<M,T>`. HOT 4
- LibPlcTagException ErrorNullPtr HOT 3
- Accessing Union Tag on Omron HOT 16
- Provide a way to get raw bytes from tag buffer, specifying an offset and length HOT 1
- Remove Mapper system (`Tag<M,T>`, `IPlcMapper`, `DintPlcMapper`, `TagReal` etc). HOT 14
- UDT ID / Tag Type HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libplctag.net.