Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(options: EnumerationDefinitionOptions) {
super(options);
// create a new Enum
const typedEnum = new Enum(options.enumValues);
options.typedEnum = typedEnum;
assert(!options.encode || _.isFunction(options.encode));
assert(!options.decode || _.isFunction(options.decode));
this.encode = options.encode || _encode_enumeration.bind(null, typedEnum);
this.decode = options.decode || _decode_enumeration.bind(null, typedEnum);
this.typedEnum = options.typedEnum;
this.defaultValue = this.typedEnum.getDefaultValue().value;
}
}
/**
* @module node-opcua-address-space
*/
import * as chalk from "chalk";
import { assert } from "node-opcua-assert";
import { ModelChangeStructureDataType } from "node-opcua-common";
import { NodeClass } from "node-opcua-data-model";
import { BrowseDirection } from "node-opcua-data-model";
import { Enum, EnumItem } from "node-opcua-enum";
import { NodeId } from "node-opcua-nodeid";
import { UAReference } from "../source";
import { AddressSpacePrivate } from "./address_space_private";
import { BaseNode } from "./base_node";
const verbFlags = new Enum({
// NodeAdded 0 Indicates the affected Node has been added.
NodeAdded: 0x01,
// NodeDeleted 1 Indicates the affected Node has been deleted.
NodeDeleted: 0x02,
// ReferenceAdded 2 Indicates a Reference has been added. The affected Node may
ReferenceAdded: 0x04,
// be either a SourceNode or TargetNode. Note that an added
// bidirectional Reference is reflected by two ChangeStructures.
// ReferenceDeleted 3 Indicates a Reference has been deleted. The affected Node may
// be either a SourceNode or TargetNode. Note that a deleted
// bidirectional Reference is reflected by two ChangeStructures.
ReferenceDeleted: 0x08,
const RegisterServerRequest = discovery_service.RegisterServerRequest;
const RegisterServerResponse = discovery_service.RegisterServerResponse;
const RegisterServer2Request = discovery_service.RegisterServer2Request;
const RegisterServer2Response = discovery_service.RegisterServer2Response;
const OPCUAClientBase = require("node-opcua-client").OPCUAClientBase;
const SecurityPolicy = require("node-opcua-secure-channel").SecurityPolicy;
const coerceSecurityPolicy = require("node-opcua-secure-channel").coerceSecurityPolicy;
const MessageSecurityMode = require("node-opcua-service-secure-channel").MessageSecurityMode;
const _enumerationMessageSecurityMode = require("node-opcua-service-secure-channel")._enumerationMessageSecurityMode;
const Enum = require("node-opcua-enum").Enum;
const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const RegisterServerManagerStatus = new Enum({
INACTIVE: 1,
INITIALIZING: 2,
REGISTERING: 3,
WAITING: 4,
UNREGISTERING: 5
});
const g_DefaultRegistrationServerTimeout = 8 * 60 * 1000; // 8 minutes
/**
* RegisterServerManager is responsible to Register an opcua server on a LDS or LDS-ME server
* This class takes in charge :
* - the initial registration of a server
* - the regular registration renewal (every 8 minutes or so ...)
* - dealing with cases where LDS is not up and running when server starts.
* ( in this case the connection will be continuously attempted using the infinite
const SessionContext = require("node-opcua-address-space").SessionContext;
const EventFilter = require("node-opcua-service-filter").EventFilter;
const DataChangeFilter = require("node-opcua-service-subscription").DataChangeFilter;
const AggregateFilter = require("node-opcua-service-subscription").AggregateFilter;
const UAVariable = require("node-opcua-address-space").UAVariable;
const validateFilter = require("./validate_filter").validateFilter;
const isValidDataEncoding = require("node-opcua-data-model").isValidDataEncoding;
const debugLog = require("node-opcua-debug").make_debugLog(__filename);
const doDebug = require("node-opcua-debug").checkDebugFlag(__filename);
const SubscriptionState = new Enum([
"CLOSED", // The Subscription has not yet been created or has terminated.
"CREATING", // The Subscription is being created
"NORMAL", // The Subscription is cyclically checking for Notifications from its MonitoredItems.
// The keep-alive counter is not used in this state.
"LATE", // The publishing timer has expired and there are Notifications available or a keep-alive Message is
// ready to be sent, but there are no Publish requests queued. When in this state, the next Publish
// request is processed when it is received. The keep-alive counter is not used in this state.
"KEEPALIVE",// The Subscription is cyclically checking for Notification
// alive counter to count down to 0 from its maximum.
"TERMINATED"
]);
exports.SubscriptionState = SubscriptionState;
const SessionDiagnosticsDataType = require("node-opcua-common").SessionDiagnosticsDataType;