This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as fs from 'fs'; | |
import { OPCUAServer, nodesets, Variant, DataType, StatusCodes } from 'node-opcua'; | |
(async () => { | |
const data = await fetch("https://raw.githubusercontent.com/OPCFoundation/UA-Nodeset/2f76ebcfa097cde42414bea08abf04423f30ea4e/PlasticsRubber/GeneralTypes/1.03/Opc.Ua.PlasticsRubber.GeneralTypes.NodeSet2.xml"); | |
const filename = "./Opc.Ua.PlasticsRubber.GeneralTypes.NodeSet2.xml"; | |
fs.writeFileSync(filename, await data.text()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { OPCUAClient, SecurityPolicy, MessageSecurityMode } = require("node-opcua"); | |
const endpointUri = process.argv[2] || "opc.tcp://opcuademo.sterfive.com:26543"; | |
(async () => { | |
try { | |
console.log("connecting to ", endpointUri); | |
const client = OPCUAClient.create({ endpoint_must_exist: false }); | |
client.on("backoff", () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ssh pi@raspberrypi | |
pi@raspberrypi's password: | |
Linux raspberrypi 5.4.51-v7l+ #1327 SMP Thu Jul 23 11:04:39 BST 2020 armv7l | |
The programs included with the Debian GNU/Linux system are free software; | |
the exact distribution terms for each program are described in the | |
individual files in /usr/share/doc/*/copyright. | |
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | |
permitted by applicable law. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ts-node | |
// tslint:disable:no-console | |
import * as chalk from "chalk"; | |
import * as fs from "fs"; | |
import * as path from "path"; | |
import * as yargs from "yargs"; | |
import { | |
ApplicationType, | |
coerceMessageSecurityMode, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mkdir myproj | |
// cd myproj | |
// npm init | |
// npm install node-opcua | |
// => copy this file | |
// node --inspect-brk test_server.js | |
const path = require("path"); | |
const fs = require("fs"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node --inspect-brk -r ts-node/register -r source-map-support test_server.ts | |
import * as path from "path"; | |
import * as fs from "fs"; | |
import { promisify } from "util"; | |
import * as child_process from "child_process"; | |
import { | |
makeApplicationUrn, | |
OPCUAServer, | |
OPCUAClient, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chalk = require("chalk"); | |
const { | |
OPCUAServer , | |
OPCUACertificateManager | |
} = require("node-opcua"); | |
const certificateManager = new OPCUACertificateManager({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { OPCUAClient , NodeCrawler} = require("node-opcua"); | |
const async = require("async"); | |
const util = require("util"); | |
const client = OPCUAClient.create({ | |
endpoint_must_exist: false | |
}); | |
// UA Automation Ansi Demo Server | |
const endpointUrl = "opc.tcp://localhost:48020"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# docker build . -t node-red-contrib-iiot-opcua | |
# docker run node-red-contrib-iiot-opcua | |
FROM mhart/alpine-node | |
RUN apk add git make python g++ openssl | |
RUN cd /home && git clone https://github.com/biancode/node-red-contrib-iiot-opcua.git | |
RUN cd /home/node-red-contrib-iiot-opcua && \ | |
git reset HEAD --hard && \ | |
git fetch && \ | |
git checkout develop && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global console, require */ | |
const opcua = require("node-opcua"); | |
const server = new opcua.OPCUAServer({ | |
port: 26543 // the port of the listening socket of the server | |
}); | |
function post_initialize() { | |
const addressSpace = server.engine.addressSpace; |
NewerOlder