Continously scan for BLE advertisements.
350547
def run(self):
        """"""
        self.socket = self.bluez.hci_open_dev(self.bt_device_id)

        filtr = self.bluez.hci_filter_new()
        self.bluez.hci_filter_all_events(filtr)
        self.bluez.hci_filter_set_ptype(filtr, self.bluez.HCI_EVENT_PKT)
        self.socket.setsockopt(self.bluez.SOL_HCI, self.bluez.HCI_FILTER, filtr)

        self.set_scan_parameters()
        self.toggle_scan(True)

        while self.keep_going:
            pkt = self.socket.recv(255)
            event = to_int(pkt[1])
            subevent = to_int(pkt[3])
            if event == LE_META_EVENT and subevent == EVT_LE_ADVERTISING_REPORT:
                # we have an BLE advertisement
                self.process_packet(pkt)
        self.socket.close()
942956
def scan():
    '''
    
    '''
    ret = []
    devices = bluetooth.discover_devices(lookup_names=True)
    for device in devices:
        ret.append({device[0]: device[1]})
    return ret
744477
def _scan(positions):
    """"""
    scores = []
    for start in range(0, len(positions) - 17, 5):
        end = start = 17
        scores.add(_enrichment(positions[start:end], positions[:start], positions[end:]))
674189
def start_scan(self, active):
        """"""
        self._command_task.sync_command(['_start_scan', active])
        self.scanning = True
143203
function deviceFound(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.getName() == 'CC2650 SensorTag')
		{
			showMessage('Found the TI SensorTag!')

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

			// Connect.
			connectToDevice(device)
		}
	}
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
1096402
def scan(self, match="*", count=1000, cursor=0):
        
        cursor, data = self._client.sscan(
            self.key_prefix, cursor=cursor, match=match, count=count)
        return (cursor, set(map(self._loads, data)))
129345
def set_advertising(self, enabled):
        """"""
        if enabled:
            self.bable.set_advertising(
                enabled=True,
                uuids=[TileBusService.uuid],
                name="V_IOTile ",
                company_id=ArchManuID,
                advertising_data=self._advertisement(),
                scan_response=self._scan_response(),
                sync=True
            )
        else:
            try:
                self.bable.set_advertising(enabled=False, sync=True)
            except bable_interface.BaBLEException:
                # If advertising is already disabled
                pass
176576
def periodic_callback(self):
        

        if self.stopped:
            return

        # Check if we should start scanning again
        if not self.scanning and len(self.connections.get_connections()) == 0:
            self._logger.info("Restarting scan for devices")
            self.start_scan(self._active_scan)
            self._logger.info("Finished restarting scan for devices")
848886
def _advertisement(self):
        """"""
        # Flags are
        # bit 0: whether we have pending data
        # bit 1: whether we are in a low voltage state
        # bit 2: whether another user is connected
        # bit 3: whether we support robust reports
        # bit 4: whether we allow fast writes

        flags = int(self.device.pending_data) | (0 << 1) | (0 << 2) | (1 << 3) | (1 << 4)
        return struct.pack("<LH", self.device.iotile_id, flags)
867347
def _find_devices_mac(self):
        """"""
        self.keyboards.append(Keyboard(self))
        self.mice.append(MightyMouse(self))
        self.mice.append(Mouse(self))
327330
def process_notifications(self, messages):
        """"""
        for object_id, object_size, metadata_size in messages:
            if object_size > 0 and object_id in self._waiting_dict:
                linked_list = self._waiting_dict[object_id]
                self._complete_future(linked_list)
1142882
function (successCallback, errorCallback) {
			if (!winble.deviceManager.isScanning) {
				winble.deviceManager.scanSuccessCallback = successCallback;
				winble.deviceManager.scanErrorCallback = errorCallback;
				winble.deviceManager.isScanning = true;
				setTimeout(function () {
					winble.deviceManager.scanDevices(successCallback, errorCallback);
				}, 500);
			}
		}
1065905
def reqScannerSubscription(self, tickerId, subscription, scannerSubscriptionOptions):
        """"""
        return _swigibpy.EClientSocketBase_reqScannerSubscription(self, tickerId, subscription, scannerSubscriptionOptions)
705645
private boolean scan() {

        if (btAdapter.startLeScan(mCallback)) {
            mScanning = true;
            Log.i(TAG, "BLE scan started successfully");

            if (mHandler.postDelayed(scanTimeoutCallback, scanTimeout * 1000)) {
                Log.i(TAG, String.format("Cancelling discovery in %d seconds", scanTimeout));
            } else {
                Log.e(TAG, "Failed to schedule discovery complete callback!");
            }

            return true;
        } else {
            Log.i(TAG, "BLE scan failed!");
            return false;
        }
    }
1066196
function DetectTizen()
   {
      if ((stripos($this->useragent, $this->deviceTizen) > -1)
			&& (stripos($this->useragent, $this->mobile) > -1))
         return $this->true; 
      else
         return $this->false; 
   }
1085319
def _stop_scan(self):
        

        try:
            response = self._send_command(6, 4, [])
            if response.payload[0] != 0:
                # Error code 129 means we just were not currently scanning
                if response.payload[0] != 129:
                    self._logger.error('Error stopping scan for devices, error=%d', response.payload[0])

                return False, {'reason': "Could not stop scan for ble devices"}
        except InternalTimeoutError:
            return False, {'reason': "Timeout waiting for response"}
        except DeviceNotConfiguredError:
            return True, {'reason': "Device not connected (did you disconnect the dongle?"}

        return True, None