UATwoStateVariable Class
Constructor
UATwoStateVariable
()
Item Index
Methods
- _clone
- _clone_children_references
- addReference
- addTwoStateVariable
- 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
- normalize_referenceTypeId
- propagate_back_references
- readAttribute
- readValue
- readValueAsync
- resolveNodeId
- setValue
- setValueFromSource
- unpropagate_back_references
- writeAttribute
- writeEnumValue
- writeValue
Properties
Methods
_clone
-
Constructor -
options -
extraInfo
Parameters:
-
ConstructorFunction -
optionsObject -
extraInfoObject
Returns:
_clone_children_references
-
newParent -
[optionalFilter = null] -
[extraInfo]
clone properties and methods
Parameters:
-
newParentObjectthe new parent object to which references of type HasChild will be attached
-
[optionalFilter = null]Function optionala filter
-
[extraInfo]Object optional
Returns:
addReference
-
reference
Parameters:
-
referenceObject-
referenceTypeString -
[isForward= true]Boolean optional -
nodeIdNode | NodeId | String
-
Example:
view.addReference({ referenceType: "Organizes", nodeId: myDevice });
or
myDevice1.addReference({ referenceType: "OrganizedBy", nodeId: view });
addTwoStateVariable
-
options
Parameters:
-
optionsObject-
browseNameString -
[description]String optional -
[modellingRule]String optional -
[minimumSamplingInterval=0]Number optional -
componentOfNode | NodeId -
propertyOfNode | NodeId -
trueStateString -
falseStateString -
[isTrueSubStateOf]NodeId optional -
[isFalseSubStateOf]NodeId optional -
[modellingRule]optional
-
Returns:
Optionals can be EffectiveDisplayName, TransitionTime, EffectiveTransitionTime
bindVariable
-
options -
[overwrite = false]
Parameters:
-
optionsObject-
[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:
-
browseDescriptionBrowseDescription-
referenceTypeIdNodeId -
browseDirectionBrowseDirection -
nodeClassMaskNodeClassMask -
resultMaskUInt32
-
-
sessionServerSession
Returns:
browseNodeByTargetName
-
relativePathElement
Parameters:
-
relativePathElementRelativePathElement-
targetNameQualifiedName-
nameString -
namespaceIndexUInt32
-
-
referenceTypeIdNodeId -
isInverseBoolean -
includeSubtypesBoolean
-
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:
-
strReferenceStringthe referenceType as a string.
-
[isForward]Boolean | Null optional -
[optionalSymbolicName]String optional
Returns:
findReferences
-
strReference -
[isForward=true]
Parameters:
-
strReferenceStringthe 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
retrieve a component by name
Parameters:
-
browseNameObject
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:
-
nodeIdObject
Returns:
getMethodByName
-
browseName
Parameters:
-
browseNameObject
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
retrieve a property by name
Parameters:
-
browseNameObject
Returns:
getTrueSubStates
()
BaseNode[]
Returns:
return an array with the SubStates of this object.
getValue
()
Boolean
Returns:
getValueAsString
()
String
Returns:
initialize
-
options
Parameters:
-
optionsObject
normalize_referenceTypeId
-
addressSpace -
referenceTypeId
Parameters:
-
addressSpaceAddressSpace -
referenceTypeIdString | 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:
-
contextSessionContext -
attributeIdAttributeIdsthe attributeId to read -
indexRangeNumericRange | | null -
dataEncodingString
Returns:
readValue
-
[context] -
[indexRange] -
[dataEncoding]
Parameters:
-
[context]SessionContext optional -
[indexRange]NumericRange | Null optional -
[dataEncoding]String optional
Returns:
readValueAsync
-
context -
callback
Parameters:
-
contextSessionContext -
callbackFunction-
errNull | Error -
dataValueDataValue | Nullthe value read
-
setValue
-
boolValue
Parameters:
-
boolValueBoolean
setValueFromSource
-
variant -
[statusCode ] -
[sourceTimestamp= Now]
Parameters:
-
variantVariant -
[statusCode ]StatusCode optional -
[sourceTimestamp= Now]Object optional
unpropagate_back_references
()
private
Undo the effect of propagate_back_references
writeAttribute
-
context -
writeValue -
callback
Parameters:
-
contextSessionContext -
writeValueWriteValue -
callbackFunction-
errError | Null -
statusCodeStatusCode
-
writeEnumValue
-
value
Parameters:
-
valueString | Number
writeValue
-
context -
dataValue -
[indexRange] -
callback
Parameters:
-
contextSessionContext -
dataValueDataValue -
[indexRange]NumericRange optional -
callbackFunction-
errError | Null -
statusCodeStatusCode
-
Properties
accessLevel
Number
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
The NodeOPCUA API