Skip to content

Instantly share code, notes, and snippets.

View erossignon's full-sized avatar

Etienne erossignon

View GitHub Profile
// copyright Etienne Rossignon - 2017
var makeNodeId = opcua.makeNodeId;
var ObjectTypeIds = opcua.ObjectTypeIds;
function getAllEventTypes(session,callback)
{
var baseNodeId = makeNodeId(ObjectTypeIds.BaseEventType);
var q = new async.queue(function(task,callback) {
@erossignon
erossignon / test.ipynb
Last active January 8, 2018 17:46
Playing with ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const opcua = require("node-opcua");
const userName = "user1"
const password = "password1"
//xx const endpointUrl = "opc.tcp://192.168.249.31:4840";
const endpointUrl = "opc.tcp://localhost:26543";
//xx const nodeId = "ns=4;s=opctest1_Copy1";
const nodeId = "ns=411;s=Scalar_Static_UInt16";
@erossignon
erossignon / test_client_reconnection.js
Created April 15, 2018 18:52
client reconnection tester
/*global require,console,setTimeout */
/// issues: #237 #288
const opcua = require("node-opcua");
const async = require("async");
const _ = require("underscore");
const client = new opcua.OPCUAClient({
endpoint_must_exist: false,
keepSessionAlive: true,
@erossignon
erossignon / client_typescript.ts
Created December 16, 2018 15:20
Basic node-opcua client in typescript
import { OPCUAClient } from "../packages/node-opcua-client";
async function main() {
try {
const endpointUrl2 = "opc.tcp://localhost:48010";
const client = OPCUAClient.create({
endpoint_must_exist: false
});
await client.connect(endpointUrl2);
const session = await client.createSession();
await session.close();
@erossignon
erossignon / demo_client_with_session.ts
Created December 16, 2018 15:23
withSession in typescript
// tslint:disable:no-console
import { AttributeIds, ClientSession, OPCUAClient } from "node-opcua";
const endpointUrl = "opc.tcp://opcuademo.sterfive.com:26543";
async function main() {
try {
const client = OPCUAClient.create({clientName: "DemoClient"});
@erossignon
erossignon / client_es6.js
Created December 16, 2018 15:26
experimenting async/await in es6 with node-opcua client
const opcua = require("node-opcua");
(async () => {
const client = opcua.OPCUAClient.create();
client.on("backoff", () => console.log("reconnection in progress", client.endpointUrl));
const endpointUrl = "opc.tcp://opcuademo.sterfive.com:26543";
@erossignon
erossignon / server_with_20000_variables.js
Created December 16, 2018 15:29
server with 20k variables
/* 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;
@erossignon
erossignon / Dockerfile
Created February 26, 2019 20:10
Docker file to run node-red-contrib-iiot-opcua tests in a container
# 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 && \
@erossignon
erossignon / demo655.js
Last active August 10, 2019 09:59
crawl large number of node in node-opcua
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";