Read data asynchronously from group or items
TransID = readasync(GObj)
TransID
= readasync(IObj)
TransID = readasync(GObj)
and
TransID
= readasync(IObj)
asynchronously read data for all the
items contained in the dagroup
object, GObj
,
or for the vector of daitem
objects specified by
IObj
. TransID
is a unique transaction ID
for the asynchronous request.
For asynchronous reads, data is always read from the device, not from the server
cache. The Active
property is ignored for asynchronous
reads.
When the read operation completes, a read async event is generated by the server.
If a callback function file is specified for the ReadAsyncFcn
property, that function executes when the event is generated.
You can cancel an in-progress asynchronous request using cancelasync
.
When a readasync
operation succeeds, the Value
, Quality
, and TimeStamp
properties of the associated items
are updated to reflect the values obtained from the read operation.
Configure a client, group, and item, for the Matrikon™ Simulation Server:
da = opcda('localhost','Matrikon.OPC.Simulation'); connect(da); grp = addgroup(da,'ExReadAsync'); grp.UpdateRate = 20; itm = additem(grp,'Random.Real8');
Perform two asynchronous read operations:
tid1 = readasync(grp) tid2 = readasync(grp)
Examine the event log:
pause(2) disp('Event log:') showopcevents(da)
cancelasync
| read
| refresh
| write
| writeasync