/*
The function "markAndAddActiveDevices" does...
542773
function markAndAddActiveDevices(bundle) {
        debugSS('in markAndAddActiveDevices');
        debugLFDS('in markAndAddActiveDevices');
        var defered = q.defer();

        // self.cachedScanBundle.scannedData
        debugMACT('Checking for any previously marked active devices in the last scan cache');

        function isDeviceStillActive(sn) {
            var isActive = false;
            self.cachedCurrentDevices.forEach(function(cachedDevice) {
                var savedAttributes = cachedDevice.savedAttributes;
                var serialNumber = savedAttributes.serialNumber;
                if(sn === serialNumber) {
                    isActive = true;
                }
            });
            return isActive;
        }
        // We need to un-mark any active devices that are no longer active.

        if(self.cachedScanBundle) {
            if(self.cachedScanBundle.scannedData) {
                // debugMACT('We have previously found scanned data', self.cachedScanBundle.scannedData);
                debugMACT('We have previously found scanned data');
                debugPrintFlatScannedData(self.cachedScanBundle.scannedData, debugMACT);
                var scannedData = self.cachedScanBundle.scannedData;
                var dKeys = Object.keys(self.cachedScanBundle.scannedData);
                dKeys.forEach(function(dKey) {
                    var dInfo = scannedData[dKey];
                    var isDeviceActive = dInfo.isActive;
                    var isActuallyActive = isDeviceStillActive(dInfo.serialNumber);
                    debugMACT('SN', dInfo.serialNumber, 'active?',isActuallyActive);
                    // Check to see if the device has the correct active state
                    if(dInfo.isActive != isActuallyActive) {
                        // The device is not actually active...
                        dInfo.isActive = false;
                        // loop through the connection types & fix the active connection.
                        var ctKeys = Object.keys(dInfo.connectionTypes);
                        ctKeys.forEach(function(ctKey) {
                            if(dInfo.connectionTypes[ctKey].isActive) {
                                dInfo.connectionTypes[ctKey].isActive = false;
                                dInfo.connectionTypes[ctKey].insertionMethod = 'scan';
                            }
                        });
                    }
                });
            }
        }

        var promises = self.deviceManager.addCuratedDevices(
            self.cachedCurrentDevices
        );
        
        // Wait for all of the curated devices to get added.
        q.allSettled(promises)
        .then(function() {
            defered.resolve(bundle);
        }, function() {
            defered.resolve(bundle);
        });

        return defered.promise;
    }
116427
function(callback){
      ubeacon.getMeshDeviceId( function( deviceAddress ){
        console.log( '[ubeacon] Device address is: ' + deviceAddress + ' (0x' + deviceAddress.toString(16) + ')' );
        callback(null);
      });
    }
456851
function (out) {
            if (!this._cfgOk) {
                // configuration was incorrect, do not generate any markup in this case
                this.initWidget = Aria.empty;
                return out.write(this.INVALID_CONFIGURATION);
            }

            // Only interested in gestures when there's a particular configuration
            var delegateMarkup = "", cfg = this._cfg;
            if (cfg.tapToMove || (cfg.tapToToggle && this._isSwitch)) {
                this._delegateId = aria.utils.Delegate.add({
                    fn : this.delegate,
                    scope : this
                });
                delegateMarkup = aria.utils.Delegate.getMarkup(this._delegateId);
            }

            cfg.attributes = cfg.attributes || {};
            cfg.attributes.classList = cfg.attributes.classList || [];
            cfg.attributes.classList.push("touchLibSlider");

            out.write([
                    // Div containing the widget
                    '<div ', ariaUtilsHtml.buildAttributeList(cfg.attributes), '" style="width:', this._cfg.width,
                    'px;" ', delegateMarkup, '>',
                    // Rail, thumbs move over here
                    '<span class="touchContainer" style="width:', this._cfg.width, 'px;" id="', this._parentDomId,
                    '">',
                    // slider thumb
                    '<span id="', this._domId, '" class="sliderButton" style="left:0px;"></span>'].join(""));
            if (this._isSwitch) {
                out.write([
                        // For ON state Markup
                        '<div style="left:0px;width:', this._cfg.width, 'px;" class="touchLibSwitchOn" id="',
                        this._onSwitchId, '">', this._onLabel, '</div>',
                        // For OFF state Markup
                        '<div style="left:0px;width:0px;" class="touchLibSwitchOff" id="', this._offSwitchId, '">',
                        this._offLabel, '</div>'].join(""));
            } else {
                out.write(['<span class="sliderHighLight" id="', this._highlightDomId, '"></span>'].join(""));
            }
            out.write('</span></div>');
        }
1208432
function(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled)
	{
		var funct = mxMarker.markers[type];
		
		return (funct != null) ? funct(canvas, shape, type, pe, unitX, unitY, size, source, sw, filled) : null;
	}
1345456
function FtdiDevice(settings) {
  if (typeof(settings) === 'number') {
    settings = { index: settings };
  }

  EventEmitter.call(this);

  this.deviceSettings = settings;

  this.FTDIDevice = new FTDIDevice(settings);
}
894796
public void setTargetedMobileDevices(com.google.api.ads.admanager.axis.v201805.Technology[] targetedMobileDevices) {
        this.targetedMobileDevices = targetedMobileDevices;
    }
1338502
function(buttonInfo, pointerId, timeStamp) {
      if (!buttonInfo.pointerIds[pointerId]) {
        buttonInfo.pointerIds[pointerId] = timeStamp;
        ++buttonInfo.numPointerIds;
        buttonInfo.callback({pressed: true});
      }
    }
837258
function checkDeviceValue() {
    		debug('Checking Device Value');
    		self.iRead(context.register)
    		.then(function(res) {
    			var val = res.val;
    			var sandbox = {
    				'x': val,
    			};
    			var scriptContext = new vm.createContext(sandbox);
    			var result = context.script.runInContext(scriptContext);
    			if(result) {
    				reportResult(res, result, 'resolve');
    			} else {
    				performRetry(res, result);
    			}
    		}, function(err) {
    			errorLog('Error...', err);
    		});
    	}
243287
function markUniformsLightsNeedsUpdate ( uniforms, boolean ) {

		uniforms.ambientLightColor.needsUpdate = boolean;

		uniforms.directionalLightColor.needsUpdate = boolean;
		uniforms.directionalLightDirection.needsUpdate = boolean;

		uniforms.pointLightColor.needsUpdate = boolean;
		uniforms.pointLightPosition.needsUpdate = boolean;
		uniforms.pointLightDistance.needsUpdate = boolean;

		uniforms.spotLightColor.needsUpdate = boolean;
		uniforms.spotLightPosition.needsUpdate = boolean;
		uniforms.spotLightDistance.needsUpdate = boolean;
		uniforms.spotLightDirection.needsUpdate = boolean;
		uniforms.spotLightAngleCos.needsUpdate = boolean;
		uniforms.spotLightExponent.needsUpdate = boolean;

		uniforms.hemisphereLightSkyColor.needsUpdate = boolean;
		uniforms.hemisphereLightGroundColor.needsUpdate = boolean;
		uniforms.hemisphereLightDirection.needsUpdate = boolean;

	}
587839
function curatedDeviceDisconnected(eventData) {
        self.log(' *** Handle', self.handle, 'triggered event: DEVICE_DISCONNECTED', eventData.name, eventData.operation);
    }
1184267
def setOverlayTransformTrackedDeviceRelative(self, ulOverlayHandle, unTrackedDevice):
        """"""

        fn = self.function_table.setOverlayTransformTrackedDeviceRelative
        pmatTrackedDeviceToOverlayTransform = HmdMatrix34_t()
        result = fn(ulOverlayHandle, unTrackedDevice, byref(pmatTrackedDeviceToOverlayTransform))
        return result, pmatTrackedDeviceToOverlayTransform
1216946
function Devices (_adapter, _callback) {

    if (!_adapter || !_adapter.adapterDir) {
        _callback = _adapter;
        _adapter = undefined;
    }
    var that = this;
    this.list = [];

    this.setAdapter = function (_adapter) {
        adapter = _adapter;
    };
    this.has = function (id, prop) {
        var b = objects.hasOwnProperty(id);
        if (prop === undefined) return b;
        return (b && objects[id] !== null && objects[id].hasOwnProperty(prop));
    };
    this.get = function (id) {
        return (objects[id]);
    };
    this.remove = function(id) {
        delete objects[id];
    };
    this.setraw = function (id, obj) {
        objects[id] = obj;
    };

    this.getobjex = function (id) {
        var obj = this.get(id);
        if (obj || !adapter || !adapter.namespace) return obj;
        id = id.substr(adapter.namespace.length+1);
        return objects[id];
    };
    this._getobjex = function(id) {
        return this.getobjex(id) || { val: undefined };
    };
    this.getval = function (id, _default) {
         var o = this.get(id);
         if (o && o.val !== undefined) return o.val;
         return _default;
    };

    this.invalidate = function (id) {
        this._getobjex(id).val = undefined;
    };
    this.setrawval = function (id, val) {
        this._getobjex(id).val = val;
    };

    this.getKeys = function (pattern) {
        var r = new RegExp(pattern2RegEx(pattern));
        var result = [];
        for (var id in objects) {
            if (r.test(id)) result.push(id);
        }
        return result;
    };

    this.foreach = function (pattern, callback) {
        var r = new RegExp(pattern2RegEx(pattern));
        for (var id in objects) {
            if (r.test(id)) {
                if (callback (id, objects[id]) === false) {
                    return { id: id, val: objects[id]};
                }
            }
        }
    };

    this.createObjectNotExists = function (id, obj, callback) {
        var val;
        var newobj = {
            type: 'state',
            common: {
                name: id,
                type: 'string',
                role: obj.type || 'state',
                //enumerable: true
                //writable: false
            },
            native: { }
        };
        _fullExtend(newobj, obj);

        if (obj['val'] !== undefined) {
            newobj.common.type = typeof obj.val;
            val = obj.val;
            delete newobj.val;
        }
        setObjectNotExists(id, newobj, function(err, o) {
            if (!err) {
                //that.states[newobj._id] = newobj;
                objects[newobj._id] = newobj;
                if (val !== undefined) {
                    that.setState(newobj._id, val, true)
                }
            }
            safeCallback(callback, err, o);
        });
    };

    this.setState = function (id, val, ack) {
        if (val !== undefined) objects[id].val = val;
        else val = objects[id].val;
        //ack = ack || true;
		if (ack === undefined) ack=true;
        setState(id, val, ack);
    };

    this.setStateEx = function (id, newObj, ack, callback) {
        if (typeof ack === 'function') {
            callback = ack;
            ack = true
        }
        if (typeof newObj !== 'object') {
            newObj = { val: newObj };
        }
        if (ack === undefined) ack = true;
        if (!that.has(id)) {
            that.createObjectNotExists(id, newObj, callback);
        } else {
            if (objects[id].val !== newObj.val) {
                that.setState(id, newObj.val, ack);
            }
            safeCallback(callback, 0);
        }
    };

    function val2obj(valOrObj, showName) {
        //if (valOrObj === null) return;
        //if (!valOrObj) return;
        if (typeof valOrObj === 'object') {
            var obj = valOrObj || {};
        } else {
            var obj = {};
            if (valOrObj !== undefined) {
                obj.val = valtype(valOrObj);
            }
        }
        if (showName && !hasProp(obj, 'common.name')) {
            //_fullExtend(obj, { common: { name: showName}});
            _setobjname(obj, showName);
        }
        return obj;
    }

    this.updateAsync = function (list, callback) {
        if (typeof list === 'function') {
            callback = list;
            list = null;
        }
        if (!list) {
            list = that.list;
            that.list = {};
        }
        if (!list) return callback(-1);
        if (Array.isArray(list)) {
            for (var i=0; i<list.length; i++) {
                var objName = Object.keys( list[i] )[ 0 ];
                this.setStateEx(objName, list[i][objName]);
            }
        } else {
            for (var id in list) {
                this.setStateEx(id, list[id]);
            }
        }
        safeCallback(callback, 0);
    };

    this.update = function (list, callback) {
        if (typeof list === 'function') {
            callback = list;
            list = null;
        }
        if (!list || that.list === list) {
            //list = that.list;
            //that.list = [];
            //if (that.root.list) that.root.list = that.list;
            list = that.list.slice();
            that.list.length = 0;
			
        }
        if (!list || list.length == 0) return safeCallback(callback, -1);

        forEachObjSync(list, function (obj, doit) {
                that.setStateEx(obj._id, obj, true, doit);
            },
            callback
        );
    };

    function _setobjname(o, name) {
        if (o['common'] === undefined) {
            o['common'] = { name: name};
        } else {
            o.common['name'] = name;
        }
    }

    this.setObjectName = function (id, name) {
        if (!objects[id] || !objects[id].common || !objects[id].common.name) {
            var o = {common: {name: ''} };
            if (!objects[id]) {
                objects[id] = {};
            }
            _setobjname(objects[id], '');
        }
        if (objects[id].common.name !== name) {
            adapter.getObject(id, {}, function (err, obj) {
                if (err || !obj) {
                    return;
                }
                if (obj.common.name !== name) {
                    obj.common.name = name;
                    adapter.setObject(id, obj);
                }
                objects[id].common.name = name;
            });
        }
    };

    this.readAllExistingObjects = function (callback) {
        adapter.getForeignStates(adapter.namespace + '.*', {}, function(err, states) {
            if (err || !states) return callback(-1);
            var namespacelen = adapter.namespace.length + 1;
            for (var fullId in states) {
                var id = fullId.substr(namespacelen),
                    as = id.split('.'),
                    s = as[0];
                for (var i=1; i<as.length; i++) {
                    //if (!that.has(s)) that.setraw(s, { exist: true });
                    //!!
                    if (!that.has(s)) that.setraw(s, {});
                    s += '.' + as[i];
                }
                that.setraw(id, { val: states[fullId] ? states[fullId].val : null});
            }

            function setObjectProperty(obj, names, val) {
                var dot = names.indexOf('.');
                if (dot > 0) {
                    var n = names.substr(0, dot-1);
                    if (obj[n] === undefined) {
                        obj[n] = {};
                    }
                    setObjectProperty(obj[n], names.substr(dot+1), val);
                }
                obj[names] = val;
            }

            function doIt(list) {
                for (var i = 0; i < list.length; i++) {
                    var id = list[i]._id.substr(namespacelen);
                    var o = {common: {name: list[i].common.name}};
                    if (!objects[id]) {
                        objects[id] = {};
                    };
                    if (list[i].native !== undefined) {
                        o['native'] = list[i].native;
                    }
                    fullExtend(objects[id], o);
                }
            }

            adapter.getDevices(function (err, devices) {
                doIt(devices);
                adapter.getChannels('', function (err, channels) {
                    doIt(channels);
                    safeCallback(callback, 0);
                });
            });
        });
    };


    this.CDevice = function CDevice (_name, showName, list) {
        //if (!(this instanceof that.CDevice)) {
        //    return new that.CDevice(_name, showName, list);
        //}

        var deviceName = '', channelName = '';
        var self = this;
        this.list = (list === undefined) ? that.list : list;

        function push (obj) {
            for (var i=0; i<self.list.length; i++) {
                if (self.list[i]._id === obj._id) {
                    return fullExtend(self.list[i], obj);
                }
            }
            self.list.push(obj);
            return obj;
        }

        this.setDevice = function (name, options) {
            channelName = "";
            if (!name) return;
            deviceName = normalizedName (name);
            var obj = { type: 'device', _id: deviceName };
            if (options) {
                Object.assign(obj, options);
            }
            return push(obj);
        };
        this.setDevice(_name, showName && typeof showName == 'string' ? {common: {name: showName}} : showName);

        this.setObjectName = function (id, showName) {
            for (var i=0; i<self.list.length; i++) {
                if (self.list[i]._id == id) {
                    _setobjname(self.list[i], showName);
                    return i;
                }
            }
            return -1;
        };

        this.setChannel = function (name, showNameOrObject) {
            if (name === undefined) channelName = "";
            else {
                channelName = name;
                var id = dcs(deviceName, channelName);
                if (!that.has(id)) {
                    if (typeof showNameOrObject == 'object') {
                        var obj = {type: 'channel', _id: id, common: {name: name} };
                        if (showNameOrObject.common) obj.common = showNameOrObject.common;
                        if (showNameOrObject.native) obj.native = showNameOrObject.native;
                    } else {
                        var obj = {type: 'channel', _id: id, common: {name: showNameOrObject || name}};
                    }
                    return push(obj);
                }
            }
        };
        this.setChannelEx = function (name, showNameOrObject) {
            if (name === undefined) channelName = "";
            else {
                channelName = normalizedName(name);
                var id = dcs(deviceName, channelName);
                if (!that.has(id)) {
                    if (typeof showNameOrObject == 'object') {
                        var obj = {type: 'channel', _id: id, common: {name: name} };
                        if (showNameOrObject.common) obj.common = showNameOrObject.common;
                        if (showNameOrObject.native) obj.native = showNameOrObject.native;
                    } else {
                        var obj = {type: 'channel', _id: id, common: {name: showNameOrObject || name}};
                    }
                    return push(obj);
                }
            }
        };

        function split(id, valOrObj, showName) {
            var ar = ((id && id[0] == '.') ? id.substr(1) : dcs(deviceName, channelName, id)).split('.');
            var dName = deviceName, cName = channelName;
            switch(ar.length) {
                case 3:
                    self.setDevice(ar.shift());
                case 2:
                    self.setChannel(ar.shift());
                default:
                    var ret = add (ar[0], valOrObj, showName);
                    deviceName = dName;
                    channelName = cName;
                    return ret;
            }
        }

        function add (name, valOrObj, showName) {
            //if (valOrObj === null) return;
            if (valOrObj == null) return;
            if (name.indexOf('.') >= 0) {
                return split(name, valOrObj, showName);
            }
            var obj = val2obj(valOrObj, showName || name);
            obj._id = dcs(deviceName, channelName, name);
            obj.type = 'state';
            return push(obj);
        }

        function __setVal(_id, newObj) {
            var val = newObj['val'] !== undefined ? newObj.val : newObj;
            if (objects[_id].val !== val) {
                that.setState(_id, val, true);
            }
        }

        this.dset = function(d,s,v,showName) {
            var _id = dcs(d, '', s);
            if (!objects[_id]) {
                return add ('.'+_id, v, showName);
            }
            __setVal(_id, v);
        };

        this.rset = function (id, newObj, showName) {
            return this.set('.' + id, newObj, showName);
        };

        this.set = function (id, newObj, showName) {
            if (newObj == undefined) return;
            var _id = dcs(deviceName, channelName, id);
            if (!objects[_id]) {
                return add (id, newObj, showName);
            }
            var val = newObj['val'] !== undefined ? newObj.val : newObj;
            if (objects[_id].val !== val) {
                that.setState(_id, val, true);
                return true;
            }
            return false; //objects[_id];
        };
        this.setex = function (id, newObj, showName) {
            if (adapter && id.substr(0, adapter.namespace.length) == adapter.namespace) {
                id = id.substr(adapter.namespace.length+1);
            }
            return this.set(id, newObj, showName);
        };

        this.getobjex = function (id) {
            var id = dcs(deviceName, channelName, id);
            return that.getobjex(id);
        };
        this._getobjex = function(id) {
            return this.getobjex(id) || { val: undefined };
        };
        this.invalidate = function (id) {
            this._getobjex(id).val = undefined;
        };
        this.setraw = function (id, val) {
            this._getobjex(id).val = val;
        };
        this.setName = function (name) {
            var id = dcs(deviceName, channelName, '');
            that.setObjectName(id, name);
        };

        this.add = this.set;
        this.getFullId = function (id) {
            return dcs(deviceName, channelName, id);
        };
        this.get = function(channel, id) {
            if (id == undefined) {
                var _id = dcs(deviceName, channelName, channel);
            } else {
                var _id = dcs(deviceName, channel, id);
            }
            return objects[_id]
        };
        this.createNew = function (id, newObj, showName) {
            if (this.get(id)) return;
            this.set(id, newObj, showName);
        };
        this.setAndUpdate = function (id, newObj) {
            this.set(id, newObj);
            this.update();
        };
        this.setImmediately = this.setAndUpdate;

        this.clear = function(id) {
            id = exports.ns.no (id);
            var st = that.getobjex(id);
            if (st === undefined) return;
            switch(typeof st.val) {
                case 'string': st = ''; break;
                case 'boolean': st = false; break;
                case 'number': st = 0; break;
                default: return;
            }
            this.setAndUpdate(id, st);
        };
		
        this.update = function (callback) {
            if (this.list.length > 0) {
                that.update(this.list, callback);
            } else {
                safeCallback(callback);
            }
        };

    };

    this.CState = this.CDevice;
    this.root = new this.CDevice('');
    this.init = function (_adapter, callback) {
        this.setAdapter(_adapter);
        exports.ns = CNamespace(_adapter);
        this.readAllExistingObjects(callback);
    };

    if (_adapter) {
        this.init(_adapter, _callback);
    }

    return this;
}
307491
function DeviceInfo (deviceIndex, deviceName, deviceType) {
    this.index = deviceIndex;
    this.name = deviceName;
    this.type = deviceType;
}
1325554
function DeviceInfo(deviceParams, additionalViewers) {
  this.viewer = Viewers.CardboardV2;
  this.updateDeviceParams(deviceParams);
  this.distortion = new Distortion(this.viewer.distortionCoefficients);
  for (var i = 0; i < additionalViewers.length; i++) {
    var viewer = additionalViewers[i];
    Viewers[viewer.id] = new CardboardViewer(viewer);
  }
}
1002204
function(setFocus) {
		var node = this.activeNode;
		if( node ) {
			this.activeNode = null; // Force re-activating
			node.setActive();
			if( setFocus ){
				node.setFocus();
			}
		}
	}
496960
function linkToCuratedDeviceEvents() {
        self.curatedDevice.on(
            'DEVICE_DISCONNECTED',
            curatedDeviceDisconnected
        );
        self.curatedDevice.on(
            'DEVICE_RECONNECTED',
            curatedDeviceReconnected
        );
        self.curatedDevice.on(
            'DEVICE_ERROR',
            curatedDeviceError
        );
        self.curatedDevice.on(
            'DEVICE_RECONNECTING',
            curatedDeviceReconnecting
        );
        self.curatedDevice.on(
            'DEVICE_ATTRIBUTES_CHANGED',
            cureatedDeviceAttributesChanged
        );
    }
964307
public void markActive(@NonNull String nodeName, boolean active) {
        ensureNodeStateExists(nodeName);

        states.get(nodeName).setActive(active);
    }