Calling readTagGroup/writeTagGroup while scanning or calling multiple readTag/writeTag methods in a row without the use of ASYNC/AWAIT will be handled appropriately without the chance of tags being assigned the wrong values by mistake.
Current Behavior
Currently, If a user were to do something like the following...
const group = new TagGroup();
group.add(new Tag("dint1"));
group.add(new Tag("dint2"));
const PLC = new Controller();
PLC.subscribe(new Tag("dint3"));
PLC.connect("192.168.1.1").then(() => {
PLC.scan();
PLC.readTagGroup(group);
});
or...
const tag1 = new Tag("dint1");
const tag2 = new Tag("dint2");
PLC.connect("192.168.1.1").then(() => {
PLC.readTag(tag1);
PLC.readTag(tag2);
});
then there is a chance that the Controller class can step on other outgoing network requests due to the async nature of js as well as the non-descriptive structure of the CIP Read Tag Service network responses. This could cause the tags to be assigned wrong values.
Possible Solution
Offload Read/Write responsibilities to a worker to synchronously run the requested tasks. This could be implemented as a priority queue (giving call priority to requests originating to the scan group).
Expected Behavior
Calling
readTagGroup
/writeTagGroup
while scanning or calling multiplereadTag
/writeTag
methods in a row without the use ofASYNC/AWAIT
will be handled appropriately without the chance of tags being assigned the wrong values by mistake.Current Behavior
Currently, If a user were to do something like the following...
or...
then there is a chance that the
Controller
class can step on other outgoing network requests due to the async nature of js as well as the non-descriptive structure of the CIP Read Tag Service network responses. This could cause the tags to be assigned wrong values.Possible Solution
Offload Read/Write responsibilities to a worker to synchronously run the requested tasks. This could be implemented as a priority queue (giving call priority to requests originating to the
scan
group).Environment