Scans the local network for TVs.
344296
def scan(self, stop_on_first=True, base_ip=0):
        """"""
        tvs = []

        # Check if base_ip has been passed
        if base_ip == 0:
            # Find IP address of computer pymitv is running on
            sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
            sock.connect(("8.8.8.8", 80))
            ip = sock.getsockname()[0]
            sock.close()

            # Get IP and compose a base like 192.168.1.xxx
            ip_parts = ip.split('.')
            base_ip = ip_parts[0] + '.' + ip_parts[1] + '.' + ip_parts[2]

        # Loop through every IP and check if TV is alive
        for ip_suffix in range(2, 256):
            ip_check = '{}.{}'.format(base_ip, ip_suffix)

            if self.check_ip(ip_check):
                tvs.append(ip_check)

                if stop_on_first:
                    break

        return tvs
394207
def connect_channels(self, channels):
        """"""
        self.log.info(f"Connecting to channels...")
        for chan in channels:
            chan.connect(self.sock)
            self.log.info(f"\t{chan.channel}")
324270
async def scan_for_devices_multi_run(self, runs=2):
        """"""
        run = 1
        master = {}
        while run < runs + 1:
            await self.scan_for_devices()
            await self.get_scan_result()
            if master is None:
                for device in self._devices:
                    mac = device['mac_address']
                    master[mac] = {}
                    master[mac]['rssi'] = device['rssi']
                    master[mac]['device_class'] = device['device_class']
                    master[mac]['name'] = device['name']
                    master[mac]['device_type'] = device['device_type']
                    master[mac]['count'] = 1
            else:
                for device in self._devices:
                    mac = device['mac_address']
                    if master.get(mac, False):
                        master[mac]['rssi'] = device['rssi']
                        master[mac]['count'] = str(1 + 1)
                    else:
                        master[mac] = {}
                        master[mac]['rssi'] = device['rssi']
                        master[mac]['device_class'] = device['device_class']
                        master[mac]['name'] = device['name']
                        master[mac]['device_type'] = device['device_type']
                        master[mac]['count'] = 1
            run = run + 1
            result = []
            for device in master:
                if int(master[device]['count']) > 1:
                    result.append(master[device])
        self._devices = result
1255138
def autoscan():
    
    for port in serial.tools.list_ports.comports():
        if is_micropython_usb_device(port):
            connect_serial(port[0])
1227743
def scan(self):
        """"""
        found = []
        for addr in range(0,0x80):
            try:
                self._i2c_bus.read_byte(addr)
            except OSError:
                continue
            found.append(addr)
        return found
17984
def check_channels!(integration)
      integration.channels.map(&:network).map(&:name).each do |network|
        find_network!(network)
      end
    end
362676
def _map_device_on_host_networks(provider_nets, devices):
    """"""
    networks = copy.deepcopy(provider_nets)
    for network in networks:
        for device in devices:
            network.setdefault('device', None)
            ip_set = IPSet([network['cidr']])
            if 'ipv4' not in device:
                continue
            ips = device['ipv4']
            if not isinstance(ips, list):
                ips = [ips]
            if len(ips) < 1:
                continue
            ip = IPAddress(ips[0]['address'])
            if ip in ip_set:
                network['device'] = device['device']
                continue
    return networks
294505
private function _network()
    {
        if (CommonFunctions::executeProgram('ifconfig', '', $bufr, PSI_DEBUG)) {
            $lines = preg_split("/\n/", $bufr, -1, PREG_SPLIT_NO_EMPTY);
            $was = false;
            $dev = null;
            foreach ($lines as $line) {
                if (preg_match("/^([^\s:]+)/", $line, $ar_buf)) {
                    if ($was) {
                        $this->sys->setNetDevices($dev);
                    }
                    $dev = new NetDevice();
                    $dev->setName($ar_buf[1]);
                    $was = true;
                } else {
                    if ($was) {
                        if (defined('PSI_SHOW_NETWORK_INFOS') && (PSI_SHOW_NETWORK_INFOS)) {
                            if (preg_match('/^\s+address:\s*(\S+)/i', $line, $ar_buf2)) {
                                if (!defined('PSI_HIDE_NETWORK_MACADDR') || !PSI_HIDE_NETWORK_MACADDR) $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').preg_replace('/:/', '-', strtoupper($ar_buf2[1])));
                            } elseif (preg_match('/^\s+inet\s+(\S+)\s+netmask/i', $line, $ar_buf2))
                                $dev->setInfo(($dev->getInfo()?$dev->getInfo().';':'').$ar_buf2[1]);

                        }
                    }
                }
            }
            if ($was) {
                $this->sys->setNetDevices($dev);
            }
        }
    }
1212777
function DetectWebOSTV()
   {
      if ((stripos($this->useragent, $this->deviceWebOStv) > -1)
			&& (stripos($this->useragent, $this->smartTV2) > -1))
         return $this->true; 
      else
         return $this->false; 
   }
1017435
public void scanDevices()
    {
        for (int deviceId : inputManager.getInputDeviceIds()) {
            addDevice(deviceId);
        }
        for (GVRGearCursorController controller : gearCursorControllers)
        {
            cache.put(CONTROLLER_CACHED_KEY + controller.getControllerID(), controller);
        }
    }
327659
def get_available_channels(header):
    """"""

    chlist_str = header['15_SECONDARY_PRODUCT_HEADER'][
        'SelectedBandIDs']['Value']
    retv = {}

    for idx, char in zip(range(12), chlist_str):
        retv[CHANNEL_NAMES[idx + 1]] = (char == 'X')

    return retv
71754
def broadcast(self):
        
        log.debug("Broadcasting M-SEARCH to %s:%s", self.mcast_ip, self.mcast_port)
        request = '\r\n'.join(("M-SEARCH * HTTP/1.1",
                               "HOST:{mcast_ip}:{mcast_port}",
                               "ST:upnp:rootdevice",
                               "MX:2",
                               'MAN:"ssdp:discover"',
                               "", "")).format(**self.__dict__)
        self.server.sendto(request.encode(), (self.mcast_ip, self.mcast_port))
23968
def detectTizenTV(self):
        
        return UAgentInfo.deviceTizen in self.__userAgent \
            and UAgentInfo.smartTV1 in self.__userAgent
940692
def request_cameras(blink, network):
    
    url = "{}/network/{}/cameras".format(blink.urls.base_url, network)
    return http_get(blink, url)
1016236
function scan () {
  rootInstances.length = 0
  let inFragment = false
  let currentFragment = null

  function processInstance (instance) {
    if (instance) {
      if (rootInstances.indexOf(instance.$root) === -1) {
        instance = instance.$root
      }
      if (instance._isFragment) {
        inFragment = true
        currentFragment = instance
      }

      // respect Vue.config.devtools option
      let baseVue = instance.constructor
      while (baseVue.super) {
        baseVue = baseVue.super
      }
      if (baseVue.config && baseVue.config.devtools) {
        // give a unique id to root instance so we can
        // 'namespace' its children
        if (typeof instance.__VUE_DEVTOOLS_ROOT_UID__ === 'undefined') {
          instance.__VUE_DEVTOOLS_ROOT_UID__ = ++rootUID
        }
        rootInstances.push(instance)
      }

      return true
    }
  }

  if (isBrowser) {
    walk(document, function (node) {
      if (inFragment) {
        if (node === currentFragment._fragmentEnd) {
          inFragment = false
          currentFragment = null
        }
        return true
      }
      let instance = node.__vue__

      return processInstance(instance)
    })
  } else {
    if (Array.isArray(target.__VUE_ROOT_INSTANCES__)) {
      target.__VUE_ROOT_INSTANCES__.map(processInstance)
    }
  }
  hook.emit('router:init')
  flush()
}
761250
def network_show(self, name):
        '''
        
        '''
        nt_ks = self.compute_conn
        net_list = nt_ks.networks.list()
        return self._network_show(name, net_list)
913356
public void scan() {

		WebcamDiscoveryListener[] listeners = Webcam.getDiscoveryListeners();

		List<WebcamDevice> tmpnew = driver.getDevices();
		List<WebcamDevice> tmpold = null;

		try {
			tmpold = getDevices(getWebcams(Long.MAX_VALUE, TimeUnit.MILLISECONDS));
		} catch (TimeoutException e) {
			throw new WebcamException(e);
		}

		// convert to linked list due to O(1) on remove operation on
		// iterator versus O(n) for the same operation in array list

		List<WebcamDevice> oldones = new LinkedList<WebcamDevice>(tmpold);
		List<WebcamDevice> newones = new LinkedList<WebcamDevice>(tmpnew);

		Iterator<WebcamDevice> oi = oldones.iterator();
		Iterator<WebcamDevice> ni = null;

		WebcamDevice od = null; // old device
		WebcamDevice nd = null; // new device

		// reduce lists

		while (oi.hasNext()) {

			od = oi.next();
			ni = newones.iterator();

			while (ni.hasNext()) {

				nd = ni.next();

				// remove both elements, if device name is the same, which
				// actually means that device is exactly the same

				if (nd.getName().equals(od.getName())) {
					ni.remove();
					oi.remove();
					break;
				}
			}
		}

		// if any left in old ones it means that devices has been removed
		if (oldones.size() > 0) {

			List<Webcam> notified = new ArrayList<Webcam>();

			for (WebcamDevice device : oldones) {
				for (Webcam webcam : webcams) {
					if (webcam.getDevice().getName().equals(device.getName())) {
						notified.add(webcam);
						break;
					}
				}
			}

			setCurrentWebcams(tmpnew);

			for (Webcam webcam : notified) {
				notifyWebcamGone(webcam, listeners);
				webcam.dispose();
			}
		}

		// if any left in new ones it means that devices has been added
		if (newones.size() > 0) {

			setCurrentWebcams(tmpnew);

			for (WebcamDevice device : newones) {
				for (Webcam webcam : webcams) {
					if (webcam.getDevice().getName().equals(device.getName())) {
						notifyWebcamFound(webcam, listeners);
						break;
					}
				}
			}
		}
	}