GetCount - method of the PmaCommMsg object
Description:
The method returns the number of transfers of this object.
Syntax:
Long GetCount(Long nType)
Parameters:
nType | (Long) Specifies transmissions in this object whose number we want to get.
0 - The number of all transfers (successul and failed) since application launch ( = GetCount(1) + GetCount(2))
1 - The number of all successful transfers since application launch
2 - The number of all failed transfers since application launch
3 - The number of latest failed transfers. This number is set to 0 after every successful transmission. |
---|
Note:
By the term "
transmission" is here understood the action that is finally terminated by the
onEndOfTransfer event. If the "
Number of repeats after unsuccessful transmission" configurator is greater than 1 in the serial link parameters (or in the Ethernet parameters), then the message is repeated more times on error but from the point of this statistics
it is only 1 transmission.
If the parameter
pEvent.Error = 0 in the
onEndOfTransfer event, then it is "
successful transmission" otherwise it is "
failed transmission".
Example:
If communication error occurs 5 times in a row in this object, then notify (e.g. call the
alarm, etc.)
JavaScriptVBScriptSelect and copy to clipboard
var oCommMsg = pMe.Pm("/Comm/mr");
if (oCommMsg.GetCount(3) > 5)
{
// ... The action for warning the non-functional communication
}
Dim oCommMsg
Set oCommMsg = pMe.Pm("/Comm/mr")
If oCommMsg.GetCount(3) > 5 Then
' ... The action for warning the non-functional communication
End If