AddressSpace Class
AddressSpace is a collection of UA nodes.
var addressSpace = new AddressSpace();
Constructor
AddressSpace
-
conditionTypeId -
options -
data
Parameters:
-
conditionTypeIdObject -
optionsObject -
dataObject
Returns:
Item Index
Methods
- _addVariable
- _coerce_parent convert a 'string' , NodeId or Object into a valid and existing object
- _coerceNode
- _createNode
- _isFolder
- _process_modelling_rule
- add_alias
- addEnumerationType
- addFolder
- addMethod
- addMultiStateValueDiscrete
- addObjectType
- addReferenceType
- addTransition
- addTwoStateDiscrete
- addVariable
- addVariableType
- addYArrayItem
- browsePath
- browseSingleNode
- constructExtensionObject
- createDataType
- createNode
- deleteNode
- dispose
- extractRootViews
- findCorrespondingBasicDataType
- findDataType
- findNode
- findObjectType
- findReferenceType
- findReferenceTypeFromInverseName
- findTransitionNode
- findVariableType
- getCurrentState
- getStateByName
- getStates
- historyRead
- installHistoricalDataNode
- inverseReferenceType
- isNodeIdString
- isValidTransition
- make_back_references
- normalizeReferenceType
- registerShutdownTask
- resolveNodeId
- setState
Properties
Methods
_addVariable
()
private
_coerce_parent
convert a 'string' , NodeId or Object into a valid and existing object
-
addressSpace -
value -
coerceFunc
Parameters:
-
addressSpaceAddressSpace -
valueObject -
coerceFuncFunction
_coerceNode
-
node
Parameters:
-
nodeObject
Returns:
_createNode
-
options
Parameters:
-
optionsObject-
nodeIdNodeId -
nodeClassNodeClass -
browseNameString | QualifiedNamethe node browseName the browseName can be either a string : "Hello" a string with a namespace : "1:Hello" a QualifiedName : new QualifiedName({name:"Hello", namespaceIndex:1});
-
Returns:
_isFolder
-
addressSpace -
folder
return true if nodeId is a Folder
Parameters:
-
addressSpaceObject -
folderObject
Returns:
_process_modelling_rule
-
references -
modellingRule
Parameters:
-
referencesArraythe array of references
-
modellingRuleReferencethe modellling Rule reference.
addEnumerationType
-
options
Parameters:
-
optionsObject-
browseNameString -
enumerationArray -
enumeration[].displayNameString | LocalizedText -
enumeration[].valueNumber -
enumeration[].descriptionString | LocalizedText | Null
-
addFolder
-
parentFolder -
options
Parameters:
-
parentFolderObject -
optionsString | Object-
browseNameStringthe name of the folder
-
[nodeId]NodeId optional. An optional nodeId for this object
-
Returns:
addMethod
-
parentObject -
options
Parameters:
-
parentObjectObject -
optionsObject-
[nodeId=null]NodeId optionalthe object nodeid.
-
[browseName=""]String optionalthe object browse name.
-
[description=""]String optionalthe object description.
-
inputArgumentsArray -
outputArgumentsArray
-
Returns:
addMultiStateValueDiscrete
-
options -
[options.value
Parameters:
-
optionsObject-
browseNameString -
[nodeId]NodeId optional -
enumValuesEnumValueType[] | Key,Value}
-
-
[options.valueUInt32= 0 }
Returns:
Example:
addressSpace.addMultiStateValueDiscrete({
componentOf:parentObj,
browseName: "myVar",
enumValues: {
"Red": 0xFF0000,
"Green": 0x00FF00,
"Blue": 0x0000FF
}
});
addMultiStateValueDiscrete(parentObj,{
browseName: "myVar",
enumValues: [
{
value: 0xFF0000,
displayName: "Red",
description: " The color Red"
},
{
value: 0x00FF000,
displayName: "Green",
description: " The color Green"
},
{
value: 0x0000FF,
displayName: "Blue",
description: " The color Blue"
}
]
});
addObjectType
-
options
add a new Object type to the address space
Parameters:
-
optionsObject-
browseNameStringthe object type name
-
[subtypeOf="BaseObjectType"]String | NodeId | BaseNode optionalthe base class
-
[nodeId]String | NodeId optionalan optional nodeId for this objectType, if not provided a new nodeId will be created
-
[isAbstract= false]Boolean optional -
[eventNotifier= 0]Integer optional -
[postInstantiateFunc= null]Function optional
-
addReferenceType
-
options
Parameters:
-
optionsObject-
isAbstract -
browseName -
inverseName
-
addTransition
-
component -
fromState -
toState -
transitionNumber
Parameters:
-
componentUAObject -
fromStateStateType | InitialStateType -
toStateStateType | InitialStateType -
transitionNumberNumber
Returns:
TransitionType
addTwoStateDiscrete
-
options -
[options.value -
[options.trueState -
[options.falseState
Parameters:
-
optionsObject-
browseNameString -
[nodeId]NodeId optional
-
-
[options.valueBoolean}
-
[options.trueStateString= "ON" }
-
[options.falseStateString= "OFF" }
Returns:
addVariable
-
options
add a variable as a component of the parent node
Parameters:
-
optionsObject-
browseNameStringthe variable name
-
dataTypeStringthe variable datatype ( "Double", "UInt8" etc...)
-
[typeDefinition="BaseDataVariableType"]optional -
[modellingRule=null]optionalthe Modelling rule : "Optional" , "Mandatory"
-
[valueRank= -1]Int optionalthe valueRank
-
[arrayDimensions]Null | Arrayoptional
-
Returns:
addVariableType
-
options
add a new Variable type to the address space
Parameters:
-
optionsObject-
browseNameStringthe object type name
-
[subtypeOf="BaseVariableType"]String | NodeId | BaseNode optionalthe base class
-
[nodeId]String | NodeId optionalan optional nodeId for this objectType, if not provided a new nodeId will be created
-
[isAbstract= false]Boolean optional -
[eventNotifier= 0]Integer optional -
dataTypeString | NodeIdthe variable DataType
-
[valueRank= -1]optional -
[arrayDimensions= null]optional{ Array
>
-
addYArrayItem
-
options
Parameters:
-
optionsObject-
componentOfNodeId -
browseNameString -
titleString -
[instrumentRange]optional-
[low]Double optional -
[high]Double optional
-
-
engineeringUnitsRange.lowDouble -
engineeringUnitsRange.highDouble -
engineeringUnitsString -
[nodeId]NodeId optional -
accessLevel -
userAccessLevel -
titleString -
axisScaleTypeAxisScaleEnumeration -
xAxisDefinitionAxisInformation-
engineeringUnitsEURange -
range -
range.low -
range.high -
titleLocalizedText -
axisScaleTypeAxisScaleEnumeration -
axisStepsArray=
-
-
value
-
browsePath
-
browsePath
browse some path.
Parameters:
-
browsePathBrowsePath
Returns:
This service can be used translates one or more browse paths into NodeIds. A browse path is constructed of a starting Node and a RelativePath. The specified starting Node identifies the Node from which the RelativePath is based. The RelativePath contains a sequence of ReferenceTypes and BrowseNames.
| StatusCode | |
|---|---|
| BadNodeIdUnknown | |
| BadNodeIdInvalid | |
| BadNothingToDo | - the relative path contains an empty list ) |
| BadBrowseNameInvalid | - target name is missing in relative path |
| UncertainReferenceOutOfServer | - The path element has targets which are in another server. |
| BadTooManyMatches | |
| BadQueryTooComplex | |
| BadNoMatch |
browseSingleNode
-
nodeId -
browseDescription -
[session]
Parameters:
-
nodeIdNodeId | String: the nodeid of the element to browse
-
browseDescriptionObject-
browseDirectionBrowseDirection:
-
referenceTypeIdString | NodeId
-
-
[session]ServerSession optional
Returns:
constructExtensionObject
-
dataType -
[options =null]
Parameters:
-
dataTypeUADataType -
[options =null]Object optional
Returns:
Example:
// example 1
var extObj = addressSpace.constructExtensionObject("BuildInfo",{ productName: "PRODUCTNAME"});
// example 2
serverStatusDataType.should.be.instanceOf(UADataType);
serverStatusDataType.browseName.toString().should.eql("ServerStatusDataType");
var serverStatus = addressSpace.constructExtensionObject(serverStatusDataType);
serverStatus.constructor.name.should.eql("ServerStatus");
createDataType
-
options
Parameters:
-
optionsObject-
isAbstract -
browseNameBrowseName -
superTypeNodeId -
[nodeId]optional -
[displayName]optional -
[description]optional
-
createNode
-
options
Parameters:
-
optionsObject-
nodeClass -
[nodeVersion= "0"]String optionalinstall nodeVersion
-
deleteNode
-
nodeOrNodeId
remove the specified Node from the address space
Parameters:
-
nodeOrNodeIdObject
dispose
()
cleanup all resources maintained by this addressSpace.
extractRootViews
-
node
walk up the hierarchy of objects until a view is found objects may belong to multiples views. Note: this method doesn't return the main view => Server object.
Parameters:
-
nodeBaseNode
Returns:
findCorrespondingBasicDataType
-
dataTypeNode
Parameters:
-
dataTypeNodeObject
Example:
var dataType = addressSpace.findDataType("ns=0;i=12");
addressSpace.findCorrespondingBasicDataType(dataType).should.eql(DataType.String);
var dataType = addressSpace.findDataType("ServerStatus"); // ServerStatus
addressSpace.findCorrespondingBasicDataType(dataType).should.eql(DataType.ExtensionObject);
findDataType
-
dataType -
[namespace=0]
Find the DataType node from a NodeId or a browseName
Parameters:
-
dataTypeString | NodeId -
[namespace=0]Number optionalan optional namespace index
Returns:
Example:
var dataDouble = addressSpace.findDataType("Double");
var dataDouble = addressSpace.findDataType(resolveNodeId("ns=0;i=3"));
findNode
-
nodeId
find an node by node Id
Parameters:
-
nodeIdNodeId | Stringa nodeId or a string coerce-able to nodeID, representing the object to find.
Returns:
findObjectType
-
objectType -
[namespace=0]
Parameters:
-
objectTypeString | NodeId -
[namespace=0]Number optionalan optional namespace index
Returns:
Example:
var objectType = addressSpace.findObjectType("ns=0;i=58");
objectType.browseName.toString().should.eql("BaseObjectType");
var objectType = addressSpace.findObjectType("BaseObjectType");
objectType.browseName.toString().should.eql("BaseObjectType");
var objectType = addressSpace.findObjectType(resolveNodeId("ns=0;i=58"));
objectType.browseName.toString().should.eql("BaseObjectType");
findReferenceType
-
refType -
[namespace=0]
Parameters:
-
refTypeString | NodeId -
[namespace=0]Number optionalan optional namespace index
Returns:
refType could be a string representing a nodeid : e.g. 'i=9004' or ns=1;i=6030 a string representing a browse name : e.g 'HasTypeDefinition' in this case it should be in the alias list
findReferenceTypeFromInverseName
-
inverseName
find a ReferenceType by its inverse name.
Parameters:
-
inverseNameStringthe inverse name of the ReferenceType to find
Returns:
findVariableType
-
variableType -
[namespace=0]
Parameters:
-
variableTypeString | NodeId -
[namespace=0]Number optionalan optional namespace index
Returns:
Example:
var objectType = addressSpace.findVariableType("ns=0;i=62");
objectType.browseName.toString().should.eql("BaseVariableType");
var objectType = addressSpace.findVariableType("BaseVariableType");
objectType.browseName.toString().should.eql("BaseVariableType");
var objectType = addressSpace.findVariableType(resolveNodeId("ns=0;i=62"));
objectType.browseName.toString().should.eql("BaseVariableType");
getCurrentState
()
String
Returns:
getStates
()
Returns:
historyRead
-
context -
historyReadDetails -
indexRange -
dataEncoding -
continuationPoint -
callback
Parameters:
-
contextSessionContext -
historyReadDetailsHistoryReadDetails -
indexRangeNumericRange | Null -
dataEncodingString -
continuationPointByteString -
callbackFunction-
err -
resultHistoryReadResult
-
installHistoricalDataNode
-
node -
[options]
Parameters:
-
nodeObjectUAVariable
-
[options]Object optional-
[maxOnlineValues= 1000]optional
-
inverseReferenceType
-
referenceType
returns the inverse name of the referenceType.
Parameters:
-
referenceTypeString: the reference type name
Returns:
the name of the inverse reference type.
Example:
addressSpace.inverseReferenceType("OrganizedBy").should.eql("Organizes");
addressSpace.inverseReferenceType("Organizes").should.eql("OrganizedBy");
isNodeIdString
-
str
returns true if str matches a nodeID, e.g i=123 or ns=...
Parameters:
-
strObject
isValidTransition
-
toStateNode
Parameters:
-
toStateNodeObject
Returns:
normalizeReferenceType
-
params.referenceType -
params.isForward
Parameters:
-
params.referenceTypeString | NodeId -
params.isForwardBooleandefault value: true;
Returns:
a new reference object with the normalized name { referenceType:
registerShutdownTask
()
register a function that will be called when the server will perform its shut down.
The NodeOPCUA API