pMe | (Object) Reference to the PmaOpcDaClientGroup object where the event rises. |
---|---|
pEvent | (Object) Reference to an object describing detailed information about the specific event.
pEvent.Items - (Array) [for reading] The property is set only if the ""onDataReceive" event" configurator is set to:
- "A = trigger the event for all registered variables (in this object and also in other PmaData objects)".
Then each item of the array represents the "data extension ExtOpcDa" object of the variable that is defined either in the PmaOpcDaClientGroup object or in another PmaData object. - "B = calling for the whole group of received variables - only for variables defined in this object (obsolete)".
Then each item of the array represents the PmVar object that is defined in the PmaOpcDaClientGroup object. Variables in other PmaData objects (that have the ExtOpcDa data extension) are not processed here. In both cases, if for example 10 data items are simultaneously received from the OPC server then the event is triggered only once and there are these 10 items in the array. pEvent.VarName - (String) [for reading] Data item name. The property is set only if the ""onDataReceive" event" configurator is set to "C = calling for each variable separately - only for variables defined in this object (obsolete)".
For example if 10 data items are received from the OPC server, then the event is triggered for each item separatelly and the name of the item is in the pEvent.VarName property. pEvent.Reason - (Long) [for reading] Reason of the receipt.
0 - Receiving from the automatic update (only if the "Refresh from server at server change" configurator is checked).
1 - After calling the Read method.
2 - After calling the Refresh method. |
var aItems = pEvent.Items;
var nItems = aItems.GetSize(1);
Pm.Debug("OPC onDataReceive: Size=" + nItems + ", Reason=" + pEvent.Reason);
var iItm;
for (iItm = 0; iItm < nItems; iItm++)
{
Pm.Debug("Name=" + aItems.GetItem(iItm).Var.Name);
Pm.Debug("Value=" + aItems.GetItem(iItm).Var.Value);
Pm.Debug("Quality=" + aItems.GetItem(iItm).Var.Quality);
Pm.Debug("ItemId=" + aItems.GetItem(iItm).ItemId);
}