public final class QualityCode
extends java.lang.Object
implements java.io.Serializable
The 32-bits are arranged as follows: First two bits represent the level
0b00 GOOD 0b01 UNCERTAIN 0b10 BAD 0b11 RESERVED
The next 14 bits are reserved, and NOT CURRENTLY USED.
The lower 16 bits represent the meaning of the code.
Inductive Automation reserves the first 1024 codes(0x0000 through 0x03FF) for codes that it will define. By convention, our codes are broken up into four bands within the range of 0 through 1023 Values 0-255 are "good" codes. Values 256-511 are "uncertain" codes Values 512 - 767 are "bad" codes that represent a condition that should have been expected (something didn't work in a way that was entirely predictable, like Values 768 - 1023 are "worse" bad codes that represent a condition that was unexpected
Third parties may use codes 1024 through 65535 (0x0400 through 0xFFFF) for their own codes, although doing so will tend to cause very generic "good / bad" representations of the quality.
The (optional) diagnosticMessage field in this class is used to add contextual information about the circumstance in which the quality code was generated. It is NOT meant to be the name or description of the quality code. In many cases, only the code will be stored / transferred for efficiency, and the diagnostic message may be lost in the long term (e.g. if the code is stored as part of tag history)
Modifier and Type | Class and Description |
---|---|
static class |
QualityCode.Level |
Modifier and Type | Field and Description |
---|---|
static QualityCode |
Bad
General quality for a bad value.
|
static QualityCode |
Bad_AccessDenied
Data requested requires credentials not held by requesting user
|
static QualityCode |
Bad_AggregateNotFound
Requested aggregate was not found
|
static QualityCode |
Bad_DatabaseNotConnected
A database connection required for this value is not connected
|
static QualityCode |
Bad_Disabled
Data source is not currently enabled.
|
static QualityCode |
Bad_Failure
A "failure" code was received from the underlying system.
|
static QualityCode |
Bad_GatewayCommOff
Connection to the Ignition gateway is currently turned off
|
static QualityCode |
Bad_LicenseExceeded
A license limit has been exceeded
|
static QualityCode |
Bad_NotConnected
A connection required for this value is not currently connected
|
static QualityCode |
Bad_NotFound
Object requested was not found
|
static QualityCode |
Bad_OutOfRange
This value has exceeded it's allowed range
|
static QualityCode |
Bad_ReadOnly
The target is not writable/readonly.
|
static QualityCode |
Bad_ReferenceNotFound
Derived or referenced value required an object which was not found
|
static QualityCode |
Bad_Stale
Data is out-of-date based upon the requested refresh interval
|
static QualityCode |
Bad_TrialExpired
The trial mode's timer has expired.
|
static QualityCode |
Bad_Unauthorized
An un-authorized request was made for data that requires authorization.
|
static QualityCode |
Bad_Unsupported
The operation is not supported by the target.
|
static QualityCode |
Error
An unexpected error occurred while retrieving or calculating this value
|
static QualityCode |
Error_Configuration
The source of this value is not configured correctly
|
static QualityCode |
Error_DatabaseQuery
A database query required for this value caused an error upon execution
|
static QualityCode |
Error_Exception
An exception was caught, and logged in the relevant system.
|
static QualityCode |
Error_ExpressionEval
The source expression was unable to be executed
|
static QualityCode |
Error_Formatting
Attempted formatting (numeric, date formatting) failed.
|
static QualityCode |
Error_InvalidPathSyntax
A path (tag path, property path, etc) was not able to be parsed because the syntax is invalid.
|
static QualityCode |
Error_IO
An input/output error occurred while attempting to retrieve or calculate this value
|
static QualityCode |
Error_ScriptEval
A script needed to create this value failed to execute
|
static QualityCode |
Error_TagExecution
The source tag could not be executed
|
static QualityCode |
Error_TimeoutExpired
An async operation failed due to a timeout.
|
static QualityCode |
Error_TypeConversion
The actual value was not able to be coerced into the configured data type for the source of this value
|
static QualityCode |
Good
General quality for good data
|
static QualityCode |
Good_Legacy
Good data that maps to the legacy encoding for "good" in the OPC spec, which had a value of 192
|
static QualityCode |
Good_Provisional
Good data that should not be considered valid long-term.
|
static QualityCode |
Good_WritePending
Special value used when an underlying data source is being written to
|
static QualityCode |
Uncertain
An unspecified degree of uncertainty exists in this value.
|
static QualityCode |
Uncertain_DataSubNormal
Insufficient good-quality sources required for the derivation of this value
|
static QualityCode |
Uncertain_EngineeringUnitsExceeded
Used to indicate that a value has gone beyond its configured engineering units.
|
static QualityCode |
Uncertain_IncompleteOperation
An async operation is currently pending and its result is unknown.
|
static QualityCode |
Uncertain_InitialValue
Used to indicate that a subscription has been made and a good value should be arriving shortly.
|
static QualityCode |
Uncertain_LastKnownValue
The current value is unavailable, this represents the last known good value.
|
Constructor and Description |
---|
QualityCode(int code) |
QualityCode(int code,
java.lang.String diagnosticMessage) |
QualityCode(QualityCode.Level level,
int userCode) |
QualityCode(QualityCode.Level level,
int userCode,
java.lang.String diagnosticMessage) |
QualityCode(QualityCode copy) |
QualityCode(QualityCode copy,
java.lang.String diagnosticMessage) |
Modifier and Type | Method and Description |
---|---|
QualityCode |
derive(java.lang.String diagnosticMessage)
Returns a QualityCode with the same underlying code, but the specified
diagnosticMessage . |
boolean |
equals(java.lang.Object obj) |
int |
getCode() |
static java.lang.String |
getCodeName(int code) |
static java.lang.String |
getCodeName(QualityCode code) |
static com.google.gson.JsonObject |
getCodesJson() |
java.lang.String |
getDiagnosticMessage() |
QualityCode.Level |
getLevel() |
static QualityCode.Level |
getLevel(int code) |
static QualityCode.Level |
getLevel(QualityCode code) |
java.lang.String |
getName() |
static QualityCode |
getQualityFor(int code) |
static QualityCode |
getQualityFor(java.lang.String name) |
boolean |
is(QualityCode other)
Helper function that compares the integer code of the given quality to this one.
|
boolean |
isBad() |
boolean |
isBadOrError() |
boolean |
isError() |
boolean |
isGood() |
boolean |
isNot(QualityCode other)
Helper function that compares the integer code of the given quality to this one.
|
boolean |
isNotGood() |
boolean |
isUncertain() |
java.lang.String |
toString() |
QualifiedValue |
toValue()
Returns this quality as the quality component of a qualified value.
|
static QualityCode[] |
values() |
static QualityCode |
worstOf(QualityCode a,
QualityCode b) |
static QualityCode |
worstOfAll(QualityCode... q) |
public static final QualityCode Good
public static final QualityCode Good_Provisional
public static final QualityCode Good_WritePending
public static final QualityCode Good_Legacy
public static final QualityCode Uncertain
public static final QualityCode Uncertain_LastKnownValue
public static final QualityCode Uncertain_InitialValue
public static final QualityCode Uncertain_DataSubNormal
public static final QualityCode Uncertain_EngineeringUnitsExceeded
public static final QualityCode Uncertain_IncompleteOperation
public static final QualityCode Bad
public static final QualityCode Bad_Unauthorized
public static final QualityCode Bad_AccessDenied
public static final QualityCode Bad_Disabled
public static final QualityCode Bad_Stale
public static final QualityCode Bad_TrialExpired
public static final QualityCode Bad_LicenseExceeded
public static final QualityCode Bad_NotFound
public static final QualityCode Bad_ReferenceNotFound
public static final QualityCode Bad_AggregateNotFound
public static final QualityCode Bad_NotConnected
public static final QualityCode Bad_GatewayCommOff
public static final QualityCode Bad_OutOfRange
public static final QualityCode Bad_DatabaseNotConnected
public static final QualityCode Bad_ReadOnly
public static final QualityCode Bad_Failure
public static final QualityCode Bad_Unsupported
public static final QualityCode Error
public static final QualityCode Error_Configuration
public static final QualityCode Error_ExpressionEval
public static final QualityCode Error_TagExecution
public static final QualityCode Error_TypeConversion
public static final QualityCode Error_DatabaseQuery
public static final QualityCode Error_IO
public static final QualityCode Error_TimeoutExpired
public static final QualityCode Error_Exception
public static final QualityCode Error_InvalidPathSyntax
public static final QualityCode Error_Formatting
public static final QualityCode Error_ScriptEval
public QualityCode(QualityCode.Level level, int userCode)
public QualityCode(QualityCode.Level level, int userCode, java.lang.String diagnosticMessage)
public QualityCode(QualityCode copy)
public QualityCode(QualityCode copy, java.lang.String diagnosticMessage)
public QualityCode(int code)
public QualityCode(int code, java.lang.String diagnosticMessage)
public int getCode()
@Nullable public java.lang.String getDiagnosticMessage()
public boolean isGood()
public boolean isUncertain()
public boolean isBad()
public boolean isError()
public boolean isNotGood()
public boolean isBadOrError()
public java.lang.String toString()
toString
in class java.lang.Object
public QualityCode.Level getLevel()
public static QualityCode.Level getLevel(int code)
public static QualityCode.Level getLevel(QualityCode code)
public static java.lang.String getCodeName(int code)
public static java.lang.String getCodeName(QualityCode code)
public static com.google.gson.JsonObject getCodesJson()
public static QualityCode worstOf(QualityCode a, QualityCode b)
public static QualityCode worstOfAll(QualityCode... q)
public QualityCode derive(java.lang.String diagnosticMessage)
diagnosticMessage
.diagnosticMessage
- the diagnostic message.diagnosticMessage
.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean is(QualityCode other)
public boolean isNot(QualityCode other)
public java.lang.String getName()
public static QualityCode getQualityFor(java.lang.String name)
public static QualityCode getQualityFor(int code)
public static QualityCode[] values()
public QualifiedValue toValue()