How to use node-opcua-data-access - 10 common examples

To help you get started, we’ve selected a few node-opcua-data-access examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-address-space-for-conformance-testing / src / address_space_for_conformance_testing.js View on Github external
const name = dataType + "ArrayAnalogDataItem";
        const nodeId = "s=" + name;
        // UAAnalogItem
        const { engineeringUnitsRange, instrumentRange } = makeRange(dataType);
        // add a UAAnalogItem
        namespace.addAnalogDataItem({

            componentOf: localParentFolder,

            nodeId: nodeId,
            browseName: name,
            definition: "(tempA -25) + tempB",
            valuePrecision: 0.5,
            engineeringUnitsRange,
            instrumentRange,
            engineeringUnits: standardUnits.degree_celsius,
            dataType: dataType,
            value: new Variant({
                arrayType: VariantArrayType.Array,
                dataType: DataType[dataType],
                value: [initialValue, initialValue, initialValue, initialValue, initialValue    ]
            })
        });

    }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / data_access / address_space_add_AnalogItem.js View on Github external
dataType: "Range",
                minimumSamplingInterval: 0,
                accessLevel: "CurrentRead | CurrentWrite",
                value: new Variant({
                    dataType: DataType.ExtensionObject, value: new Range(options.instrumentRange)
                }),
                modellingRule: options.modellingRule ? "Mandatory" : undefined
            });

            instrumentRange.on("value_changed",handler);

        }

        if (options.hasOwnProperty("engineeringUnits")) {

            const engineeringUnits = new EUInformation(options.engineeringUnits);
            assert(engineeringUnits instanceof EUInformation, "expecting engineering units");

            // EngineeringUnits  specifies the units for the   DataItem‟s value (e.g., DEGC, hertz, seconds).   The
            // EUInformation   type is specified in   5.6.3.

            const eu = namespace.addVariable({
                propertyOf: variable,
                typeDefinition: "PropertyType",
                browseName: {name:"EngineeringUnits",namespaceIndex:0},
                dataType: "EUInformation",
                minimumSamplingInterval: 0,
                accessLevel: "CurrentRead",
                value: new Variant({
                    dataType: DataType.ExtensionObject, value: engineeringUnits
                }),
                modellingRule: options.modellingRule ? "Mandatory" : undefined
github node-opcua / node-opcua / packages / node-opcua-address-space / src / data_access / address_space_add_AnalogItem.js View on Github external
const handler = variable.handle_semantic_changed.bind(variable);
        euRange.on("value_changed",handler);

        if (options.hasOwnProperty("instrumentRange")) {

            const instrumentRange =namespace.addVariable({
                propertyOf: variable,
                typeDefinition: "PropertyType",
                browseName: {name:"InstrumentRange",namespaceIndex:0},
                dataType: "Range",
                minimumSamplingInterval: 0,
                accessLevel: "CurrentRead | CurrentWrite",
                value: new Variant({
                    dataType: DataType.ExtensionObject, value: new Range(options.instrumentRange)
                }),
                modellingRule: options.modellingRule ? "Mandatory" : undefined
            });

            instrumentRange.on("value_changed",handler);

        }

        if (options.hasOwnProperty("engineeringUnits")) {

            const engineeringUnits = new EUInformation(options.engineeringUnits);
            assert(engineeringUnits instanceof EUInformation, "expecting engineering units");

            // EngineeringUnits  specifies the units for the   DataItem‟s value (e.g., DEGC, hertz, seconds).   The
            // EUInformation   type is specified in   5.6.3.
github node-opcua / node-opcua / packages / node-opcua-address-space / src / data_access / address_space_add_AnalogItem.js View on Github external
// use as automatically scaling a bar graph display
        // Sensor or instrument failure or deactivation can result in a return ed item value which is actually
        // outside  of  this range. Client software must be prepared to deal with this   possibility. Similarly a client
        // may attempt to write a value that is outside  of  this range back to the server. The exact behaviour
        // (accept, reject, clamp, etc.) in this case is server - dependent. However ,   in general servers  shall  be
        // prepared to handle this.
        //     Example:    EURange ::= {-200.0,1400.0}

        const euRange = namespace.addVariable({
            propertyOf: variable,
            typeDefinition: "PropertyType",
            browseName: {name:"EURange",namespaceIndex:0},
            dataType: "Range",
            minimumSamplingInterval: 0,
            value: new Variant({
                dataType: DataType.ExtensionObject, value: new Range(options.engineeringUnitsRange)
            }),
            modellingRule: options.modellingRule
        });


        const handler = variable.handle_semantic_changed.bind(variable);
        euRange.on("value_changed",handler);

        if (options.hasOwnProperty("instrumentRange")) {

            const instrumentRange =namespace.addVariable({
                propertyOf: variable,
                typeDefinition: "PropertyType",
                browseName: {name:"InstrumentRange",namespaceIndex:0},
                dataType: "Range",
                minimumSamplingInterval: 0,
github node-opcua / node-opcua / packages / node-opcua / index.js View on Github external
module.exports.NodeClassMask = require("node-opcua-data-model").NodeClassMask;
module.exports.AttributeIds = require("node-opcua-data-model").AttributeIds;
module.exports.AttributeNameById = require("node-opcua-data-model").AttributeNameById;
module.exports.BrowseDirection = require("node-opcua-data-model").BrowseDirection;

module.exports.VariableTypeIds = require("node-opcua-constants").VariableTypeIds;
module.exports.VariableIds = require("node-opcua-constants").VariableIds;
module.exports.MethodIds = require("node-opcua-constants").MethodIds;
module.exports.ObjectIds = require("node-opcua-constants").ObjectIds;
module.exports.ObjectTypeIds = require("node-opcua-constants").ObjectTypeIds;
module.exports.ReferenceTypeIds = require("node-opcua-constants").ReferenceTypeIds;
module.exports.DataTypeIds = require("node-opcua-constants").DataTypeIds;

// DA
module.exports.standardUnits = require("node-opcua-data-access").standardUnits;
module.exports.makeEUInformation = require("node-opcua-data-access").makeEUInformation;
module.exports.Range = require("node-opcua-data-access").Range;

//
module.exports.get_fully_qualified_domain_name = require("node-opcua-hostname").get_fully_qualified_domain_name;
module.exports.makeApplicationUrn = require("node-opcua-common").makeApplicationUrn;

// services
module.exports.browse_service = require("node-opcua-service-browse");
module.exports.read_service = require("node-opcua-service-read");
module.exports.write_service = require("node-opcua-service-write");
module.exports.call_service = require("node-opcua-service-call");

module.exports.session_service = require("node-opcua-service-session");
module.exports.AnonymousIdentityToken = module.exports.session_service.AnonymousIdentityToken;
module.exports.UserNameIdentityToken = module.exports.session_service.UserNameIdentityToken;
github node-opcua / node-opcua / packages / node-opcua / index.js View on Github external
module.exports.NodeClass = require("node-opcua-data-model").NodeClass;
module.exports.NodeClassMask = require("node-opcua-data-model").NodeClassMask;
module.exports.AttributeIds = require("node-opcua-data-model").AttributeIds;
module.exports.AttributeNameById = require("node-opcua-data-model").AttributeNameById;
module.exports.BrowseDirection = require("node-opcua-data-model").BrowseDirection;

module.exports.VariableTypeIds = require("node-opcua-constants").VariableTypeIds;
module.exports.VariableIds = require("node-opcua-constants").VariableIds;
module.exports.MethodIds = require("node-opcua-constants").MethodIds;
module.exports.ObjectIds = require("node-opcua-constants").ObjectIds;
module.exports.ObjectTypeIds = require("node-opcua-constants").ObjectTypeIds;
module.exports.ReferenceTypeIds = require("node-opcua-constants").ReferenceTypeIds;
module.exports.DataTypeIds = require("node-opcua-constants").DataTypeIds;

// DA
module.exports.standardUnits = require("node-opcua-data-access").standardUnits;
module.exports.makeEUInformation = require("node-opcua-data-access").makeEUInformation;
module.exports.Range = require("node-opcua-data-access").Range;

//
module.exports.get_fully_qualified_domain_name = require("node-opcua-hostname").get_fully_qualified_domain_name;
module.exports.makeApplicationUrn = require("node-opcua-common").makeApplicationUrn;

// services
module.exports.browse_service = require("node-opcua-service-browse");
module.exports.read_service = require("node-opcua-service-read");
module.exports.write_service = require("node-opcua-service-write");
module.exports.call_service = require("node-opcua-service-call");

module.exports.session_service = require("node-opcua-service-session");
module.exports.AnonymousIdentityToken = module.exports.session_service.AnonymousIdentityToken;
module.exports.UserNameIdentityToken = module.exports.session_service.UserNameIdentityToken;
github node-opcua / node-opcua / packages / node-opcua-address-space / source / loader / load_nodeset2.ts View on Github external
finish(this: any) {
                this.euInformation = new EUInformation(this.euInformation);
            }
        }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / loader / load_nodeset2.js View on Github external
finish: function () {
                this.euInformation = new EUInformation(this.euInformation);
            }
        }
github node-opcua / node-opcua / packages / node-opcua-address-space / src / data_access / address_space_add_YArrayItem.js View on Github external
"use strict";
/*jslint bitwise: true */

const _ = require("underscore");
const DataValue =  require("node-opcua-data-value").DataValue;
const Variant = require("node-opcua-variant").Variant;
const DataType = require("node-opcua-variant").DataType;
const NodeId = require("node-opcua-nodeid").NodeId;
const StatusCodes = require("node-opcua-status-code").StatusCodes;
const AttributeIds = require("node-opcua-data-model").AttributeIds;
const BaseNode = require("../base_node").BaseNode;


const part8 = require("node-opcua-data-access");

const AxisInformation = part8.AxisInformation;
const AxisScaleEnumeration       = part8.AxisScaleEnumeration;
const Range           = part8.Range;

const utils = require("node-opcua-utils");
const assert = require("node-opcua-assert").assert;
const VariantArrayType = require("node-opcua-variant").VariantArrayType;
const coerceLocalizedText = require("node-opcua-data-model").coerceLocalizedText;
const Namespace = require("../namespace").Namespace;

module.exports.install = function(AddressSpace) {
    /**
     *
     * @method addYArrayItem
     * @param options
     * @param options.componentOf {NodeId}
     * @param options.browseName {String}