Skip to content

Commit

Permalink
add machinery and update nodesets
Browse files Browse the repository at this point in the history
  • Loading branch information
erossignon committed Nov 7, 2020
1 parent 6a312d7 commit be04f71
Show file tree
Hide file tree
Showing 18 changed files with 16,541 additions and 272 deletions.
35 changes: 24 additions & 11 deletions code_gen/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ function wget(dest_folder, file_url) {
}
console.log(" downloading " + filename + " from " + file_url);

const stream = fs.createWriteStream(filename, {flag: "w"});
const stream = fs.createWriteStream(filename, { flag: "w" });

const request_options = url.parse(file_url);

request_options.headers = {'user-agent': 'Mozilla/5.0'};
request_options.headers = { 'user-agent': 'Mozilla/5.0' };

// Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.101 Safari/537.36
const req = http.get(request_options, function (response) {
const req = http.get(request_options, function(response) {
// handle the response
let res_data = '';
// console.log(response);
Expand All @@ -52,7 +52,7 @@ function wget(dest_folder, file_url) {
total: fileBytes
});

response.on('data', function (chunk) {
response.on('data', function(chunk) {
res_data += chunk;

if (chunk.length) {
Expand All @@ -65,11 +65,11 @@ function wget(dest_folder, file_url) {
stream.write(chunk, "binary");

});
response.on('end', function () {
response.on('end', function() {
stream.end();
});
});
req.on('error', function (err) {
req.on('error', function(err) {
console.log("Request error: " + err.message);
});
}
Expand Down Expand Up @@ -256,9 +256,9 @@ if (false) {

// with git hub

function fetch_from_github(version,file){
function fetch_from_github(version, file) {

wget("1.04","https://raw.githubusercontent.com/OPCFoundation/UA-Nodeset/v" + version + "/" + file);
wget("1.04", "https://raw.githubusercontent.com/OPCFoundation/UA-Nodeset/v" + version + "/" + file);

}
const version = "1.04";
Expand All @@ -275,14 +275,27 @@ fetch_from_github(version, "Schema/Opc.Ua.NodeSet2.Part8.xml");
fetch_from_github(version, "Schema/Opc.Ua.NodeSet2.xml");
fetch_from_github(version, "Schema/Opc.Ua.Types.xsd");

fetch_from_github(version, "/DI/Opc.Ua.Di.NodeSet2.xml");
fetch_from_github(version, "/DI/Opc.Ua.Di.Types.xsd");
fetch_from_github(version, "/DI/Opc.Ua.Di.Types.bsd");
fetch_from_github(version, "DI/Opc.Ua.Di.NodeSet2.xml");
fetch_from_github(version, "DI/Opc.Ua.Di.Types.xsd");
fetch_from_github(version, "DI/Opc.Ua.Di.Types.bsd");

fetch_from_github(version, "ADI/Opc.Ua.Adi.NodeSet2.xml");
fetch_from_github(version, "ADI/Opc.Ua.Adi.Types.xsd");
fetch_from_github(version, "ADI/Opc.Ua.Adi.Types.bsd");

fetch_from_github(version, "GDS/Opc.Ua.Gds.NodeSet2.xml");
fetch_from_github(version, "AutoID/Opc.Ua.AutoID.NodeSet2.xml");
fetch_from_github(version, "Machinery/Opc.Ua.Machinery.NodeSet2.xml");
fetch_from_github(version, "ISA-95/Opc.ISA95.NodeSet2.xml");
fetch_from_github(version, "PackML/Opc.Ua.PackML.NodeSet2.xml");
fetch_from_github(version, "Robotics/Opc.Ua.Robotics.NodeSet2.xml");
fetch_from_github(version, "CNC/Opc.Ua.CNC.NodeSet.xml");
fetch_from_github(version, "MachineVision/Opc.Ua.MachineVision.NodeSet2.xml");
fetch_from_github(version, "Robotics/Opc.Ua.Robotics.NodeSet2.xml");

//
fetch_from_github(version, "PlasticsRubber/Extrusion/Pelletizer/1.0/Opc.Ua.PlasticsRubber.Extrusion.Pelletizer.NodeSet2.xml");

fetch_from_github(version, "Schema/SecuredApplication.xsd");
fetch_from_github(version, "Schema/UANodeSet.xsd");
fetch_from_github(version, "Schema/UAVariant.xsd");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ function makeDefaultVariant(addressSpace: AddressSpacePublic, dataTypeNode: Node
return { dataType: DataType.ExtensionObject, value: null };
}
const dv = findSimpleType(DataType[dataType]).defaultValue;

if (dv === undefined || dv === null) {
// return
return { dataType: DataType.Null };
}
let arrayType: VariantArrayType;
const value = typeof dv === "function" ? dv() : dv;
// if (dataType === DataType.ByteString ) { value = Buffer.alloc(0) }
Expand Down
5 changes: 5 additions & 0 deletions packages/node-opcua-address-space/src/address_space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,11 @@ export class AddressSpace implements AddressSpacePrivate {
return DataType.Int32;
}

if (dataTypeNode.nodeId.namespace === 0 && dataTypeNode.nodeId.value === 29) {
// Number
return DataType.Null; //which one ?
}

if (dataTypeNode.nodeId.namespace === 0 && DataType[dataTypeNode.nodeId.value as number]) {
return dataTypeNode.nodeId.value as DataType;
}
Expand Down
1 change: 1 addition & 0 deletions packages/node-opcua-data-value/source/datavalue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export function encodeDataValue(dataValue: DataValue, stream: OutputBinaryStream
if (!dataValue.value) {
dataValue.value = new Variant();
}
// istanbul ignore next
if (!dataValue.value.encode) {
// tslint:disable-next-line:no-console
console.log(" CANNOT FIND ENCODE METHOD ON VARIANT !!! HELP", JSON.stringify(dataValue, null, " "));
Expand Down
5 changes: 4 additions & 1 deletion packages/node-opcua-nodesets/index_web.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ module.exports = {
autoId: "nodeset:autoId",
robotics: "nodeset:robotics",
machineVision: "nodeset:machineVision",
packML: "nodeset:packML"
packML: "nodeset:packML",
cnc: "nodeset:CNC",
machinery: "nodeset:machinery",
commercialKitchenEquipment: "nodeset:commercialKitchenEquipment"
}
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
* Copyright (c) 2005-2019 The OPC Foundation, Inc. All rights reserved.
* Copyright (c) 2005-2020 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
Expand Down
238 changes: 0 additions & 238 deletions packages/node-opcua-nodesets/nodesets/Opc.Ua.AutoID.NodeIds.csv

This file was deleted.

0 comments on commit be04f71

Please sign in to comment.