new Status()
Represents a baja:Status in BajaScript.
Status provides a bit mask for various standardized
status flags in the Baja control architecture. Plus
it provides for arbitrary extensions using BFacets.
When creating a Simple, always use the make() method instead of
creating a new Object.
Extends
Members
-
<static> ACTIVE_LEVEL :String
-
String used in a
Facetsfor identifying the active priority level of a
writable point.Type:
-
<static> ALARM :Number
-
Bit for alarm.
Type:
- Number
-
<static> alarm :baja.Status
-
Statusfor alarm (null facets).Type:
-
<static> DEFAULT :baja.Status
-
Default
Statusinstance.Type:
-
<static> DISABLED :Number
-
Bit for disabled.
Type:
- Number
-
<static> disabled :baja.Status
-
Statusfor disabled (null facets).Type:
-
<static> DOWN :Number
-
Bit for down.
Type:
- Number
-
<static> down :baja.Status
-
Statusfor down (null facets).Type:
-
<static> FAULT :Number
-
Bit for fault.
Type:
- Number
-
<static> fault :baja.Status
-
Statusfor fault (null facets).Type:
-
<static> NULL :Number
-
Bit for null.
Type:
- Number
-
<static> nullStatus :baja.Status
-
Statusfor null status (null facets).Type:
-
<static> ok :baja.Status
-
Statusfor ok (null facets).Type:
-
<static> OVERRIDDEN :Number
-
Bit for overridden.
Type:
- Number
-
<static> overridden :baja.Status
-
Statusfor overridden (null facets).Type:
-
<static> STALE :Number
-
Bit for stale.
Type:
- Number
-
<static> stale :baja.Status
-
Statusfor stale (null facets).Type:
-
<static> UNACKED_ALARM :Number
-
Bit for unacked alarm.
Type:
- Number
-
<static> unackedAlarm :baja.Status
-
Statusfor unacked alarm (null facets).Type:
Methods
-
<static> getStatusFromIStatus()
-
Return the status from a
BIStatus.Returns:
resolved status value
- Type
- baja.Status
-
<static> make(obj)
-
Make a
Status.Parameters:
Name Type Description objObject | Number the Object Literal that specifies the method's arguments or Status bits.
Properties
Name Type Argument Description bitsNumber the Status bits.
facetsbaja.Facets <optional>
the facets for the Status.
origbaja.Status <optional>
if defined, obj.state must also be defined. This is used to create
a new Status with one of it's bit states changed (see example above).stateBoolean <optional>
the state of the bit to change (used in conjunction with obj.orig).
Returns:
the status.
- Type
- baja.Status
Example
//The bits (Number) or (for more arguments) an Object Literal can be //used to specify the method's arguments. var st1 = baja.Status.make(baja.Status.DOWN | baja.Status.FAULT); // ... or for more arguments... var st2 = baja.Status.make({ bits: baja.Status.DOWN, facets: facets }); //The make() method can also be used to create a new status with its //state changed... var newStatus = baja.Status.make({ orig: oldStatus, bits: baja.Status.OVERRIDDEN, state: true }}; -
decodeAsync(str [, batch])
-
The string encoding of certain Simples may include Type information, or
other data that may be require asynchronous operations to decode. BOX is
designed to handle these situations when decoding data from the station,
but when user code needs to decode string-encoded Simples directly, prefer
this method as it gives the individual Simple a chance to import Types,
etc. to ensure that the decoded Simple is fully correct.The default implementation just returns
decodeFromStringdirectly.Parameters:
Name Type Argument Description strstring batchbaja.comm.Batch <optional>
optional batch to use
- Inherited From:
Returns:
may return the Simple instance
directly, or a Promise resolving to same - so wrap inPromise.resolve()
if unsure.- Type
- baja.Simple | Promise.<baja.Simple>
-
decodeFromString(str)
-
Decode a
Statusfrom aString.Parameters:
Name Type Description strString - Overrides:
Returns:
- Type
- baja.Status
-
encodeToString()
-
Encode the
Statusto aString.- Overrides:
Returns:
- Type
- String
-
equals(obj)
-
Equality test.
Parameters:
Name Type Description obj- Overrides:
Returns:
- Type
- Boolean
-
equivalent(obj)
-
Equivalence test.
equivalent()is used to compare if two Objects have equivalent
state, but might not want to return true for equals since it
it has implied semantics for many operations. The default
implementation returns the result of baja.Object#equals.Parameters:
Name Type Description obj- Inherited From:
Returns:
- Type
- Boolean
-
flagsToString()
-
Returns a string of just the flags which are set or
returns ok if none are set.Returns:
- Type
- String
-
get(name [, def])
-
Return a value from the status facets.
Parameters:
Name Type Argument Description nameString the name of the value to get from the status facets.
def<optional>
if defined, this value is returned if the name can't be found in
the status facets.Returns:
the value from the status facets (null if def is undefined and name can't be found).
-
getAgents( [is] [, batch])
-
Returns a promise that resolves to the agent list for this Object.
Parameters:
Name Type Argument Description isArray.<String> <optional>
An optional array of filters to add to the
agent query.batchbaja.comm.Batch <optional>
An optional object used to batch network
calls together.- Inherited From:
- See:
Returns:
A promise that will resolve with the Agent Info.
- Type
- Promise
-
getBit(ordinal)
-
Parameters:
Name Type Description ordinalnumber - Since:
-
- Niagara 4.8
Returns:
true if this ordinal is set
- Type
- boolean
-
getBits()
-
Return the
Statusbits.Returns:
status bits.
- Type
- Number
-
getFacets()
-
Return the facets for the
Status.Returns:
status facets
- Type
- baja.Facets
-
getIcon()
-
Return the Object's Icon.
- Inherited From:
Returns:
- Type
- baja.Icon
-
getOrdinals()
-
- Since:
-
- Niagara 4.8
Returns:
all known Status ordinals
- Type
- Array.<number>
-
getStatus()
-
Return the status (itself).
Returns:
the status (itself).
- Type
- baja.Status
-
getType()
-
Get the type of this instance.
- Inherited From:
Returns:
- Type
- Type
-
getTypeDisplayName( [cx])
-
Gets the friendly type display name for this object.
Parameters:
Name Type Argument Description cxObject <optional>
a context to be passed down to Type
- Since:
-
- Niagara 4.10
- Inherited From:
- See:
-
- baja.Type#getDisplayName
Returns:
If no context is provided, the type
display name is returned synchronously as a string. If context provided,
the type display name is resolved via a promise as a string.- Type
- Promise.<string> | string
-
isAlarm()
-
Return true if the
Statusis in alarm.Returns:
- Type
- Boolean
-
isDisabled()
-
Return true if the
Statusis disabled.Returns:
- Type
- Boolean
-
isDown()
-
Return true if the
Statusis down.Returns:
- Type
- Boolean
-
isFault()
-
Return true if the
Statusis in fault.Returns:
- Type
- Boolean
-
isNull()
-
Return true if the
Statusis null.Returns:
- Type
- Boolean
-
isOk()
-
Return true if the
Statusis ok.Returns:
- Type
- Boolean
-
isOverridden()
-
Return true if the
Statusis overridden.Returns:
- Type
- Boolean
-
isStale()
-
Return true if the
Statusis stale.Returns:
- Type
- Boolean
-
isUnackedAlarm()
-
Return true if the
Statusis unacked alarm.Returns:
- Type
- Boolean
-
isValid()
-
Return true if the
Statusis not disabled, fault, down
stale or null.Returns:
true if valid.
- Type
- Boolean
-
make(obj)
-
Make a
Status.Parameters:
Name Type Description objObject | Number the Object Literal that specifies the method's arguments or Status bits.
Properties
Name Type Argument Description bitsNumber the Status bits.
facetsbaja.Facets <optional>
the facets for the Status.
origbaja.Status <optional>
if defined, obj.state must also be defined. This is used to create
a new Status with one of it's bit states changed (see example above).stateBoolean <optional>
the state of the bit to change (used in conjunction with obj.orig).
- Overrides:
Returns:
the status.
- Type
- baja.Status
Example
//The bits (Number) or (for more arguments) an Object Literal can be //used to specify the method's arguments. var st1 = baja.Status.make(baja.Status.DOWN | baja.Status.FAULT); // ... or for more arguments... var st2 = baja.$("baja:Status").make({ bits: baja.Status.DOWN, facets: facets }); //The make method can also be used to create a new status with its //state changed... var newStatus = baja.$("baja:Status").make({ orig: oldStatus, bits: baja.Status.OVERRIDDEN, state: true }}; -
newCopy( [exact])
-
Every value may be cloned using the
newCopymethod.Please note that
Simples are immutable so they don't
allocate a new instance.Parameters:
Name Type Argument Description exactBoolean <optional>
true if an exact copy of the value should be
made (only valid in the Component architecture).- Inherited From:
- See:
Returns:
a copy of the value (or the same instance if the value is a
Simple). -
toEnumSet()
-
- Since:
-
- Niagara 4.8
Returns:
an
EnumSetrepresenting which bits are selected
out of the available bits for aStatus- Type
- baja.EnumSet
-
toString(obj)
-
Returns the string representation of the 'Status'.
This method is invoked synchronously. The string result will be returned
directly from this function.Notes on lexicons:
- A lexicon will be used if it is passed in.
- If no lexicon is passed in, the baja lexicon will be used if it has been
cached locally. - If the baja lexicon has not been cached, strings units will be
represented by their internal tag names (which are in English).
Parameters:
Name Type Description objObject the Object Literal for the method's arguments.
Properties
Name Type Argument Description lex<optional>
the 'baja' lexicon
- Overrides:
Returns:
-
valueOf()
-
- Inherited From:
Returns:
the string encoding of the Simple, by default
- Type
- String