API Docs for: 0.0.57
Show:

AddressSpace Class

AddressSpace is a collection of UA nodes.

var addressSpace = new AddressSpace();

Methods

_addVariable

() private

_coerce_parent convert a 'string' , NodeId or Object into a valid and existing object

(
  • addressSpace
  • value
  • coerceFunc
)
private

Parameters:

  • addressSpace AddressSpace
  • value Object
  • coerceFunc Function

_coerceNode

(
  • node
)
private

Parameters:

  • node Object

Returns:

:

_createNode

(
  • options
)
BaseNode private

Parameters:

  • options Object
    • nodeId NodeId
    • nodeClass NodeClass
    • browseName String | QualifiedName

      the 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:

_getCompositeKey

(
  • node
  • key
)
BaseNode private

Parameters:

Returns:

Example:

var node  = _getComposite(node,"enabledState.id");

_isFolder

(
  • addressSpace
  • folder
)
Boolean private

return true if nodeId is a Folder

Parameters:

  • addressSpace Object
  • folder Object

Returns:

Boolean:

_process_modelling_rule

(
  • references
  • modellingRule
)
private

Parameters:

  • references Array

    the array of references

  • modellingRule Reference

    the modellling Rule reference.

add_alias

(
  • alias_name
  • nodeId
)

Parameters:

  • alias_name String

    the alias name

  • nodeId NodeId

addEnumerationType

(
  • options
)

Parameters:

  • options Object
    • browseName String
    • enumeration Array
    • enumeration[].displayName String | LocalizedText
    • enumeration[].value Number
    • enumeration[].description String | LocalizedText | Null

addEventType

(
  • options
)
UAObjectType

add a new event type to the address space

Parameters:

  • options Object
    • browseName String

      the eventType name

    • [subtypeOf="BaseEventType"] optional

Returns:

UAObjectType:

: the object type

Example:

 var evtType = addressSpace.addEventType({
     browseName: "MyAuditEventType",
     subtypeOf:  "AuditEventType"
 });

addFolder

(
  • parentFolder
  • options
)
BaseNode

Parameters:

  • parentFolder Object
  • options String | Object
    • browseName String

      the name of the folder

    • [nodeId] NodeId optional

      . An optional nodeId for this object

Returns:

addMethod

(
  • parentObject
  • options
)
Object

Parameters:

  • parentObject Object
  • options Object
    • [nodeId=null] NodeId optional

      the object nodeid.

    • [browseName=""] String optional

      the object browse name.

    • [description=""] String optional

      the object description.

    • inputArguments Array
    • outputArguments Array

Returns:

Object:

addObjectType

(
  • options
)

add a new Object type to the address space

Parameters:

  • options Object
    • browseName String

      the object type name

    • [subtypeOf="BaseObjectType"] String | NodeId | BaseNode optional

      the base class

    • [nodeId] String | NodeId optional

      an 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

addTwoStateVariable

(
  • options
)
UAVariable

Parameters:

  • options Object
    • browseName String
    • [description] String optional
    • [modellingRule] String optional
    • [minimumSamplingInterval=0] Number optional
    • componentOf Node | NodeId
    • trueState String
    • falseState String
    • [isTrueSubStateOf] NodeId optional
    • [isFalseSubStateOf] NodeId optional

Returns:

UAVariable:

Optionals can be EffectiveDisplayName, TransitionTime, EffectiveTransitionTime

addVariable

(
  • options
)
Object

add a variable as a component of the parent node

Parameters:

  • options Object
    • browseName String

      the variable name

    • dataType String

      the variable datatype ( "Double", "UInt8" etc...)

    • [typeDefinition="BaseDataVariableType"] optional
    • [modellingRule=null] optional

      the Modelling rule : "Optional" , "Mandatory"

Returns:

Object:

addVariableType

(
  • options
)

add a new Variable type to the address space

Parameters:

  • options Object
    • browseName String

      the object type name

    • [subtypeOf="BaseVariableType"] String | NodeId | BaseNode optional

      the base class

    • [nodeId] String | NodeId optional

      an optional nodeId for this objectType, if not provided a new nodeId will be created

    • [isAbstract= false] Boolean optional
    • [eventNotifier= 0] Integer optional

browsePath

(
  • browsePath
)
BrowsePathResult

browse some path.

Parameters:

Returns:

BrowsePathResult:

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

constructExtensionObject

(
  • dataType
  • [options =null]
)
Object

Parameters:

  • dataType UADataType
  • [options =null] Object optional

Returns:

Object:

Example:

        // example 1
        var extObj = addressSpace.constructExtentionObject("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");

createNode

(
  • options
)

Parameters:

  • options Object
    • nodeClass
    • [nodeVersion= "0"] String optional

      install nodeVersion

deleteNode

(
  • nodeOrNodeId
)

remove the specified Node from the address space

Parameters:

  • nodeOrNodeId Object

dispose

()

cleanup all resources maintained by this addressSpace.

extractRootViews

(
  • node
)
BaseNode[]

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:

Returns:

findCorrespondingBasicDataType

(
  • dataTypeNode
)

Parameters:

  • dataTypeNode Object

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]
)
DataType | Null

Find the DataType node from a NodeId or a browseName

Parameters:

  • dataType String | NodeId
  • [namespace=0] Number optional

    an optional namespace index

Returns:

DataType | Null:

Example:

 var dataDouble = addressSpace.findDataType("Double");

 var dataDouble = addressSpace.findDataType(resolveNodeId("ns=0;i=3"));

findEventType

(
  • eventTypeId
)
UAObjectType | Null

find an EventType node in the address space

Parameters:

  • eventTypeId String | NodeId

    the eventType to find

Returns:

UAObjectType | Null:

the EventType found or null.

note:

  • the method with throw an exception if a node is found that is not a BaseEventType or a subtype of it.

Example:

var evtType = addressSpace.findEventType("AuditEventType");

findNode

(
  • nodeId
)
BaseNode

find an node by node Id

Parameters:

  • nodeId NodeId | String

    a nodeId or a string coerce-able to nodeID, representing the object to find.

Returns:

findObjectType

(
  • objectType
  • [namespace=0]
)
UAObjectType | Null

Parameters:

  • objectType String | NodeId
  • [namespace=0] Number optional

    an optional namespace index

Returns:

UAObjectType | Null:

Example:

var objectType = addressSpace.findDataType("ns=0;i=58");
 objectType.browseName.toString().should.eql("BaseObjectType");
var objectType = addressSpace.findDataType("BaseObjectType");
 objectType.browseName.toString().should.eql("BaseObjectType");
var objectType = addressSpace.findDataType(resolveNodeId("ns=0;i=58"));
 objectType.browseName.toString().should.eql("BaseObjectType");

findReferenceType

(
  • refType
  • [namespace=0]
)
ReferenceType | Null

Parameters:

  • refType String | NodeId
  • [namespace=0] Number optional

    an optional namespace index

Returns:

ReferenceType | Null:

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
)
ReferenceType

find a ReferenceType by its inverse name.

Parameters:

  • inverseName String

    the inverse name of the ReferenceType to find

Returns:

findVariableType

(
  • variableType
  • [namespace=0]
)
UAObjectType | Null

Parameters:

  • variableType String | NodeId
  • [namespace=0] Number optional

    an optional namespace index

Returns:

UAObjectType | Null:

Example:

var objectType = addressSpace.findDataType("ns=0;i=62");
objectType.browseName.toString().should.eql("BaseVariableType");

var objectType = addressSpace.findDataType("BaseVariableType");
objectType.browseName.toString().should.eql("BaseVariableType");

var objectType = addressSpace.findDataType(resolveNodeId("ns=0;i=62"));
objectType.browseName.toString().should.eql("BaseVariableType");

generateEventId

() Number | | Variant

EventId is generated by the Server to uniquely identify a particular Event Notification.

Returns:

Number | | Variant:

instantiateCondition

(
  • conditionTypeId
  • options
  • data
)
UADataType

instantiate a Condition. this will create the unique EventId and will set eventType

Parameters:

  • conditionTypeId String | NodeId

    the EventType to instantiate

  • options Object
  • data Object

    a object containing the value to set

    • eventId String | NodeId

      the EventType Identifier to instantiate (type cannot be abstract)

Returns:

UADataType:

node

inverseReferenceType

(
  • referenceType
)
String

returns the inverse name of the referenceType.

Parameters:

  • referenceType String

    : the reference type name

Returns:

String:

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:

  • str Object

normalizeReferenceType

(
  • params.referenceType
  • params.isForward
)
Object

Parameters:

  • params.referenceType String | NodeId
  • params.isForward Boolean

    default value: true;

Returns:

Object:

a new reference object with the normalized name { referenceType: , isForward: }

resolveNodeId

(
  • nodeId
)
NodeId

resolved a string or a nodeId to a nodeID

Parameters:

Returns:

Properties