How to use the node-opcua-utils.isNullOrUndefined function in node-opcua-utils

To help you get started, we’ve selected a few node-opcua-utils 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-client / src / client_subscription.js View on Github external
//// options should have
    //var allowedProperties = [
    //    'requestedPublishingInterval',
    //    'requestedLifetimeCount',
    //    'requestedMaxKeepAliveCount',
    //    'maxNotificationsPerPublish',
    //    'publishingEnabled',
    //    'priority'
    //];

    options = options || {};
    options.requestedPublishingInterval = options.requestedPublishingInterval || 100;
    options.requestedLifetimeCount = options.requestedLifetimeCount || 60;
    options.requestedMaxKeepAliveCount = options.requestedMaxKeepAliveCount || 10;
    options.maxNotificationsPerPublish = utils.isNullOrUndefined(options.maxNotificationsPerPublish) ? 0 : options.maxNotificationsPerPublish;
    options.publishingEnabled = options.publishingEnabled ? true : false;
    options.priority = options.priority || 1;


    self.publishingInterval = options.requestedPublishingInterval;
    self.lifetimeCount = options.requestedLifetimeCount;
    self.maxKeepAliveCount = options.requestedMaxKeepAliveCount;
    self.maxNotificationsPerPublish = options.maxNotificationsPerPublish;
    self.publishingEnabled = options.publishingEnabled;
    self.priority = options.priority;

    self.subscriptionId = "pending";

    self._next_client_handle = 0;
    self.monitoredItems = {};
github node-opcua / node-opcua / packages / node-opcua-address-space / src / alarms_and_conditions / ua_off_normal_alarm.ts View on Github external
public _updateAlarmState(normalStateValue?: any, inputValue?: any) {

        const alarm = this;

        if (utils.isNullOrUndefined(normalStateValue) || utils.isNullOrUndefined(inputValue)) {
            this.activeState.setValue(false);
            return;
        }
        const isActive = !isEqual(normalStateValue, inputValue);

        if (isActive === alarm.activeState.getValue()) {
            // no change => ignore !
            return;
        }

        const stateName = isActive ? "Active" : "Inactive";
        // also raise the event
        alarm._signalNewCondition(stateName, isActive, "");

    }
github node-opcua / node-opcua / packages / node-opcua-variant / schemas / Variant_schema.js View on Github external
opts.value = coerceVariantArray(options.dataType, options.value);
            }
            return opts;
        }
        assert(options);
        options.dataType = options.dataType || DataType.Null;
        assert(options.dataType);

        // dataType could be a string
        if (typeof options.dataType === "string") {

            const d = factories.findBuiltInType(options.dataType);
            const t = DataType[d.name];

            // istanbul ignore next
            if (utils.isNullOrUndefined(t)) {
                throw new Error("DataType: invalid " + options.dataType);
            }
            options.dataType = t;
        }

        // array type could be a string
        if (typeof options.arrayType === "string") {

            const at  = VariantArrayType[options.arrayType];
            // istanbul ignore next
            if (utils.isNullOrUndefined(at)) {
                throw new Error("ArrayType: invalid " + options.arrayType);
            }
            options.arrayType = at;
        }
github node-opcua / node-opcua / packages / node-opcua-factory / source / factories_baseobject.ts View on Github external
if (!value) {
        return "null []";
    } else {
        if (value.length === 0) {
            return "[ /* empty*/ ]";
        }
        assert(_.isArray(value));
        const v = [];
        const m = Math.min(_nbElements, value.length);
        for (let i = 0; i < m; i++) {
            let element = value[i];
            if (element instanceof Buffer) {
                element = hexDump(element, 32, 16);
            }
            v.push(!utils.isNullOrUndefined(element) ? element.toString() : null);
        }
        return "[ " + v.join(",") + (value.length > 10 ? " ... " : "") + "] (l=" + value.length + ")";
    }
}
github node-opcua / node-opcua / packages / node-opcua-client / src / opcua_client.js View on Github external
function OPCUAClient(options) {

    options = options || {};
    OPCUAClientBase.apply(this, arguments);

    // @property endpoint_must_exist {Boolean}
    // if set to true , create Session will only accept connection from server which endpoint_url has been reported
    // by GetEndpointsRequest.
    // By default, the client is strict.
    this.endpoint_must_exist = (isNullOrUndefined(options.endpoint_must_exist)) ? true : !!options.endpoint_must_exist;

    this.requestedSessionTimeout = options.requestedSessionTimeout || 60000; // 1 minute

    this.applicationName = options.applicationName || "NodeOPCUA-Client";


}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / ua_variable.js View on Github external
function adjust_userAccessLevel(userAccessLevel, accessLevel) {
    userAccessLevel = utils.isNullOrUndefined(userAccessLevel) ? "CurrentRead | CurrentWrite" : userAccessLevel;
    userAccessLevel = makeAccessLevel(userAccessLevel);
    accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
    accessLevel = makeAccessLevel(accessLevel);
    return makeAccessLevel(accessLevel.value & userAccessLevel.value);
}
github node-opcua / node-opcua / packages / node-opcua-variant / src / variant_tools.js View on Github external
function isValidScalarVariant(dataType, value) {

    assert(value === null || DataType.Int64 === dataType || DataType.ByteString === dataType || DataType.UInt64 === dataType || !(value instanceof Array));
    assert(value === null || !(value instanceof Int32Array));
    assert(value === null || !(value instanceof Uint32Array));
    switch (dataType) {
        case DataType.NodeId:
            return ec.isValidNodeId(value);
        case DataType.String:
            return typeof value === "string" || utils.isNullOrUndefined(value);
        case DataType.Int64:
            return ec.isValidInt64(value);
        case DataType.UInt64:
            return ec.isValidUInt64(value);
        case DataType.UInt32:
            return ec.isValidUInt32(value);
        case DataType.Int32:
            return ec.isValidInt32(value);
        case DataType.UInt16:
            return ec.isValidUInt16(value);
        case DataType.Int16:
            return ec.isValidInt16(value);
        case DataType.Byte:
            return ec.isValidUInt8(value);
        case DataType.SByte:
            return ec.isValidInt8(value);
github node-opcua / node-opcua / packages / node-opcua-address-space / src / ua_variable.ts View on Github external
function adjust_accessLevel(accessLevel: any) {
    accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
    accessLevel = makeAccessLevelFlag(accessLevel);
    assert(_.isFinite(accessLevel));
    return accessLevel;
}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / ua_variable.ts View on Github external
function adjust_userAccessLevel(userAccessLevel: any, accessLevel: any) {
    userAccessLevel = utils.isNullOrUndefined(userAccessLevel) ? "CurrentRead | CurrentWrite" : userAccessLevel;
    userAccessLevel = makeAccessLevelFlag(userAccessLevel);
    accessLevel = utils.isNullOrUndefined(accessLevel) ? "CurrentRead | CurrentWrite" : accessLevel;
    accessLevel = makeAccessLevelFlag(accessLevel);
    return makeAccessLevelFlag(accessLevel & userAccessLevel);
}