INGEAR.NET.MBLINK

 

Tag.QualityCode Property

Returns the quality state of the last MODBUS device access operation for the Tag instance

[Visual Basic]
NotOverridable Public ReadOnly Property QualityCode As Integer _
    Implements ITag.QualityCode
[C#]
public int QualityCode {get;}

Property Value

QUAL_GOOD - Value read/written to MODBUS device is valid.

QUAL_BAD - Value read/written to MODBUS device is invalid.

QUAL_UNCERTAIN - Value read/write to MODBUS device is in an unknown state.

Implements

ITag.QualityCode

Remarks

TimeStamp is updated when this property is QUAL_GOOD, otherwise Timestamp is invalid.

Example

VB
Imports MBLink
Dim MBDevice As New Controller("192.168.1.45")
Dim MyTag As New Tag("40001")
MBDevice.ReadTag(MyTag)
If MyTag.QualityCode = ResultCode.QUAL_GOOD Then
  Console.WriteLine(MyTag.Value.ToString())
Else
  Console.WriteLine(MyTag.QualityString)
End If
C#
using MBLink;
Controller MBDevice = new Controller("192.168.1.45");
Tag MyTag = new Tag("40001");
MBDevice.ReadTag(MyTag);
if (MyTag.QualityCode != ResultCode.QUAL_GOOD)
  Console.WriteLine(MyTag.QualityString);
else
  Console.WriteLine(MyTag.Value.ToString());

See Also

Tag Class | MBLink Namespace | QualityString | ErrorCode | ErrorString