Exemple #1
0
    def __init__(self, usb=True, bluetooth=True, limitToDevices=None):
        """Constructor.
		The keyword arguments initialize the detector in a particular state.
		On an initialized instance, these initial arguments can be overridden by calling L{_startBgScan} or L{rescan}.
		@param usb: Whether this instance should detect USB devices initially.
		@type usb: bool
		@param bluetooth: Whether this instance should detect Bluetooth devices initially.
		@type bluetooth: bool
		@param limitToDevices: Drivers to which detection should be limited initially.
			C{None} if no driver filtering should occur.
		"""
        self._BgScanApc = winKernel.PAPCFUNC(self._bgScan)
        self._btDevsLock = threading.Lock()
        self._btDevs = None
        core.post_windowMessageReceipt.register(self.handleWindowMessage)
        appModuleHandler.post_appSwitch.register(self.pollBluetoothDevices)
        self._stopEvent = threading.Event()
        self._queuedScanLock = threading.Lock()
        self._scanQueued = False
        self._detectUsb = usb
        self._detectBluetooth = bluetooth
        self._limitToDevices = limitToDevices
        self._runningApcLock = threading.Lock()
        # Perform initial scan.
        self._startBgScan(usb=usb,
                          bluetooth=bluetooth,
                          limitToDevices=limitToDevices)
Exemple #2
0
 def __init__(self):
     self._BgScanApc = winKernel.PAPCFUNC(self._bgScan)
     self._btDevsLock = threading.Lock()
     self._btDevs = None
     core.post_windowMessageReceipt.register(self.handleWindowMessage)
     appModuleHandler.post_appSwitch.register(self.pollBluetoothDevices)
     self._stopEvent = threading.Event()
     self._queuedScanLock = threading.Lock()
     self._scanQueued = False
     self._detectUsb = False
     self._detectBluetooth = False
     self._runningApcLock = threading.Lock()
     # Perform initial scan.
     self._startBgScan(usb=True, bluetooth=True)