How to use the node-opcua-variant.DataType function in node-opcua-variant

To help you get started, we’ve selected a few node-opcua-variant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-service-call / schemas / Argument_schema.js View on Github external
The description for the argument.
         
     
 
 */

const _ = require("underscore");
const assert = require("node-opcua-assert").assert;

const factories = require("node-opcua-factory");
const NodeId = require("node-opcua-nodeid").NodeId;
const makeNodeId = require("node-opcua-nodeid").makeNodeId;
const coerceNodeId = require("node-opcua-nodeid").coerceNodeId;
const resolveNodeId =  require("node-opcua-nodeid").resolveNodeId;
const DataType = require("node-opcua-variant").DataType;

// OPC Unified Architecture, Part 4 $7.1 page 106
const Argument_Schema = {
    name: "Argument",
    documentation: "An argument for a method.",
    construct_hook: function(options) {

        let dataType = options.dataType;
        if (dataType) {
            if (typeof dataType === "string") {
                dataType = resolveNodeId(dataType);
            } else if ( dataType instanceof NodeId ) {
                // nothing
            } else {
                assert(dataType.hasOwnProperty("value"));
                dataType = coerceNodeId(dataType.value,dataType.namespace);
github node-opcua / node-opcua / packages / node-opcua-address-space / src / base_node.js View on Github external
const coerceQualifiedName = require("node-opcua-data-model").coerceQualifiedName;
const QualifiedName = require("node-opcua-data-model").QualifiedName;
const coerceLocalizedText = require("node-opcua-data-model").coerceLocalizedText;
const attributeNameById = require("node-opcua-data-model").attributeNameById;
const ResultMask = require("node-opcua-data-model").ResultMask;
const NodeClass = require("node-opcua-data-model").NodeClass;
const makeNodeClassMask = require("node-opcua-data-model").makeNodeClassMask;
const AttributeIds = require("node-opcua-data-model").AttributeIds;
const BrowseDirection = require("node-opcua-data-model").BrowseDirection;
const AccessLevelFlag = require("node-opcua-data-model").AccessLevelFlag;

const ReferenceDescription = require("node-opcua-service-browse").ReferenceDescription;

const DataValue = require("node-opcua-data-value").DataValue;

const DataType = require("node-opcua-variant").DataType;

const StatusCodes = require("node-opcua-status-code").StatusCodes;

exports.BrowseDirection = BrowseDirection;

const SessionContext = require("./session_context").SessionContext;
const Reference = require("./reference").Reference;


let ReferenceType = null;// will be defined after baseNode is defined


const doDebug = false;

function defaultBrowseFilterFunc(session) {
github node-opcua / node-opcua / packages / node-opcua-address-space / src / data_access / address_space_add_MultiStateDiscrete.js View on Github external
const assert = require("node-opcua-assert").assert;
const util = require("util");
const address_space = require("../address_space");
const DataType = require("node-opcua-variant").DataType;
const Variant = require("node-opcua-variant").Variant;
const VariantArrayType = require("node-opcua-variant").VariantArrayType;

const add_dataItem_stuff = require("./UADataItem").add_dataItem_stuff;
const coerceLocalizedText = require("node-opcua-data-model").coerceLocalizedText;

const _ = require("underscore");

const Namespace = require("../namespace").Namespace;

const UAVariable = require("../ua_variable").UAVariable;
/**
 * @class UAMultiStateDiscreteType
 * @constructor
 */
function UAMultiStateDiscreteType() {
github node-opcua / node-opcua / packages / node-opcua-address-space / src / alarms_and_conditions / acknowledgeable_condition.js View on Github external
"use strict";

/**
 * @module opcua.address_space.AlarmsAndConditions
 */
const util = require("util");
const assert = require("node-opcua-assert").assert;
const _ = require("underscore");




const Variant = require("node-opcua-variant").Variant;
const DataType = require("node-opcua-variant").DataType;

const LocalizedText = require("node-opcua-data-model").LocalizedText;
const NodeId = require("node-opcua-nodeid").NodeId;

const StatusCodes = require("node-opcua-status-code").StatusCodes;

const AddressSpace = require("../address_space").AddressSpace;
const UATwoStateVariable = require("../ua_two_state_variable").UATwoStateVariable;

const conditions =require("./condition");

const UAConditionBase = conditions.UAConditionBase;
const ConditionSnapshot = conditions.ConditionSnapshot;

function _getValueAsBoolean(node) {
    assert(!node.id);
github node-opcua / node-opcua / packages / node-opcua-address-space / src / ua_variable.js View on Github external
const NodeClass = require("node-opcua-data-model").NodeClass;
const AttributeIds = require("node-opcua-data-model").AttributeIds;
const extractRange = require("node-opcua-data-value").extractRange;
const is_valid_dataEncoding = require("node-opcua-data-model").is_valid_dataEncoding;
const is_dataEncoding = require("node-opcua-data-model").is_dataEncoding;
const AccessLevelFlag = require("node-opcua-data-model").AccessLevelFlag;
const makeAccessLevel = require("node-opcua-data-model").makeAccessLevel;

const NodeId = require("node-opcua-nodeid").NodeId;


const DataValue = require("node-opcua-data-value").DataValue;
const sameDataValue = require("node-opcua-data-value").sameDataValue;

const Variant = require("node-opcua-variant").Variant;
const DataType = require("node-opcua-variant").DataType;
const VariantArrayType = require("node-opcua-variant").VariantArrayType;

const NumericRange = require("node-opcua-numeric-range").NumericRange;

const StatusCodes = require("node-opcua-status-code").StatusCodes;


const write_service = require("node-opcua-service-write");
const WriteValue = write_service.WriteValue;

const getCurrentClock = require("node-opcua-date-time").getCurrentClock;
const coerceClock = require("node-opcua-date-time").coerceClock;

const findBuiltInType = require("node-opcua-factory").findBuiltInType;
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_add_event_type.js View on Github external
"use strict";

/**
 * @module opcua.address_space
 * @class AddressSpace
 */


const assert = require("node-opcua-assert").assert;


const Variant = require("node-opcua-variant").Variant;
const DataType = require("node-opcua-variant").DataType;
const StatusCodes = require("node-opcua-status-code").StatusCodes;
const NodeId = require("node-opcua-nodeid").NodeId;
const sameNodeId = require("node-opcua-nodeid").sameNodeId;
const lowerFirstLetter = require("node-opcua-utils").lowerFirstLetter;

const doDebug = false;


const BaseNode = require("./base_node").BaseNode;
const UAVariable = require("./ua_variable").UAVariable;
const UAMethod = require("./ua_method").UAMethod;
const UAObjectType = require("./ua_object_type").UAObjectType;

const constructBrowsePathFromQualifiedName = require("node-opcua-service-translate-browse-path").constructBrowsePathFromQualifiedName;
github node-opcua / node-opcua / packages / node-opcua-address-space / src / referenceType.js View on Github external
"use strict";

/**
 * @module opcua.address_space
 */

const assert = require("node-opcua-assert").assert;
const util = require("util");

const BaseNode = require("./base_node").BaseNode;
const NodeClass = require("node-opcua-data-model").NodeClass;
const AttributeIds = require("node-opcua-data-model").AttributeIds;
const DataValue =  require("node-opcua-data-value").DataValue;
const DataType = require("node-opcua-variant").DataType;
const StatusCodes = require("node-opcua-status-code").StatusCodes;

const SessionContext = require("./session_context").SessionContext;

const coerceLocalizedText = require("node-opcua-data-model").coerceLocalizedText;

let ReferenceTypeCounter=0;


/**
 * @class ReferenceType
 * @extends  BaseNode
 * @param options
 * @constructor
 */
function ReferenceType(options) {
github node-opcua / node-opcua / packages / node-opcua-address-space / src / data_access / address_space_add_MultiStateValueDiscrete.js View on Github external
const assert = require("node-opcua-assert").assert;
const _ = require("underscore");

const DataType = require("node-opcua-variant").DataType;
const Variant = require("node-opcua-variant").Variant;
const VariantArrayType = require("node-opcua-variant").VariantArrayType;

const add_dataItem_stuff = require("./UADataItem").add_dataItem_stuff;

const coerceLocalizedText = require("node-opcua-data-model").coerceLocalizedText;
const EnumValueType  = require("node-opcua-common").EnumValueType;
const Namespace = require("../namespace").Namespace;


function coerceEnumValues(enumValues) {

    if (_.isArray(enumValues)) {

        //
        return _.map(enumValues, function (en) {
github node-opcua / node-opcua / packages / node-opcua-data-value / src / datavalue.js View on Github external
"use strict";

const assert = require("node-opcua-assert").assert;
const _ = require("underscore");


const DataValue = exports.DataValue = require("../_generated_/_auto_generated_DataValue").DataValue;

const DataType = require("node-opcua-variant").DataType;
const VariantArrayType = require("node-opcua-variant").VariantArrayType;


const TimestampsToReturn = require("../schemas/TimestampsToReturn_enum").TimestampsToReturn;


const registerSpecialVariantEncoder = require("node-opcua-factory").registerSpecialVariantEncoder;
registerSpecialVariantEncoder(exports.DataValue);

const getCurrentClock = require("node-opcua-date-time").getCurrentClock;

const Variant = require("node-opcua-variant").Variant;
const sameVariant = require("node-opcua-variant/src/variant_tools").sameVariant;

function w(n){
    return ("0000"+n).substr(-3);
github node-opcua / node-opcua / packages / node-opcua-address-space / src / address_space_add_method.js View on Github external
"use strict";
/**
 * @module opcua.address_space
 * @class AddressSpace
 */

const assert = require("node-opcua-assert").assert;
const _ = require("underscore");
const NodeClass = require("node-opcua-data-model").NodeClass;
const Argument = require("node-opcua-service-call").Argument;


const DataValue =  require("node-opcua-data-value").DataValue;
const Variant = require("node-opcua-variant").Variant;
const DataType = require("node-opcua-variant").DataType;
const VariantArrayType = require("node-opcua-variant").VariantArrayType;
const coerceQualifiedName = require("node-opcua-data-model").coerceQualifiedName;

const Namespace = require("./namespace").Namespace;
const BaseNode = require("./base_node").BaseNode;

exports.install = function (AddressSpace) {

    const isNonEmptyQualifiedName = Namespace.isNonEmptyQualifiedName;
    const _handle_hierarchy_parent = Namespace._handle_hierarchy_parent;


    Namespace.prototype._addMethod = function(options) {

        const self = this;