def __init__(
        self,
        event_queue,
        config_name,
        d0_pin,
        d1_pin,
        on_scan=None,
        queue_size=DEFAULT_QUEUE_SIZE,
        timeout_in_ms=DEFAULT_TIMEOUT_IN_MS,
    ):
        super(WiegandGPIOReader, self).__init__(event_queue, config_name,
                                                int(d0_pin), int(d1_pin))
        self._on_scan = on_scan
        # The limited-size queue protects from a slow leak in case of deadlock, so
        # we can detect and output something (just a print for now)
        self.bitqueue = queue.Queue(int(queue_size))
        self.timeout_in_seconds = float(timeout_in_ms) / 1000

        if self._on_scan:
            GPIO.add_event_detect(self.d0_pin,
                                  GPIO.FALLING,
                                  callback=self.decode)
            GPIO.add_event_detect(self.d1_pin,
                                  GPIO.FALLING,
                                  callback=self.decode)
Ejemplo n.º 2
0
  def __init__(self, event_queue, config_name, input_pin, output_pin, on_down=None):
    super(Button, self).__init__(event_queue, config_name, int(input_pin), int(output_pin))

    self._on_down = on_down
    self.blink_command_queue = Queue.Queue()
    self.blink_duration = 0.5  # seconds
    self.blinking = False
    if self._on_down:
      GPIO.add_event_detect(self.input_pin, GPIO.FALLING, callback=self._callback, bouncetime=150)
Ejemplo n.º 3
0
 def __init__(self, event_queue, config_name, d0_pin, d1_pin, on_scan=None):
   # presently, i've dropped bit_len as a parameter.  likely i'm going to
   # swap this around to make it so that you can pass a decoding format to
   # make it easier to work with different encoding schemes.
   super(WiegandGPIOReader, self).__init__(event_queue, config_name,
           int(d0_pin), int(d1_pin))
   self._on_scan = on_scan
   if self._on_scan:
       GPIO.add_event_detect(self.d0_pin, GPIO.FALLING, callback=self.decode)
       GPIO.add_event_detect(self.d1_pin, GPIO.FALLING, callback=self.decode)