This function is called when a device is detected, here we check if we found the device we are looking for.
490273
function onDeviceFound(device)
	{
		// For debugging, print advertisement data.
		//console.log(JSON.stringify(device.advertisementData))

		// Alternative way to identify the device by advertised service UUID.
		/*
		if (device.advertisementData.kCBAdvDataServiceUUIDs.indexOf(
			'0000aa10-0000-1000-8000-00805f9b34fb') > -1)
		{
			showMessage('Found the TI SensorTag!')
		}
		*/

		if (device.advertisementData.kCBAdvDataLocalName == 'CC2650 SensorTag')
		{
			showMessage('Found the TI SensorTag!')

			// Stop scanning.
			evothings.ble.stopScan()

			// Connect.
			connectToDevice(device)
		}
	}
1237531
function checkDeviceSupport(callback) {
            if (!canEnumerate) {
                if (callback) {
                    callback();
                }
                return;
            }

            if (!navigator.enumerateDevices && window.MediaStreamTrack && window.MediaStreamTrack.getSources) {
                navigator.enumerateDevices = window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack);
            }

            if (!navigator.enumerateDevices && navigator.enumerateDevices) {
                navigator.enumerateDevices = navigator.enumerateDevices.bind(navigator);
            }

            if (!navigator.enumerateDevices) {
                if (callback) {
                    callback();
                }
                return;
            }

            MediaDevices = [];

            audioInputDevices = [];
            audioOutputDevices = [];
            videoInputDevices = [];

            hasMicrophone = false;
            hasSpeakers = false;
            hasWebcam = false;

            isWebsiteHasMicrophonePermissions = false;
            isWebsiteHasWebcamPermissions = false;

            // to prevent duplication
            var alreadyUsedDevices = {};

            navigator.enumerateDevices(function(devices) {
                devices.forEach(function(_device) {
                    var device = {};
                    for (var d in _device) {
                        try {
                            if (typeof _device[d] !== 'function') {
                                device[d] = _device[d];
                            }
                        } catch (e) {}
                    }

                    if (alreadyUsedDevices[device.deviceId + device.label]) {
                        return;
                    }

                    // if it is MediaStreamTrack.getSources
                    if (device.kind === 'audio') {
                        device.kind = 'audioinput';
                    }

                    if (device.kind === 'video') {
                        device.kind = 'videoinput';
                    }

                    if (!device.deviceId) {
                        device.deviceId = device.id;
                    }

                    if (!device.id) {
                        device.id = device.deviceId;
                    }

                    if (!device.label) {
                        device.label = 'Please invoke getUserMedia once.';
                        if (typeof DetectRTC !== 'undefined' && DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && !/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
                            if (typeof document !== 'undefined' && typeof document.domain === 'string' && document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
                                device.label = 'HTTPs is required to get label of this ' + device.kind + ' device.';
                            }
                        }
                    } else {
                        if (device.kind === 'videoinput' && !isWebsiteHasWebcamPermissions) {
                            isWebsiteHasWebcamPermissions = true;
                        }

                        if (device.kind === 'audioinput' && !isWebsiteHasMicrophonePermissions) {
                            isWebsiteHasMicrophonePermissions = true;
                        }
                    }

                    if (device.kind === 'audioinput') {
                        hasMicrophone = true;

                        if (audioInputDevices.indexOf(device) === -1) {
                            audioInputDevices.push(device);
                        }
                    }

                    if (device.kind === 'audiooutput') {
                        hasSpeakers = true;

                        if (audioOutputDevices.indexOf(device) === -1) {
                            audioOutputDevices.push(device);
                        }
                    }

                    if (device.kind === 'videoinput') {
                        hasWebcam = true;

                        if (videoInputDevices.indexOf(device) === -1) {
                            videoInputDevices.push(device);
                        }
                    }

                    // there is no 'videoouput' in the spec.
                    MediaDevices.push(device);

                    alreadyUsedDevices[device.deviceId + device.label] = device;
                });

                if (typeof DetectRTC !== 'undefined') {
                    // to sync latest outputs
                    DetectRTC.MediaDevices = MediaDevices;
                    DetectRTC.hasMicrophone = hasMicrophone;
                    DetectRTC.hasSpeakers = hasSpeakers;
                    DetectRTC.hasWebcam = hasWebcam;

                    DetectRTC.isWebsiteHasWebcamPermissions = isWebsiteHasWebcamPermissions;
                    DetectRTC.isWebsiteHasMicrophonePermissions = isWebsiteHasMicrophonePermissions;

                    DetectRTC.audioInputDevices = audioInputDevices;
                    DetectRTC.audioOutputDevices = audioOutputDevices;
                    DetectRTC.videoInputDevices = videoInputDevices;
                }

                if (callback) {
                    callback();
                }
            });
        }
547027
def device(self, name):
        
        for device in self.devices():
            if device.name.lower() == name.lower():
                return device
        raise NotFound('Unable to find device %s' % name)
1148727
def detectSmartphone(self):
        
        return self.detectTierIphone() \
            or self.detectS60OssBrowser() \
            or self.detectSymbianOS() \
            or self.detectWindowsMobile() \
            or self.detectBlackBerry() \
            or self.detectMeegoPhone() \
            or self.detectPalmWebOS()
30723
async def lock(self, device):
        
        device = self._find_device(device)
        if not self.is_handleable(device) or not device.is_crypto:
            self._log.warn(_('not locking {0}: unhandled device', device))
            return False
        if not device.is_unlocked:
            self._log.info(_('not locking {0}: not unlocked', device))
            return True
        self._log.debug(_('locking {0}', device))
        await device.lock()
        self._log.info(_('locked {0}', device))
        return True
1258432
def exists(device=''):
    '''
    
    '''
    if os.path.exists(device):
        dev = os.stat(device).st_mode

        if stat.S_ISBLK(dev):
            return True

    return False
862168
def detect_mobile(view):
    """"""

    @wraps(view)
    def detected(request, *args, **kwargs):
        MobileDetectionMiddleware.process_request(request)
        return view(request, *args, **kwargs)
    detected.__doc__ = '%s\n[Wrapped by detect_mobile which detects if the request is from a phone]' % view.__doc__
    return detected
488436
def detectNintendo(self):
        
        return UAgentInfo.deviceNintendo in self.__userAgent \
            or UAgentInfo.deviceNintendo in self.__userAgent \
            or UAgentInfo.deviceNintendo in self.__userAgent
777948
public boolean detectNintendo() {

        if ((userAgent.indexOf(deviceNintendo) != -1)
            || (userAgent.indexOf(deviceWii) != -1)
            || (userAgent.indexOf(deviceNintendoDs) != -1)) {
            return true;
        }
        return false;
    }
831461
def _on_scan(_loop, adapter, _adapter_id, info, expiration_time):
    """"""

    info['validity_period'] = expiration_time
    adapter.notify_event_nowait(info.get('connection_string'), 'device_seen', info)
1373815
def has_saved(self, addr):
        """"""
        saved = False
        if self._saved_devices.get(addr, None) is not None:
            saved = True
        return saved
504841
function (successCallback, errorCallback) {

			// If the caller told us to stop scanning since our last scan, nothing to do
			if (!winble.deviceManager.isScanning)
				return;

			// We want to be notified when any device's connection status changes
			if (winble.deviceManager.connectionWatcher === null) {
				winble.deviceManager.startConnectionWatcher();
			}

			// We'll be looking for devices that support the Generic Access service, which most devices should support.
			var serviceName = "Generic Access";
			var serviceId = winble.gatt.GattServiceUuids.genericAccess;

			// Enumerate devices. This call returns a list of all paired bluetooth devices rather than a list of devices that
			// we can actually see, so once we get each device we need to figure out of it's actually "there" by attempting
			// to connect to it.
			winble.logger.logDebug("scanDevices", "Starting scan...");
			Windows.Devices.Enumeration.DeviceInformation.findAllAsync(
				winble.gatt.GattDeviceService.getDeviceSelectorFromUuid(serviceId), ["System.Devices.ContainerId"]).done(
				function (deviceList) {
					winble.logger.logDebug("scanDevices", "Completed scan (success)");

					// See if we found any connected devices that support the Generic Access service
					if (deviceList.length == 0) {
						var msg = "Could not find any " + serviceName + " devices";
						winble.logger.logError("scanDevices", msg);
						errorCallback(msg, { keepCallback: true });
						return;
					}

					// Add newly discovered devices to our list
					var reachableCount = 0;
					for (var i = 0; i < deviceList.length; i++) {

						// Add it to our device list if it's not already there
						var device = winble.deviceManager.getDeviceFromId(deviceList[i].id, "scanDevices", errorCallback);
						if (device == null) {
							winble.logger.logDebug("scanDevices", "Found new " + serviceName + " device '" + deviceList[i].name + "'");
							device = {
								"gattDevice": deviceList[i],
								"handle": winble.nextGattHandle++,
								"containerId": "{" + deviceList[i].properties["System.Devices.ContainerId"] + "}",
								"serviceList": {},
								"charList": {},
								"descList": {},
								"isBeingVerified": false,
								"isReachable": false,
								"isConnected": false,
								"isDeleted": false,
								"verifySkipCounter": 0,
								"rssi": winble.deviceManager.DEFAULT_RSSI,
								connectSuccessCallback: null
							};
							winble.deviceManager.deviceList[device.handle] = device;
						}

						// Add it to our reporting list if it's not already there
						if (winble.deviceManager.reportList.indexOf(device.handle) == -1)
							winble.deviceManager.reportList.push(device.handle);

						// Use this to write the "Reporting x devices" debug message below
						if (device.isReachable)
							reachableCount++;

						// Verify that the device is actually out there and reachable
						if (!device.isBeingVerified)
							winble.deviceManager.verifyDevice(winble.deviceManager.deviceList[device.handle]);
					}

					winble.logger.logDebug("scanDevices", "Reporting " + reachableCount + " devices");

					// Remove from our reporting list any previously discovered devices that were no longer present in this scan
					winble.deviceManager.cleanReportList();

					// Set up the next scan
					setTimeout(function () {
						winble.deviceManager.scanDevices(successCallback, errorCallback);
					}, winble.deviceManager.SCAN_INTERVAL);

					// Start reporting our devices back to the caller if we haven't already done so on a previous scan
					if (!winble.deviceManager.isReporting) {
						winble.deviceManager.isReporting = true;
						setTimeout(function () {
							winble.deviceManager.reportNextDevice(successCallback);
						}, 500);
					}
				},

				function (error) {
					winble.logger.logDebug("scanDevices", "Completed scan (error)");
					var msg = "Windows.Devices.Enumeration.DeviceInformation.findAllAsync failed: " + error;
					winble.logger.logError("scanDevices", msg);
					errorCallback(msg, { keepCallback: true });
				});
		}
89933
public boolean detectMobileQuick() {

        //Let's exclude tablets
        if (isTierTablet) {
            return false;
        }
        //Most mobile browsing is done on smartphones
        if (detectSmartphone()) {
            return true;
        }

        //Catch-all for many mobile devices
        if (userAgent.indexOf(mobile) != -1) {
            return true;
        }

        if (detectOperaMobile()) {
            return true;
        }

        //We also look for Kindle devices
        if (detectKindle() || detectAmazonSilk()) {
            return true;
        }

        if (detectWapWml() || detectMidpCapable() || detectBrewDevice()) {
            return true;
        }

        if ((userAgent.indexOf(engineNetfront) != -1) || (userAgent.indexOf(engineUpBrowser) != -1)) {
            return true;
        }

        return false;
    }
1051517
function (successCallback, errorCallback, deviceHandle) {

			// Find the requested device in our list of discovered devices
			var device = winble.deviceManager.getDeviceFromHandle(deviceHandle, "closeDevice", errorCallback);
			if (device == null)
				return;

			// Remove the device from our list
			winble.deviceManager.deviceList[deviceHandle] = null;
		}
754785
def probe_check(name, status, device_type):
    """"""
    status_string = PROBE_STATE.get(int(status), "unknown")

    if status_string == "ok":
        return ok, "{} '{}': {}".format(device_type, name, status_string)

    if status_string == "unknown":
        return unknown, "{} '{}': {}".format(device_type, name, status_string)

    return critical, "{} '{}': {}".format(device_type, name, status_string)
1023996
def IsDevice(self):
    
    if self._stat_object is None:
      self._stat_object = self._GetStat()
    if self._stat_object is not None:
      self.entry_type = self._stat_object.type
    return self.entry_type == definitions.FILE_ENTRY_TYPE_DEVICE
1212394
def trigger(self):
        
        ibsta = self._lib.ibtrg(self._device)
        self._check_status(ibsta)