These are chat archives for node-opcua/node-opcua

31st
Oct 2017
arnesl
@arnesl
Oct 31 17:12
Hi
Are there any examples of how to add folders under an ObjectType?
SchindLuder
@SchindLuder
Oct 31 18:09

@arnesl : I am using the following module:

var opcua = require("node-opcua");

module.exports = folderManipulator;

function folderManipulator(addressSpace) {
let _addressSpace = addressSpace;

this.addFolder = addFolder;
this.addNodeToObjectsFolder = addNodeToObjects;

function addFolder(parentFolder, browseName) {
    let result = _addressSpace.addFolder(parentFolder, {
        browseName: browseName,
        nodeId: `s=${browseName}Folder`
    });

    return result;
};

function addNodeToObjects(browseName, description) {
    _addressSpace.addObject({
        organizedBy: _addressSpace.rootFolder.objects,
        browseName: browseName,
        nodeId: `s=${browseName}`,
        description: description,
        nodeVersion: "0"
    });

    return addressSpace.findNode(`s=${browseName}`);
}

};