Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UAVariable

A OPCUA Variable Node

Hierarchy

Implements

  • BaseNode
  • UAVariable

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

Optional $$dataType

$$dataType: any

$$extensionObjectArray

$$extensionObjectArray: any

$$getElementBrowseName

$$getElementBrowseName: any

$$indexPropertyName

$$indexPropertyName: any

Optional $$variableType

$$variableType: any

Optional $extensionObject

$extensionObject: any

Optional $historicalDataConfiguration

$historicalDataConfiguration: HistoricalDataConfiguration

Optional __waiting_callbacks

__waiting_callbacks: any[]

_dataValue

_dataValue: DataValue
internal

_get_func

_get_func: any

_permissions

_permissions: Permissions | null

_set_func

_set_func: any

_timestamped_get_func

_timestamped_get_func: any

_timestamped_set_func

_timestamped_set_func: any

accessLevel

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 {{link:AccessLevelType}}

arrayDimensions

arrayDimensions: UInt32[] | null

This Attribute specifies the length of each dimension for an array value.

  • 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.

example

For example, if a Variable is defined by the following javascript array with 346 Int32 elements:

const myArray = new Array(346).fill(0);

then:

  • 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.

    {
    dataType: "Int32",
    valueRank: 1,
    arrayDimensions: [346]
    }

Note: the maximum length of an array transferred on the wire is 2147483647 (max Int32) and a multidimensional array is encoded as a one dimensional array.

Readonly browseName

browseName: QualifiedName

dataType

dataType: NodeId

historizing

historizing: boolean

The historizing attribute indicates whether the server is actively collecting data for the history of the variable.

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.

minimumSamplingInterval

minimumSamplingInterval: number

The MinimumSamplingInterval Attribute indicates how 'current' the Value of the Variable will be kept.

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.

Readonly nodeClass

nodeClass: Variable = NodeClass.Variable

Readonly nodeId

nodeId: NodeId

Optional nodeVersion

nodeVersion: UAVariableT<string, String>

NodeVersion (Optional) String The NodeVersion Property is used to indicate the version of a Node. The NodeVersion Property is updated each time a Reference is added or deleted to the Node the Property belongs to. Attribute value changes do not cause the NodeVersion to change. Clients may read the NodeVersion Property or subscribe to it to determine when the structure of a Node has changed.

Optional onFirstBrowseAction

onFirstBrowseAction: function

Type declaration

    • (this: BaseNodePublic): Promise<void>
    • Parameters

      • this: BaseNodePublic

      Returns Promise<void>

Optional refreshFunc

refreshFunc: function

Type declaration

semantic_version

semantic_version: number

userAccessLevel

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

valueRank: number

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.

Optional varHistorian

varHistorian: IVariableHistorian

Accessors

addressSpace

dataTypeObj

  • Returns UADataType

description

  • get description(): LocalizedText
  • set description(value: LocalizedText): void

displayName

  • get displayName(): LocalizedText[]
  • set displayName(value: LocalizedText[]): void

fromStateNode

isFalseSubStateOf

  • get isFalseSubStateOf(): BaseNodePublic | null
  • property

    isFalseSubStateOf

    Returns BaseNodePublic | null

isTrueSubStateOf

  • get isTrueSubStateOf(): BaseNodePublic | null
  • property

    isTrueSubStateOf

    Returns BaseNodePublic | null

modellingRule

namespace

namespaceIndex

  • get namespaceIndex(): number

namespaceUri

  • get namespaceUri(): string

parent

  • get parent(): BaseNodePublic | null
  • the parent node

    Returns BaseNodePublic | null

parentNodeId

  • get parentNodeId(): NodeId | undefined

toStateNode

typeDefinition

  • get typeDefinition(): NodeId
  • returns the nodeId of this node's Type Definition

    Returns NodeId

typeDefinitionObj

  • get typeDefinitionObj(): UAVariableType

Methods

_conditionRefresh

  • _conditionRefresh(_cache?: any): void
  • Parameters

    • Optional _cache: any

    Returns void

_getEnumerationInfo

  • Returns EnumerationInfo

_historyPush

  • _historyPush(newDataValue: DataValue): any
  • Parameters

    • newDataValue: DataValue

    Returns any

_historyRead

  • _historyRead(context: SessionContext, historyReadDetails: ReadRawModifiedDetails | ReadEventDetails | ReadProcessedDetails | ReadAtTimeDetails, indexRange: NumericRange | null, dataEncoding: QualifiedNameLike | null, continuationPoint: ContinuationPoint | null, callback: CallbackT<HistoryReadResult>): any
  • Parameters

    Returns any

_historyReadModify

  • Parameters

    Returns any

_historyReadRaw

  • Parameters

    Returns void

_historyReadRawAsync

  • _historyReadRawAsync(historyReadRawModifiedDetails: ReadRawModifiedDetails, maxNumberToExtract: number, isReversed: boolean, reverseDataValue: boolean, callback: CallbackT<DataValue[]>): any
  • Parameters

    • historyReadRawModifiedDetails: ReadRawModifiedDetails
    • maxNumberToExtract: number
    • isReversed: boolean
    • reverseDataValue: boolean
    • callback: CallbackT<DataValue[]>

    Returns any

_historyReadRawModify

  • Parameters

    Returns any

_internal_set_dataValue

  • _internal_set_dataValue(dataValue: DataValue, indexRange?: NumericRange | null): void
  • Parameters

    • dataValue: DataValue
    • Optional indexRange: NumericRange | null

    Returns void

_on_child_added

  • _on_child_added(): void

_on_child_removed

  • _on_child_removed(obj: BaseNode): void

_update_startOfArchive

  • _update_startOfArchive(newDate: Date): void
  • Parameters

    Returns void

_update_startOfOnlineArchive

  • _update_startOfOnlineArchive(newDate: Date): void
  • Parameters

    Returns void

_validate_DataType

  • _validate_DataType(variantDataType: DataType): boolean
  • Parameters

    Returns boolean

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

addReference

  • method

    addReference

    example
    view.addReference({ referenceType: "Organizes", nodeId: myDevice });

    or

    myDevice1.addReference({ referenceType: "OrganizedBy", nodeId: view });

    Parameters

    Returns void

adjustVariant

  • adjustVariant(variant: Variant): Variant
  • Parameters

    • variant: Variant

    Returns Variant

allReferences

asyncRefresh

  • asyncRefresh(...args: any[]): any
  • asyncRefresh(oldestDate: Date, callback: DataValueCallback): void
  • asyncRefresh(oldestDate: Date): Promise<DataValue>
  • Parameters

    • Rest ...args: any[]

    Returns any

  • Parameters

    Returns void

  • Parameters

    Returns Promise<DataValue>

bindExtensionObject

  • bindExtensionObject(optionalExtensionObject?: ExtensionObject): ExtensionObject | null
  • bindExtensionObject(optionalExtensionObject?: ExtensionObject): ExtensionObject | null
  • method

    bindExtensionObject

    Parameters

    • Optional optionalExtensionObject: ExtensionObject

    Returns ExtensionObject | null

  • Parameters

    • Optional optionalExtensionObject: ExtensionObject

    Returns ExtensionObject | null

bindVariable

  • bind a variable with a get and set functions.

    method

    bindVariable

    example
        ...
        var options =  {
          get : () => {
             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 : () => { 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;

    Parameters

    Returns void

    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.

  • Parameters

    Returns void

browseNode

  • browseNode(browseDescription: BrowseDescription, context?: SessionContext): ReferenceDescription[]
  • browse the node to extract information requested in browseDescription

    method

    browseNode

    Parameters

    • browseDescription: BrowseDescription
    • Optional context: SessionContext

    Returns ReferenceDescription[]

    an array with reference descriptions

browseNodeByTargetName

  • browseNodeByTargetName(relativePathElement: RelativePathElement, isLast: boolean): NodeId[]
  • method

    browseNodeByTargetName

    Parameters

    • relativePathElement: RelativePathElement
    • isLast: boolean

    Returns NodeId[]

checkExtensionObjectIsCorrect

  • checkExtensionObjectIsCorrect(extObj: ExtensionObject | ExtensionObject[] | null): boolean
  • Parameters

    • extObj: ExtensionObject | ExtensionObject[] | null

    Returns boolean

checkVariantCompatibility

  • checkVariantCompatibility(value: Variant): StatusCode
  • method

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

    Parameters

    • value: Variant

    Returns StatusCode

clone

  • clone(options?: any, optionalFilter?: any, extraInfo?: any): UAVariable
  • clone(options?: any, optionalFilter?: any, extraInfo?: any): UAVariable
  • Parameters

    • Optional options: any
    • Optional optionalFilter: any
    • Optional extraInfo: any

    Returns UAVariable

  • Parameters

    • Optional options: any
    • Optional optionalFilter: any
    • Optional extraInfo: any

    Returns UAVariable

constructExtensionObjectFromComponents

  • constructExtensionObjectFromComponents(): any
  • Returns any

dispose

  • dispose(): void
  • the dispose method should be called when the node is no longer used, to release back pointer to the address space and clear caches.

    method

    dispose

    Returns void

dumpXML

  • Parameters

    Returns void

emit

  • emit(event: string | symbol, ...args: any[]): boolean

eventNames

  • eventNames(): Array<string | symbol>

findHierarchicalReferences

findReference

  • findReference(strReference: string, isForward?: boolean): UAReferencePublic | null
  • method

    findReference

    Parameters

    • strReference: string

      the referenceType as a string.

    • Optional isForward: boolean

    Returns UAReferencePublic | null

findReferences

  • findReferences(referenceType: string | NodeId | UAReferenceTypePublic, isForward?: boolean): UAReferencePublic[]
  • method

    findReferences

    Parameters

    • referenceType: string | NodeId | UAReferenceTypePublic

      the referenceType as a string.

    • Optional isForward: boolean

    Returns UAReferencePublic[]

    an array with references

findReferencesAsObject

  • findReferencesAsObject(strReference: string, isForward?: boolean): BaseNode[]

findReferencesEx

  • findReferencesEx(strReference: string, browseDirection?: BrowseDirection): UAReferencePublic[]

findReferencesExAsObject

fullName

  • fullName(): string

getAggregates

getChildByName

  • getChildByName(browseName: string | QualifiedName): BaseNode | null

getComponentByName

  • getComponentByName(browseName: QualifiedNameLike, namespaceIndex?: number): UAVariablePublic | UAObjectPublic | null

getComponents

getDataTypeNode

  • Returns UADataType

getDisplayName

  • getDisplayName(locale?: string): string
  • Parameters

    • Optional locale: string

    Returns string

getEventSourceOfs

getEventSources

getFalseSubStates

  • method

    getFalseSubStates

    Returns UAStateVariable[]

    return an array with the SubStates of this object.

getFolderElementByName

  • getFolderElementByName(browseName: string, namespaceIndex?: number): BaseNode | null
  • retrieve a folder by name

    Parameters

    • browseName: string
    • Optional namespaceIndex: number

    Returns BaseNode | null

getFolderElements

  • returns the list of nodes that this folder object organizes

    Returns BaseNode[]

getMaxListeners

  • getMaxListeners(): number

getMethodById

  • getMethodById(nodeId: NodeId): UAMethodPublic | null
  • returns the method exposed by this object and with the given nodeId

    Parameters

    • nodeId: NodeId

    Returns UAMethodPublic | null

getMethodByName

  • getMethodByName(browseName: string, namespaceIndex?: number): UAMethodPublic | null
  • Parameters

    • browseName: string
    • Optional namespaceIndex: number

    Returns UAMethodPublic | null

getMethods

  • getMethods(): UAMethodPublic[]
  • returns the list of methods that this object provides

    method

    getMethods

    Returns UAMethodPublic[]

    an array with Method objects.

    Note: internally, methods are special types of components

getNotifiers

getProperties

getPropertyByName

  • getPropertyByName(browseName: string, namespaceIndex?: number): UAVariablePublic | null

getTrueSubStates

  • method

    getTrueSubStates

    Returns UAStateVariable[]

    return an array with the SubStates of this object.

getUserWriteMask

  • getUserWriteMask(): number

getWriteMask

  • getWriteMask(): number
  • Returns number

handle_semantic_changed

  • handle_semantic_changed(): void
  • Returns void

historyRead

  • Parameters

    • context: SessionContext
    • historyReadDetails: ReadRawModifiedDetails | ReadEventDetails | ReadProcessedDetails | ReadAtTimeDetails
    • indexRange: NumericRange | null
    • dataEncoding: QualifiedNameLike | null
    • Optional continuationPoint: ContinuationPoint | null
    • Optional callback: CallbackT<HistoryReadResult>

    Returns any

  • Parameters

    Returns Promise<HistoryReadResult>

  • Parameters

    Returns void

incrementExtensionObjectPartial

  • incrementExtensionObjectPartial(path: any): void
  • Parameters

    • path: any

    Returns void

installPostInstallFunc

  • installPostInstallFunc(f: any): void

install_extra_properties

  • install_extra_properties(): void

isEnumeration

  • isEnumeration(): boolean
  • isEnumeration(): boolean
  • Returns boolean

  • Returns boolean

isExtensionObject

  • isExtensionObject(): boolean
  • isExtensionObject(): boolean
  • Returns boolean

  • Returns boolean

isReadable

  • Parameters

    Returns boolean

  • returns true if the accessLevel flag allows the variable to be readable in the specified context.

    Parameters

    Returns boolean

isUserReadable

  • Parameters

    Returns boolean

  • returns true if the userAccessLevel flag allows the variable to be readable in the specified context.

    Parameters

    Returns boolean

isUserWritable

  • Parameters

    Returns boolean

  • returns true if the userAccessLevel flag allows the variable to be writeable in the specified context.

    Parameters

    Returns boolean

isWritable

  • Parameters

    Returns boolean

  • returns true if the accessLevel flag allows the variable to be writeable in the specified context.

    Parameters

    Returns boolean

listenerCount

  • listenerCount(event: string | symbol): number

listeners

  • listeners(event: string | symbol): Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • on(eventName: "semantic_changed", eventHandler: function): this
  • on(eventName: "value_changed", eventHandler: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

  • Parameters

    • eventName: "semantic_changed"
    • eventHandler: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • eventName: "value_changed"
    • eventHandler: function
        • (dataValue: DataValue): void
        • Parameters

          • dataValue: DataValue

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • once(eventName: "semantic_changed", eventHandler: function): this
  • once(eventName: "value_changed", eventHandler: function): this

ownReferences

prependListener

  • prependListener(event: string | symbol, listener: function): this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this

propagate_back_references

  • propagate_back_references(): void

rawListeners

  • rawListeners(event: string | symbol): Function[]

readAttribute

  • Parameters

    Returns DataValue

  • Parameters

    Returns DataValue

readEnumValue

  • Returns IEnumItem

  • Returns EnumValue2

readValue

  • readValue(context?: SessionContext | null, indexRange?: NumericRange, dataEncoding?: string): DataValue
  • readValue(context?: SessionContext | null, indexRange?: NumericRange, dataEncoding?: QualifiedNameLike | null): 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 BadAttributeIdInvalid 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)

    Parameters

    • Optional context: SessionContext | null
    • Optional indexRange: NumericRange
    • Optional dataEncoding: string

    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.

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

    Parameters

    Returns DataValue

readValueAsync

  • method

    readValueAsync

    Parameters

    Returns void

  • Parameters

    Returns Promise<DataValue>

  • Parameters

    Returns Promise<DataValue>

  • Parameters

    Returns void

removeAllListeners

  • removeAllListeners(event?: string | symbol): this

removeListener

  • removeListener(event: string | symbol, listener: function): this

removeReference

resolveNodeId

setMaxListeners

  • setMaxListeners(n: number): this

setPermissions

  • setPermissions set the role and permissions

    example

    const permissions = { CurrentRead: [ "" ], // all users can read CurrentWrite: [ "!", "Administrator" ] // no one except administrator can write }; node.setPermissions(permissions);

    Parameters

    Returns void

  • Parameters

    Returns void

setValueFromSource

  • setValueFromSource(variant: VariantLike, statusCode?: StatusCode, sourceTimestamp?: Date): void
  • setValueFromSource(value: VariantLike, statusCode?: StatusCode, sourceTimestamp?: Date): void
  • 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

    method

    setValueFromSource

    Parameters

    • variant: VariantLike
    • Optional statusCode: StatusCode
    • Optional sourceTimestamp: Date

    Returns void

  • Parameters

    • value: VariantLike
    • Optional statusCode: StatusCode
    • Optional sourceTimestamp: Date

    Returns void

toString

  • toString(): string
  • Returns string

touchValue

  • touchValue(optionalNow?: PreciseClock): void
  • touchValue(updateNow?: PreciseClock): void
  • method

    touchValue touch the source timestamp of a Variable and cascade up the change to the parent variable if any.

    Parameters

    • Optional optionalNow: PreciseClock

    Returns void

  • Parameters

    • Optional updateNow: PreciseClock

    Returns void

uninstall_extra_properties

  • uninstall_extra_properties(reference: Reference): void

unpropagate_back_references

  • unpropagate_back_references(): void

updateExtensionObjectPartial

  • updateExtensionObjectPartial(partialExtensionObject: any): any
  • Parameters

    • partialExtensionObject: any

    Returns any

writeAttribute

  • writeAttribute(context: SessionContext, writeValueOptions: WriteValueOptions | WriteValue, callback?: function): any
  • writeAttribute(context: SessionContext, writeValue: WriteValueOptions, callback: StatusCodeCallback): void
  • writeAttribute(context: SessionContext, writeValue: WriteValueOptions): Promise<StatusCode>
  • Parameters

    • context: SessionContext
    • writeValueOptions: WriteValueOptions | WriteValue
    • Optional callback: function
        • (err: Error | null, statusCode?: StatusCode): void
        • Parameters

          • err: Error | null
          • Optional statusCode: StatusCode

          Returns void

    Returns any

  • write a variable attribute (callback version)

    Parameters

    • context: SessionContext
    • writeValue: WriteValueOptions
    • callback: StatusCodeCallback

      example

        const writeValue = {
           attributeId: AttributeIds.Value,
           dataValue: new DataValue({
               statusCode: StatusCodes.Good,
               sourceTimestamp: new Date(),
               value: new Variant({ dataType: DataType.Double, value: 3.14 })
           }),
           nodeId
        };
      myVariable.writeAttribute(context,writeValue,(err, statusCode) => {
         if (err) { console.log("Write has failed"); return; }
         console.log("write statusCode = ",statusCode.toString());
      });

    Returns void

  • write a variable attribute (async/await version)

    Parameters

    • context: SessionContext
    • writeValue: WriteValueOptions

      example

      try {
         const writeValue = {
            attributeId: AttributeIds.Value,
            dataValue: new DataValue({
                statusCode: StatusCodes.Good,
                sourceTimestamp: new Date(),
                value: new Variant({ dataType: DataType.Double, value: 3.14 })
            }),
            nodeId
         };
         const statusCode = await myVariable.writeAttribute(context,writeValue);
      } catch(err) {
        console.log("Write has failed");
        return;
      }
      console.log("write statusCode = ", statusCode.toString());

    Returns Promise<StatusCode>

writeEnumValue

  • writeEnumValue(value: string | number): void
  • writeEnumValue(value: string | number): void
  • Parameters

    • value: string | number

    Returns void

  • precondition

    UAVariable must have a dataType deriving from "Enumeration"

    Parameters

    • value: string | number

    Returns void

writeValue

  • Parameters

    Returns any

  • Parameters

    Returns void

  • Parameters

    Returns void

  • Parameters

    • context: SessionContext
    • dataValue: DataValueOptions
    • Optional indexRange: string | NumericRange | null

    Returns Promise<StatusCode>

Static makeAttributeEventName

Generated using TypeDoc