question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to retrieve tag values in a Read Complete event callback?

See original GitHub issue

When using the Async Read Complete event callback. What is the best way to get the value returned?

With the code below, the object being passed is of type NativeTagWrapper and doesn’t seem to expose a value attribute. TagEventArgs is only returning “Ok” for status.

var testTag = new Tag<DintPlcMapper, int>
{
    Gateway = plc.IPAddress,
    Path = plc.Path,
    PlcType = PlcType.ControlLogix,
    Protocol = Protocol.ab_eip,
    Name = "testDINT"
};
testTag.ReadCompleted += TestTag_ReadCompleted;
testTag.InitializeAsync();
testTag.ReadAsync();

await Task.Delay(10000);

void TestTag_ReadCompleted(object? sender, TagEventArgs e) { Console.WriteLine($Read Completed"); }

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
PWSyscommented, Oct 3, 2022

@timyhac , I tested this change, and it works as expected. Thanks again for your help!

0reactions
PWSyscommented, Oct 3, 2022

Wow, thank you @timyhac ! I’ll give this a try later today.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get returned values from my listener's callback ES6 ...
1. var results = softwaresSearch. · 1. The maxwell function will be called when the user releases a key while typing into the...
Read more >
Returning data from a Reg Event Callback to the calling VI
I'm not too familiar with event callbacks but I believe you can do this by passing a queue/user event reference into the 'User...
Read more >
R: XML Event/Callback element-wise Parser
This reads and processes the contents of an XML file or string by invoking user-level functions associated with different components of the XML...
Read more >
EventTarget: addEventListener() method - Web APIs | MDN
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered ...
Read more >
JavaScript Callback Functions – What are Callbacks in JS ...
So here we select the button first with its id, and then we add an event listener with the addEventListener method. It takes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found