The procedure of calling this event depends on the settings of the ""onDataReceive" event" configurator. It is recommended to use the "A = call for all registered variables (in this object and also in other PmaData objects)" setting.
pMe | (Object) Reference to the PmaCommGroup object where the event rises. |
---|---|
pEvent | (Object) Reference to object describing detailed information about the specific event. pEvent.Items - (Array) The property is set to various objects depending on the ""onDataReceive" event" configurator setup: - "A = call for all registered variables (in this object and also in other PmaData objects)". Then each item of this array represents the "data extension ExtComm object" of the variable that is defined either in this PmaCommGroup object or in another PmaData object. - "B = call only for variables defined in this object (obsolete)". Then each item of this array represents the PmVar object that is defined in this PmaCommGroup object. Variables in other PmaData objects (having the ExtComm data extension) are not processed here. In both cases if 10 data items are received simultaneously from the communication, then the event is triggered only once and there are these 10 items in the array. pEvent.ErrorCount - (Long) The number of data items in the array pEvent.Items, that do not have the Quality property set to Good. |
It is called based on the communication progress - for example if a message is received, containing only 5 variables, then the event is triggered and these 5 variables will be in pEvent.Items, and if another message is received with additional variables, then the event is triggered again, etc.
Is triggered even if the whole communication procedure failed and no values were obtained - if so, then the pEvent.ErrorCount value will be the same as the number of items in pEvent.Items.
Example:
We will report following information about the received data items into the Debug item of the INFO system:
var i;
var aItems = pEvent.Items;
var nItems = aItems.GetSize(1);
Pm.Debug("COMM onDataReceive: Size=" + nItems + ", ErrorCount=" + pEvent.ErrorCount);
for (i = 0; i < nItems; i++)
{
Pm.Debug("Name=" + aItems.GetItem(i).Var.Name);
Pm.Debug("Value=" + aItems.GetItem(i).Var.Value);
Pm.Debug("Quality=" + aItems.GetItem(i).Var.Quality);
Pm.Debug("ItemId=" + aItems.GetItem(i).ItemId);
}