State object

This is the class holding the state of a tag acquired from the controlled environment.

State object methods

Methods to be used with state objects.

getQualityBits

number getQualityBits()

Returns an integer - a combination of bits indicating tag value quality.

var state = new State();

var value = project.getTag("Tag1", state, 0);

var qbits = state.getQualityBits();

(Available on web pages)

getTimestamp

number getTimestamp()

Returns time the value was sampled.

Return value

A number containing the timestamp (for example 1315570524492).

Note: Date is a native JavaScript data type.

var state = new State();

var value = project.getTag("Tag1", state, 0);

var ts = state.getTimestamp();

isQualityGood

boolean isQualityGood()

Returns whether the value contained in this state object is reliable.

Return value

A Boolean true if quality is good, false otherwise.

var state = new State();

var value = project.getTag("Tag1", state, 0);

if (state.isQualityGood()) {

// do something…

}

(Available on web pages)