UATwoStateVariable Class
Constructor
UATwoStateVariable
()
Item Index
Methods
- _clone
- _clone_children_references
- addReference
- addTwoStateVariable
- bindExtensionObject
- bindVariable
- browseNode
- browseNodeByTargetName
- dispose
- findReference
- findReferences
- full_name
- getAggregates
- getComponentByName
- getComponents
- getEventSourceOfs
- getEventSources
- getFalseSubStates
- getFolderElements
- getMethodById
- getMethodByName
- getMethods
- getNotifiers
- getProperties
- getPropertyByName
- getTrueSubStates
- getValue
- getValueAsString
- initialize
- isArgumentValid
- isReadable
- isUserReadable
- isUserWritable
- isValueInRange note: this method is overridden in address-space-data-access
- isWritable
- normalize_referenceTypeId
- propagate_back_references
- readAttribute
- readValue
- readValueAsync
- removeReference
- resolveNodeId
- setValue
- setValueFromSource
- touchValue touch the source timestamp of a Variable and cascade up the change to the parent variable if any.
- unpropagate_back_references
- verifyArguments_ArgumentList
- writeAttribute
- writeEnumValue
- writeValue
Properties
Methods
_clone
-
Constructor
-
options
-
extraInfo
-
optionalFilter
Parameters:
-
Constructor
Function -
options
Object -
extraInfo
Object -
optionalFilter
Object
Returns:
_clone_children_references
-
newParent
-
[optionalFilter = null]
-
[extraInfo]
clone properties and methods
Parameters:
-
newParent
Objectthe new parent object to which references of type HasChild will be attached
-
[optionalFilter = null]
Function optionala filter
-
[extraInfo]
Object optional
Returns:
addReference
-
reference
Parameters:
-
reference
Object-
referenceType
String -
[isForward= true]
Boolean optional -
nodeId
Node | NodeId | String
-
Example:
view.addReference({ referenceType: "Organizes", nodeId: myDevice });
or
myDevice1.addReference({ referenceType: "OrganizedBy", nodeId: view });
addTwoStateVariable
-
options
Parameters:
-
options
Object-
browseName
String -
[description]
String optional -
[modellingRule]
String optional -
[minimumSamplingInterval=0]
Number optional -
componentOf
Node | NodeId -
propertyOf
Node | NodeId -
trueState
String -
falseState
String -
[isTrueSubStateOf]
NodeId optional -
[isFalseSubStateOf]
NodeId optional -
[modellingRule]
optional
-
Returns:
Optionals can be EffectiveDisplayName, TransitionTime, EffectiveTransitionTime
bindExtensionObject
-
[optionalExtensionObject=null]
Parameters:
-
[optionalExtensionObject=null]
ExtensionObject optional
Returns:
bindVariable
-
options
-
[overwrite = false]
Parameters:
-
options
Object-
[dataType=null]
DataType optionalthe nodeId of the dataType
-
[accessLevel]
Number optionalAccessLevelFlagItem
-
[userAccessLevel]
Number optionalAccessLevelFlagItem
-
[set]
Function optionalthe variable setter function
-
[get]
Function optionalthe variable getter function. the function must return a Variant or a status code
-
[timestamped_get]
Function optionalthe getter function. this function must return a object with the following
-
[historyRead]
Function optionalproperties:
- value: a Variant or a status code
- sourceTimestamp
- sourcePicoseconds
-
[timestamped_set]
Function optional -
[refreshFunc]
Function optionalthe variable asynchronous getter function.
-
-
[overwrite = false]
Boolean optionalset overwrite to true to overwrite existing binding
Returns:
Example:
...
var options = {
get : function() {
return new Variant({...});
},
set : function(variant) {
// store the variant somewhere
return StatusCodes.Good;
}
};
...
engine.bindVariable(nodeId,options):
...
Variation 2:
This variation can be used when the user wants to specify a specific '''sourceTimestamp''' associated with the current value of the UAVariable.
The provided timestamped_get
function should return an object with three properties:
- value: containing the variant value or a error StatusCode,
- sourceTimestamp
- sourcePicoseconds
...
var myDataValue = new DataValue({
value: {dataType: DataType.Double , value: 10.0},
sourceTimestamp : new Date(),
sourcePicoseconds: 0
});
...
var options = {
timestamped_get : function() { return myDataValue; }
};
...
engine.bindVariable(nodeId,options):
...
// record a new value
myDataValue.value.value = 5.0;
myDataValue.sourceTimestamp = new Date();
...
Variation 3:
This variation can be used when the value associated with the variables requires a asynchronous function call to be
extracted. In this case, the user should provide an async method refreshFunc
.
The refreshFunc
shall do whatever is necessary to fetch the most up to date version of the variable value, and
call the callback
function when the data is ready.
The callback
function follow the standard callback function signature:
- the first argument shall be null or Error, depending of the outcome of the fetch operation,
- the second argument shall be a DataValue with the new UAVariable Value, a StatusCode, and time stamps.
Optionally, it is possible to pass a sourceTimestamp and a sourcePicoseconds value as a third and fourth arguments of the callback. When sourceTimestamp and sourcePicoseconds are missing, the system will set their default value to the current time..
...
var options = {
refreshFunc : function(callback) {
... do_some_async_stuff_to_get_the_new_variable_value
var dataValue = new DataValue({
value: new Variant({...}),
statusCode: StatusCodes.Good,
sourceTimestamp: new Date()
});
callback(null,dataValue);
}
};
...
variable.bindVariable(nodeId,options):
...
Providing write access to the underlying value
Variation1 - provide a simple synchronous set function
Notes
to do : explain return StatusCodes.GoodCompletesAsynchronously;
browseNode
-
browseDescription
-
session
browse the node to extract information requested in browseDescription
Parameters:
-
browseDescription
BrowseDescription-
referenceTypeId
NodeId -
browseDirection
BrowseDirection -
nodeClassMask
NodeClassMask -
resultMask
UInt32
-
-
session
ServerSession
Returns:
browseNodeByTargetName
-
relativePathElement
Parameters:
-
relativePathElement
RelativePathElement-
targetName
QualifiedName-
name
String -
namespaceIndex
UInt32
-
-
referenceTypeId
NodeId -
isInverse
Boolean -
includeSubtypes
Boolean
-
Returns:
dispose
()
the dispose method should be called when the node is no longer used, to release back pointer to the address space and clear caches.
findReference
-
strReference
-
[isForward]
-
[optionalSymbolicName]
Parameters:
-
strReference
Stringthe referenceType as a string.
-
[isForward]
Boolean | Null optional -
[optionalSymbolicName]
String optional
Returns:
findReferences
-
referenceType
-
[isForward=true]
Parameters:
-
referenceType
String | NodeId | ReferenceTypethe referenceType as a string.
-
[isForward=true]
Boolean optional
Returns:
full_name
()
String
Returns:
the full path name of the node
getAggregates
()
BaseNode[]
Returns:
return an array with the Aggregates of this object.
getComponentByName
-
browseName
-
[namespaceIndex=null]
retrieve a component by name
Parameters:
-
browseName
Object -
[namespaceIndex=null]
Object optional
Returns:
getComponents
()
BaseNode[]
Returns:
return an array with the components of this object.
getEventSourceOfs
()
BaseNode[]
Returns:
return a array of the objects for which this node is an EventSource
getEventSources
()
BaseNode[]
Returns:
return a array with the event source of this object.
getFalseSubStates
()
BaseNode[]
Returns:
return an array with the SubStates of this object.
getFolderElements
()
Arrayreturns the list of nodes that this folder object organizes
Returns:
getMethodById
-
nodeId
Parameters:
-
nodeId
Object
Returns:
getMethodByName
-
browseName
-
[namespaceIndex=null]
Parameters:
-
browseName
Object -
[namespaceIndex=null]
Object optional
Returns:
getMethods
()
Arrayreturns the list of methods that this object provides
Returns:
returns an array wit"h Method objects.
Note: internally, methods are special types of components
getPropertyByName
-
browseName
-
[namespaceIndex=null]
retrieve a property by name
Parameters:
-
browseName
Object -
[namespaceIndex=null]
Object optional
Returns:
getTrueSubStates
()
BaseNode[]
Returns:
return an array with the SubStates of this object.
getValue
()
Boolean
Returns:
getValueAsString
()
String
Returns:
initialize
-
options
Parameters:
-
options
Object
isArgumentValid
-
addressSpace
-
argDefinition
-
arg
Parameters:
-
addressSpace
AddressSpace -
argDefinition
Argument -
arg
Variant
Returns:
isReadable
-
context
Parameters:
-
context
SesionContext
Returns:
isUserReadable
-
context
Parameters:
-
context
SesionContext
Returns:
normalize_referenceTypeId
-
addressSpace
-
referenceTypeId
Parameters:
-
addressSpace
AddressSpace -
referenceTypeId
String | NodeId | Null: the referenceType either as a string or a nodeId
Returns:
propagate_back_references
()
this methods propagates the forward references to the pointed node by inserting backward references to the counter part node
readAttribute
-
context
-
attributeId
-
indexRange
-
dataEncoding
Parameters:
-
context
SessionContext -
attributeId
AttributeIdsthe attributeId to read -
indexRange
NumericRange | null -
dataEncoding
String
Returns:
readValue
-
[context]
-
[indexRange]
-
[dataEncoding]
Parameters:
-
[context]
SessionContext optional -
[indexRange]
NumericRange | Null optional -
[dataEncoding]
String optional
Returns:
readValueAsync
-
context
-
callback
Parameters:
-
context
SessionContext -
callback
Function-
err
Null | Error -
dataValue
DataValue | Nullthe value read
-
removeReference
-
reference
Parameters:
-
reference
Object
Returns:
void
setValue
-
boolValue
Parameters:
-
boolValue
Boolean
setValueFromSource
-
variant
-
[statusCode = StatusCodes.Good]
-
[sourceTimestamp= Now]
Parameters:
-
variant
Variant -
[statusCode = StatusCodes.Good]
StatusCode optional -
[sourceTimestamp= Now]
Object optional
touchValue
touch the source timestamp of a Variable and cascade up the change
to the parent variable if any.
-
[optionalNow=null]
Parameters:
-
[optionalNow=null]
Object optional-
timestamp
Date -
picoseconds
Number
-
unpropagate_back_references
()
private
Undo the effect of propagate_back_references
verifyArguments_ArgumentList
-
addressSpace
-
methodInputArguments
-
inputArguments
Parameters:
-
addressSpace
AddressSpace -
methodInputArguments
Argument[] -
inputArguments
Variant[]
Returns:
statusCode,inputArgumentResults
writeAttribute
-
context
-
writeValue
-
callback
Parameters:
-
context
SessionContext -
writeValue
WriteValue -
callback
Function-
err
Error | Null -
statusCode
StatusCode
-
writeEnumValue
-
value
Parameters:
-
value
String | Number
writeValue
-
context
-
dataValue
-
[indexRange]
-
callback
Parameters:
-
context
SessionContext -
dataValue
DataValue -
[indexRange]
NumericRange optional -
callback
Function-
err
Error | Null -
statusCode
StatusCode
-
Properties
accessLevel
number
The AccessLevel Attribute is used to indicate how the Value of a Variable can be accessed
(read/write) and if it contains current and/or historic data. The AccessLevel does not take
any user access rights into account, i.e. although the Variable is writable this may be
restricted to a certain user / user group. The AccessLevelType is defined in 8.57.
arrayDimensions
number UInt32
The Attribute is intended to describe the capability of the Variable, not the current size.
The number of elements shall be equal to the value of the ValueRank Attribute. Shall be null
if ValueRank ? 0.
A value of 0 for an individual dimension indicates that the dimension has a variable length.
For example, if a Variable is defined by the following C array:
Int32 myArray[346];
then this Variables DataType would point to an Int32, the Variable�s ValueRank has the
value 1 and the ArrayDimensions is an array with one entry having the value 346.
Note that the maximum length of an array transferred on the wire is 2147483647 (max Int32)
and a multidimentional array is encoded as a one dimensional array.
hasMethods
Boolean
returns true if the object has some opcua methods