How to use node-opcua-constants - 10 common examples

To help you get started, we’ve selected a few node-opcua-constants 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 / test_to_fix / test_address_space_construct_extension_object.js View on Github external
it("should bind an xml-preloaded Extension Object Variable : ServerStatus ", function (done) {
        // in this test, we verify that we can easily bind the Server_ServerStatus object
        // the process shall automatically bind variables and substructures recursively
        var VariableIds = require("node-opcua-constants").VariableIds;
        var makeNodeId = require("node-opcua-nodeid").makeNodeId;

        var serverStatus = addressSpace.findNode(makeNodeId(VariableIds.Server_ServerStatus));
        serverStatus.browseName.toString().should.eql("ServerStatus");

        // before bindExtensionObject is called, startTime property exists but is not bound
        serverStatus.should.have.property("startTime");
        serverStatus.startTime.readValue().value.dataType.should.eql(DataType.Null);
        serverStatus.readValue().value.dataType.should.eql(DataType.Null);

        //Xx value.startTime.should.eql(DataType.Null);
        //xx debugLog("serverStatus.startTime =",serverStatus.startTime.readValue().value.toString());


        serverStatus.bindExtensionObject();
github node-opcua / node-opcua / packages / node-opcua-address-space / test_helpers / create_minimalist_address_space_nodeset.js View on Github external
/* global describe,it,before*/

const should = require("should");

const assert = require("node-opcua-assert").assert;

const DataType = require("node-opcua-variant").DataType;

const NodeClass = require("node-opcua-data-model").NodeClass;

const resolveNodeId = require("node-opcua-nodeid").resolveNodeId;

const ObjectTypeIds = require("node-opcua-constants").ObjectTypeIds;
const VariableTypeIds = require("node-opcua-constants").VariableTypeIds;
const ReferenceTypeIds = require("node-opcua-constants").ReferenceTypeIds;
const ObjectIds = require("node-opcua-constants").ObjectIds;
const DataTypeIds = require("node-opcua-constants").DataTypeIds;


const Reference = require("..").Reference;

function dumpReferencesHierarchy(addressSpace) {

    function _dump(referenceType,level) {


        console.log(level,referenceType.browseName.toString(),"(",referenceType.getAllSubtypes().map(x=>x.browseName.toString()).join(" ").green,")");

        const subTypes = referenceType.findReferencesExAsObject("HasSubtype");
        for(let subType of subTypes) {
            _dump(subType,"     "+ level);
github node-opcua / node-opcua / packages / node-opcua-address-space / test_helpers / create_minimalist_address_space_nodeset.js View on Github external
/* global describe,it,before*/

const should = require("should");

const assert = require("node-opcua-assert").assert;

const DataType = require("node-opcua-variant").DataType;

const NodeClass = require("node-opcua-data-model").NodeClass;

const resolveNodeId = require("node-opcua-nodeid").resolveNodeId;

const ObjectTypeIds = require("node-opcua-constants").ObjectTypeIds;
const VariableTypeIds = require("node-opcua-constants").VariableTypeIds;
const ReferenceTypeIds = require("node-opcua-constants").ReferenceTypeIds;
const ObjectIds = require("node-opcua-constants").ObjectIds;
const DataTypeIds = require("node-opcua-constants").DataTypeIds;


const Reference = require("..").Reference;

function dumpReferencesHierarchy(addressSpace) {

    function _dump(referenceType,level) {


        console.log(level,referenceType.browseName.toString(),"(",referenceType.getAllSubtypes().map(x=>x.browseName.toString()).join(" ").green,")");

        const subTypes = referenceType.findReferencesExAsObject("HasSubtype");
        for(let subType of subTypes) {
            _dump(subType,"     "+ level);
github node-opcua / node-opcua / packages / node-opcua-address-space / test_to_fix / test_address_space_construct_extension_object.js View on Github external
it("should bind an xml-preloaded Extension Object Variable : ServerStatus ", function (done) {
        // in this test, we verify that we can easily bind the Server_ServerStatus object
        // the process shall automatically bind variables and substructures recursively
        var VariableIds = require("node-opcua-constants").VariableIds;
        var makeNodeId = require("node-opcua-nodeid").makeNodeId;

        var serverStatus = addressSpace.findNode(makeNodeId(VariableIds.Server_ServerStatus));
        serverStatus.browseName.toString().should.eql("ServerStatus");

        // before bindExtensionObject is called, startTime property exists but is not bound
        serverStatus.should.have.property("startTime");
        serverStatus.startTime.readValue().value.dataType.should.eql(DataType.Null);
        serverStatus.readValue().value.dataType.should.eql(DataType.Null);

        //Xx value.startTime.should.eql(DataType.Null);
        //xx debugLog("serverStatus.startTime =",serverStatus.startTime.readValue().value.toString());


        serverStatus.bindExtensionObject();

        serverStatus.readValue().value.value.startTime.toISOString().should.eql("1601-01-01T00:00:00.000Z");
        serverStatus.startTime.readValue().value.value.toISOString().should.eql("1601-01-01T00:00:00.000Z");
github node-opcua / node-opcua / packages / node-opcua-address-space / test_helpers / create_minimalist_address_space_nodeset.js View on Github external
/* global describe,it,before*/

const should = require("should");

const assert = require("node-opcua-assert").assert;

const DataType = require("node-opcua-variant").DataType;

const NodeClass = require("node-opcua-data-model").NodeClass;

const resolveNodeId = require("node-opcua-nodeid").resolveNodeId;

const ObjectTypeIds = require("node-opcua-constants").ObjectTypeIds;
const VariableTypeIds = require("node-opcua-constants").VariableTypeIds;
const ReferenceTypeIds = require("node-opcua-constants").ReferenceTypeIds;
const ObjectIds = require("node-opcua-constants").ObjectIds;
const DataTypeIds = require("node-opcua-constants").DataTypeIds;


const Reference = require("..").Reference;

function dumpReferencesHierarchy(addressSpace) {

    function _dump(referenceType,level) {


        console.log(level,referenceType.browseName.toString(),"(",referenceType.getAllSubtypes().map(x=>x.browseName.toString()).join(" ").green,")");

        const subTypes = referenceType.findReferencesExAsObject("HasSubtype");
github node-opcua / node-opcua / packages / node-opcua-address-space / test_helpers / create_minimalist_address_space_nodeset.ts View on Github external
nodeClass: NodeClass.Object,
        nodeId: resolveNodeId(ObjectIds.ModellingRule_Mandatory),
    }) as any as UAObject;

    // add the root folder
    {
        const rootFolder = namespace0._createNode({
            browseName: "RootFolder",
            nodeClass: NodeClass.Object,
            nodeId: resolveNodeId(ObjectIds.RootFolder)
        }) as any as UAObject;

        {
            const objectsFolder = namespace0.addObject({
                browseName: "Objects",
                nodeId: resolveNodeId(ObjectIds.ObjectsFolder),
                organizedBy: rootFolder
            });

            assert(rootFolder.getFolderElementByName("Objects")!
              .browseName.toString() === "Objects");

        }
        {
            const dataTypeFolder = namespace0.addObject({
                browseName: "DataType",
                nodeId: resolveNodeId(ObjectIds.DataTypesFolder),
                organizedBy: rootFolder
            });
            {
                const doubleDataType = namespace0._createNode({
                    browseName: "Double",
github node-opcua / node-opcua / packages / node-opcua-address-space / test_helpers / create_minimalist_address_space_nodeset.js View on Github external
isAbstract: true
    });

    // add the root folder
    {
        const rootFolder = namespace0._createNode({
            browseName: "RootFolder",
            nodeId: resolveNodeId(ObjectIds.RootFolder),
            nodeClass: NodeClass.Object
        });


        {
            const objectsFolder = namespace0.addObject({
                browseName: "Objects",
                nodeId: resolveNodeId(ObjectIds.ObjectsFolder),
                organizedBy: rootFolder
            });

            rootFolder.getFolderElementByName("Objects").browseName.toString().should.eql("Objects");

        }
        {
            const dataTypeFolder = namespace0.addObject({
                browseName: "DataType",
                nodeId: resolveNodeId(ObjectIds.DataTypesFolder),
                organizedBy: rootFolder
            });
            {
                const doubleDataType = namespace0._createNode({
                    browseName: "Double",
                    nodeId: resolveNodeId(DataTypeIds.Double),
github node-opcua / node-opcua / packages / node-opcua-client / src / client_session.js View on Github external
const now = Date.now();
    const session = this;
    console.log(" name..................... ", session.name);
    console.log(" sessionId................ ", session.sessionId.toString());
    console.log(" authenticationToken...... ", session.authenticationToken.toString());
    console.log(" timeout.................. ", session.timeout , "ms");
    console.log(" serverNonce.............. ", session.serverNonce.toString("hex"));
    console.log(" serverCertificate........ ", session.serverCertificate.toString("base64"));
    console.log(" serverSignature.......... ", session.serverSignature);
    console.log(" lastRequestSentTime...... ", new Date(session.lastRequestSentTime).toISOString(), now - session.lastRequestSentTime);
    console.log(" lastResponseReceivedTime. ", new Date(session.lastResponseReceivedTime).toISOString(), now - session.lastResponseReceivedTime);
};


const AttributeIds = require("node-opcua-data-model").AttributeIds;
const ReferenceTypeIds = require("node-opcua-constants").ReferenceTypeIds;
const makeNodeId = require("node-opcua-nodeid").makeNodeId;
const resultMask = makeResultMask("ReferenceType");

function __findBasicDataType(session, dataTypeId, callback) {

    assert(dataTypeId instanceof NodeId);

    if (dataTypeId.value <= 25) {
        // we have a well-known DataType
        const dataType = DataType.get(dataTypeId.value);
        callback(null, dataType);
    } else {

        // let's browse for the SuperType of this object
        const nodeToBrowse = new browse_service.BrowseDescription({
            referenceTypeId: makeNodeId(ReferenceTypeIds.HasSubtype),
github node-opcua / node-opcua / packages / node-opcua-server / source / server_engine.ts View on Github external
function bindExtraStuff() {
        // mainly for compliance

        // The version number for the data type description. i=104
        bindStandardScalar(VariableIds.DataTypeDescriptionType_DataTypeVersion,
          DataType.UInt16, () => {
            return 0.0;
          });

        const nrt = addressSpace.findDataType(resolveNodeId(DataTypeIds.NamingRuleType))!;
        // xx console.log(nrt.toString());
        if (nrt) {
          const namingRuleType = (nrt as any)._getDefinition().nameIndex; // getEnumeration("NamingRuleType");
          // i=111
          bindStandardScalar(VariableIds.ModellingRuleType_NamingRule,
            DataType.UInt16, () => {
              return 0;
            });

          // i=112
          bindStandardScalar(VariableIds.ModellingRule_Mandatory_NamingRule,
github node-opcua / node-opcua / packages / node-opcua / index.js View on Github external
module.exports.NumericRange = require("node-opcua-numeric-range").NumericRange;

module.exports.AccessLevelFlag = require("node-opcua-data-model").AccessLevelFlag;
module.exports.makeAccessLevel = require("node-opcua-data-model").makeAccessLevel;
module.exports.LocalizedText = require("node-opcua-data-model").LocalizedText;
module.exports.coerceLocalizedText = require("node-opcua-data-model").coerceLocalizedText;
module.exports.QualifiedName = require("node-opcua-data-model").QualifiedName;
module.exports.coerceQualifyName = require("node-opcua-data-model").coerceQualifyName;
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

node-opcua-constants

pure nodejs OPCUA SDK - module constants

MIT
Latest version published 7 months ago

Package Health Score

76 / 100
Full package analysis