Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const nodeId2 = browseResult.references[0].nodeId;
const dataValue2 = await session.read({
nodeId: nodeId2,
attributeId: 13
});
if (doDebug) {
console.log("namespaceUri =", dataValue2.value.value.toString());
}
const namespaceUri = dataValue2.value.value.toString();
// function enumerate_all_type_with_id(callback) {
const browseDescription2 = {
nodeId: nodeId2,
referenceTypeId: "HasComponent",
browseDirection: opcua.BrowseDirection.Forward,
resultMask: 0x3F
};
const browseResult2 = await session.browse(browseDescription2);
if (doDebug) {
console.log("--", browseResult2.toString());
}
if (doDebug) {
browseResult2.references = browseResult2.references || [];
const aa = browseResult2.references.map( (x) => x.nodeId.toString() + " " + x.browseName).join("| \n");
console.log("r =", aa);
}
for (const x of browseResult2.references) {
// process_structure(x, callback) {
const nodeId = x.nodeId;
const name = x.browseName.toString();
async function parse_opcua_common(session) {
const binaries = "i=83";
// browse_all_opc_binary_schema_and_xml_schema
const browseDescriptions = [
{
nodeId: "i=93", //OPCBinarySchema_TypeSystem
referenceTypeId: "HasComponent",
browseDirection: opcua.BrowseDirection.Forward,
resultMask: 0x3F
},
{
nodeId: "i=92", //XMLSchema_TypeSystem
referenceTypeId: "HasComponent",
browseDirection: opcua.BrowseDirection.Forward,
resultMask: 0x3F
}
];
const browseResults = await session.browse(browseDescriptions);
const binSchemaReferences = browseResults[0].references;
const xmlSchemaReferences = browseResults[1].references;
function expand_opcua_node(node, callback) {
if (!g_session) {
return callback(new Error("No Connection"));
}
const children = [];
const b = [{
nodeId: node.nodeId,
referenceTypeId: "Organizes",
includeSubtypes: true,
browseDirection: opcua.BrowseDirection.Forward,
resultMask: 0x3f
},
{
nodeId: node.nodeId,
referenceTypeId: "Aggregates",
includeSubtypes: true,
browseDirection: opcua.BrowseDirection.Forward,
resultMask: 0x3f
},
{
nodeId: node.nodeId,
referenceTypeId: "HasSubtype",
includeSubtypes: true,
browseDirection: opcua.BrowseDirection.Forward,
resultMask: 0x3f
},
{
nodeId: node.nodeId,
referenceTypeId: "Aggregates",
includeSubtypes: true,
browseDirection: opcua.BrowseDirection.Forward,
resultMask: 0x3f
},
{
nodeId: node.nodeId,
referenceTypeId: "HasSubtype",
includeSubtypes: true,
browseDirection: opcua.BrowseDirection.Forward,
resultMask: 0x3f
},
];
g_session.browse(b, function (err, results) {
if (!err) {
let result = results[0];
for (let i = 0; i < result.references.length; i++) {
const ref = result.references[i];
children.push(new TreeItem({
arrow: "◊-o-> ",
browseName: ref.browseName.toString(),