APIs

Show:

Constructor

Methods

_clone

(
  • Constructor
  • options
  • extraInfo
  • optionalFilter
)
private

Parameters:

  • Constructor Function
  • options Object
  • extraInfo Object
  • optionalFilter Object

Returns:

:

_clone_children_references

(
  • newParent
  • [optionalFilter = null]
  • [extraInfo]
)
Array private

clone properties and methods

Parameters:

  • newParent Object

    the new parent object to which references of type HasChild will be attached

  • [optionalFilter = null] Function optional

    a filter

  • [extraInfo] Object optional

Returns:

Array:

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

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:

UATwoStateVariable:

Optionals can be EffectiveDisplayName, TransitionTime, EffectiveTransitionTime

bindExtensionObject

(
  • [optionalExtensionObject=null]
)
ExtensionObject

Parameters:

  • [optionalExtensionObject=null] ExtensionObject optional

Returns:

ExtensionObject:

bindVariable

(
  • options
  • [overwrite = false]
)
bind a variable with a get and set functions.

Parameters:

  • options Object
    • [dataType=null] DataType optional

      the nodeId of the dataType

    • [accessLevel] Number optional

      AccessLevelFlagItem

    • [userAccessLevel] Number optional

      AccessLevelFlagItem

    • [set] Function optional

      the variable setter function

    • [get] Function optional

      the variable getter function. the function must return a Variant or a status code

    • [timestamped_get] Function optional

      the getter function. this function must return a object with the following

    • [historyRead] Function optional

      properties:

      • value: a Variant or a status code
      • sourceTimestamp
      • sourcePicoseconds
    • [timestamped_set] Function optional
    • [refreshFunc] Function optional

      the variable asynchronous getter function.

  • [overwrite = false] Boolean optional
    set overwrite to true to overwrite existing binding

Returns:

void ### Providing read access to the underlying value #### Variation 1 In this variation, the user provides a function that returns a Variant with the current value. The sourceTimestamp will be set automatically. The get function is called synchronously.

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
)
ReferenceDescription[]

browse the node to extract information requested in browseDescription

Parameters:

browseNodeByTargetName

(
  • relativePathElement
)
NodeId[]

Parameters:

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]
)
Reference

Parameters:

  • strReference String

    the referenceType as a string.

  • [isForward] Boolean | Null optional
  • [optionalSymbolicName] String optional

Returns:

findReferences

(
  • referenceType
  • [isForward=true]
)
Array

Parameters:

  • referenceType String | NodeId | ReferenceType

    the referenceType as a string.

  • [isForward=true] Boolean optional

Returns:

Array:

full_name

() String

Returns:

String:

the full path name of the node

getAggregates

() BaseNode[]

Returns:

BaseNode[]:

return an array with the Aggregates of this object.

getComponentByName

(
  • browseName
  • [namespaceIndex=null]
)
BaseNode | Null

retrieve a component by name

Parameters:

  • browseName Object
  • [namespaceIndex=null] Object optional

Returns:

BaseNode | Null:

getComponents

() BaseNode[]

Returns:

BaseNode[]:

return an array with the components of this object.

getEventSourceOfs

() BaseNode[]

Returns:

BaseNode[]:

return a array of the objects for which this node is an EventSource

getEventSources

() BaseNode[]

Returns:

BaseNode[]:

return a array with the event source of this object.

getFalseSubStates

() BaseNode[]

Returns:

BaseNode[]:

return an array with the SubStates of this object.

getFolderElements

() Array

returns the list of nodes that this folder object organizes

Returns:

Array:

getMethodById

(
  • nodeId
)
UAMethod | Null

Parameters:

  • nodeId Object

Returns:

UAMethod | Null:

getMethodByName

(
  • browseName
  • [namespaceIndex=null]
)
UAMethod | Null

Parameters:

  • browseName Object
  • [namespaceIndex=null] Object optional

Returns:

UAMethod | Null:

getMethods

() Array

returns the list of methods that this object provides

Returns:

Array:

returns an array wit"h Method objects.

Note: internally, methods are special types of components

getNotifiers

() BaseNode[]

Returns:

BaseNode[]:

return a array with the notifiers of this object.

getProperties

() BaseNode[]

Returns:

BaseNode[]:

return a array with the properties of this object.

getPropertyByName

(
  • browseName
  • [namespaceIndex=null]
)
BaseNode | Null

retrieve a property by name

Parameters:

  • browseName Object
  • [namespaceIndex=null] Object optional

Returns:

BaseNode | Null:

getTrueSubStates

() BaseNode[]

Returns:

BaseNode[]:

return an array with the SubStates of this object.

getValue

() Boolean

Returns:

Boolean:

getValueAsString

() String

Returns:

String:

initialize

(
  • options
)
private

Parameters:

  • options Object

isArgumentValid

(
  • addressSpace
  • argDefinition
  • arg
)
Boolean private

Parameters:

Returns:

Boolean:

isReadable

(
  • context
)
Boolean

Parameters:

  • context SesionContext

Returns:

Boolean:

isUserReadable

(
  • context
)
Boolean

Parameters:

  • context SesionContext

Returns:

Boolean:

isUserWritable

(
  • context
)
Boolean

Parameters:

Returns:

Boolean:

isValueInRange note: this method is overridden in address-space-data-access

() StatusCode

Returns:

isWritable

(
  • context
)
Boolean

Parameters:

Returns:

Boolean:

normalize_referenceTypeId

(
  • addressSpace
  • referenceTypeId
)
NodeId

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

Parameters:

Returns:

readValue

(
  • [context]
  • [indexRange]
  • [dataEncoding]
)
DataValue

Parameters:

  • [context] SessionContext optional
  • [indexRange] NumericRange | Null optional
  • [dataEncoding] String optional

Returns:

DataValue: from OPC.UA.Spec 1.02 part 4 5.10.2.4 StatusCodes Table 51 defines values for the operation level statusCode contained in the DataValue structure of each values element. Common StatusCodes are defined in Table 166. Table 51 Read Operation Level Result Codes Symbolic Id Description BadNodeIdInvalid The syntax of the node id is not valid. BadNodeIdUnknown The node id refers to a node that does not exist in the server address space. BadAttributeIdInvalid Bad_AttributeIdInvalid The attribute is not supported for the specified node. BadIndexRangeInvalid The syntax of the index range parameter is invalid. BadIndexRangeNoData No data exists within the range of indexes specified. BadDataEncodingInvalid The data encoding is invalid. This result is used if no dataEncoding can be applied because an Attribute other than Value was requested or the DataType of the Value Attribute is not a subtype of the Structure DataType. BadDataEncodingUnsupported The server does not support the requested data encoding for the node. This result is used if a dataEncoding can be applied but the passed data encoding is not known to the Server. BadNotReadable The access level does not allow reading or subscribing to the Node. BadUserAccessDenied User does not have permission to perform the requested operation. (table 165)

readValueAsync

(
  • context
  • callback
)
async

Parameters:

removeReference

(
  • reference
)

Parameters:

  • reference Object

Returns:

void

resolveNodeId

(
  • nodeId
)
NodeId

Parameters:

  • nodeId Object

Returns:

setValue

(
  • boolValue
)

Parameters:

  • boolValue Boolean

setValueFromSource

(
  • variant
  • [statusCode = StatusCodes.Good]
  • [sourceTimestamp= Now]
)
setValueFromSource is used to let the device sets the variable values this method also records the current time as sourceTimestamp and serverTimestamp. the method broadcasts an "value_changed" event

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:

Returns:

statusCode,inputArgumentResults

writeAttribute

(
  • context
  • writeValue
  • callback
)
async

Parameters:

writeEnumValue

(
  • value
)

Parameters:

  • value String | Number

writeValue

(
  • context
  • dataValue
  • [indexRange]
  • callback
)
async

Parameters:

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.
This Attribute specifies the length of each dimension for an array value. T

hasMethods

Boolean

returns true if the object has some opcua methods

historizing

Boolean This differs from the AccessLevel Attribute which identifies if the Variable has any historical data. A value of TRUE indicates that the Server is actively collecting data. A value of FALSE indicates the Server is not actively collecting data. Default value is FALSE.
The Historizing Attribute indicates whether the Server is actively collecting data for the history of the Variable.

minimumSamplingInterval

number Optional It specifies (in milliseconds) how fast the Server can reasonably sample the value for changes (see Part 4 for a detailed description of sampling interval). A MinimumSamplingInterval of 0 indicates that the Server is to monitor the item continuously. A MinimumSamplingInterval of -1 means indeterminate.
The MinimumSamplingInterval Attribute indicates how 'current' the Value of the Variable will be kept.

modellingRule

String | Undefined

subtypeOf

NodeId

returns the nodeId of the Type which is the super type of this

typeDefinition

NodeId

returns the nodeId of this node's Type Definition

typeDefinitionObj

BaseNode

returns the nodeId of this node's Type Definition

userAccessLevel

number The UserAccessLevel Attribute is used to indicate how the Value of a Variable can be accessed (read/write) and if it contains current or historic data taking user access rights into account. The AccessLevelType is defined in 8.57.

valueRank

number UInt32 This Attribute indicates whether the Value Attribute of the Variable is an array and how many dimensions the array has. It may have the following values: n > 1: the Value is an array with the specified number of dimensions. OneDimension (1): The value is an array with one dimension. OneOrMoreDimensions (0): The value is an array with one or more dimensions. Scalar (?1): The value is not an array. Any (?2): The value can be a scalar or an array with any number of dimensions. ScalarOrOneDimension (?3): The value can be a scalar or a one dimensional array. NOTE All DataTypes are considered to be scalar, even if they have array-like semantics like ByteString and String.

Events

Description_changed

fires when the description attribute is changed.

Event Payload:

DisplayName_changed

fires when the displayName is changed.

Event Payload: