Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { registerEnumeration } from "node-opcua-factory";
export enum ResultMask {
ReferenceType= 0x01,
IsForward= 0x02,
NodeClass= 0x04,
BrowseName= 0x08,
DisplayName= 0x10,
TypeDefinition= 0x20
}
export const schemaResultMask = {
name: "ResultMask",
enumValues: ResultMask
};
export const _enumerationResultMask: Enum = registerEnumeration(schemaResultMask);
// The ReferenceDescription type is defined in 7.24.
// @example
// makeNodeClassMask("Method | Object").should.eql(5);
export function makeResultMask(str: string): ResultMask {
const flags = str.split(" | ");
let r = 0;
for (const flag of flags) {
r |= (ResultMask as any)[flag];
}
return r as ResultMask;
}
"use strict";
const factories = require("node-opcua-factory");
const ApplicationType_Schema = {
name: "ApplicationType",
enumValues: {
SERVER: 0, // The application is a Server
CLIENT: 1, // The application is a Client
CLIENTANDSERVER: 2, // The application is a Client and a Server
DISCOVERYSERVER: 3 // The application is a DiscoveryServer
}
};
exports.ApplicationType = factories.registerEnumeration(ApplicationType_Schema);
Inverse: 1, //Return inverse references.
Both: 2 // Return forward and inverse references.
},
decode: function(stream) {
assert(stream instanceof BinaryStream);
const value = stream.readInteger();
if (value<0 || value>2) {
return exports.BrowseDirection.Invalid;
}
return exports.BrowseDirection.get(value);
}
};
exports.EnumBrowseDirection_Schema = EnumBrowseDirection_Schema;
exports.BrowseDirection = factories.registerEnumeration(EnumBrowseDirection_Schema);
import { registerEnumeration } from "node-opcua-factory";
export enum DataValueEncodingByte {
Value= 0x01,
StatusCode= 0x02,
SourceTimestamp= 0x04,
ServerTimestamp= 0x08,
SourcePicoseconds= 0x10,
ServerPicoseconds= 0x20
}
export const schemaDataValueEncodingByte = {
name: "DataValue_EncodingByte",
enumValues: DataValueEncodingByte
};
export const _enumerationDataValueEncodingByte: Enum = registerEnumeration(schemaDataValueEncodingByte);
/*
* BitwiseOr [2 operands]
* The result is an integer which matches the size of the largest operand and contains a
* bitwise Or operation of the two operands where both have been converted to the
* same size (largest of the two operands).
* The following restrictions apply to the operands:
* [0]: Any operand that resolves to a Integer.
* [1]: Any operand that resolves to a Integer.
* If any operand cannot be resolved to a Integer it is considered a NULL. See below
* for a discussion on the handling of NULL.
*/
BitwiseOr: 17
}
};
exports.FilterOperator_Schema = FilterOperator_Schema;
exports.FilterOperator = factories.registerEnumeration(FilterOperator_Schema);
Server: 1,
Both: 2,
Neither : 3
},
decode: function(stream) {
assert(stream instanceof BinaryStream);
const value = stream.readInteger();
if (value<0 || value>3) {
return TimestampsToReturn.Invalid;
}
return TimestampsToReturn.get(value);
}
};
exports.TimestampsToReturn_Schema = TimestampsToReturn_Schema;
TimestampsToReturn = exports.TimestampsToReturn = factories.registerEnumeration(TimestampsToReturn_Schema);
"use strict";
const factories = require("node-opcua-factory");
const DataChangeTrigger_Schema = {
name:"DataChangeTrigger",
enumValues: {
Status: 0x00,
StatusValue: 0x01,
StatusValueTimestamp: 0x02,
Invalid : -1,
}
};
exports.DataChangeTrigger_Schema = DataChangeTrigger_Schema;
exports.DataChangeTrigger = factories.registerEnumeration(DataChangeTrigger_Schema);
enumValues: TimestampsToReturn
};
export function encodeTimestampsToReturn(value: TimestampsToReturn, stream: OutputBinaryStream) {
stream.writeUInt32(value);
}
function clamp(min: number, a: number, max: number) {
return Math.max(Math.min(a, max), min);
}
export function decodeTimestampsToReturn(stream: BinaryStream): TimestampsToReturn {
return clamp(TimestampsToReturn.Source, stream.readUInt32(), TimestampsToReturn.Invalid) as TimestampsToReturn;
}
export const _enumerationTimestampsToReturn = registerEnumeration(schemaTimestampsToReturn);
assert(LocalizedText, " expecting Localized Text here to be defined");
const DiagnosticInfo_EncodingByte_Schema = {
name: "DiagnosticInfo_EncodingByte",
enumValues: {
SymbolicId: 0x01,
NamespaceUri: 0x02,
LocalizedText: 0x04,
Locale: 0x08,
AdditionalInfo: 0x10,
InnerStatusCode: 0x20,
InnerDiagnosticInfo: 0x40
}
};
const DiagnosticInfo_EncodingByte = exports.DiagnosticInfo_EncodingByte = factories.registerEnumeration(DiagnosticInfo_EncodingByte_Schema);
function getDiagnosticInfoEncodingByte(diagnosticInfo) {
assert(diagnosticInfo);
let encoding_mask = 0;
if (diagnosticInfo.symbolicId >=0) {
encoding_mask = set_flag(encoding_mask, DiagnosticInfo_EncodingByte.SymbolicId);
}
if (diagnosticInfo.namespaceUri >=0) {
encoding_mask = set_flag(encoding_mask, DiagnosticInfo_EncodingByte.NamespaceUri);
}
if (diagnosticInfo.localizedText >=0) {
encoding_mask = set_flag(encoding_mask, DiagnosticInfo_EncodingByte.LocalizedText);
const factories = require("node-opcua-factory");
const ResultMask_Schema = {
name: "ResultMask",
enumValues: {
ReferenceType: 0x01,
IsForward: 0x02,
NodeClass: 0x04,
BrowseName: 0x08,
DisplayName: 0x10,
TypeDefinition:0x20
}
};
exports.ResultMask_Schema = ResultMask_Schema;
exports.ResultMask = factories.registerEnumeration(ResultMask_Schema);