Public Member Functions | Public Attributes | Private Member Functions | List of all members
wiegand.decoder Class Reference

Public Member Functions

def __init__ (self, pi, gpio_0, gpio_1, callback, bit_timeout=5)
 
def cancel (self)
 

Public Attributes

 bit_timeout
 
 bits
 
 callback
 
 cb_0
 
 cb_1
 
 code_timeout
 
 gpio_0
 
 gpio_1
 
 in_code
 
 num
 
 pi
 

Private Member Functions

def _cb (self, gpio, level, tick)
 

Detailed Description

A class to read Wiegand codes of an arbitrary length.

The code length and value are returned.

EXAMPLE

#!/usr/bin/env python

import time

import pigpio

import wiegand

def callback(bits, code):
   print("bits={} code={}".format(bits, code))

pi = pigpio.pi()

w = wiegand.decoder(pi, 14, 15, callback)

time.sleep(300)

w.cancel()

pi.stop()

Definition at line 5 of file wiegand.py.

Constructor & Destructor Documentation

def wiegand.decoder.__init__ (   self,
  pi,
  gpio_0,
  gpio_1,
  callback,
  bit_timeout = 5 
)
Instantiate with the pi, gpio for 0 (green wire), the gpio for 1
(white wire), the callback function, and the bit timeout in
milliseconds which indicates the end of a code.

The callback is passed the code length in bits and the value.

Definition at line 36 of file wiegand.py.

Member Function Documentation

def wiegand.decoder._cb (   self,
  gpio,
  level,
  tick 
)
private
Accumulate bits until both gpios 0 and 1 timeout.

Definition at line 65 of file wiegand.py.

def wiegand.decoder.cancel (   self)
Cancel the Wiegand decoder.

Definition at line 106 of file wiegand.py.

Member Data Documentation

wiegand.decoder.bit_timeout

Definition at line 52 of file wiegand.py.

wiegand.decoder.bits

Definition at line 74 of file wiegand.py.

wiegand.decoder.callback

Definition at line 50 of file wiegand.py.

wiegand.decoder.cb_0

Definition at line 62 of file wiegand.py.

wiegand.decoder.cb_1

Definition at line 63 of file wiegand.py.

wiegand.decoder.code_timeout

Definition at line 78 of file wiegand.py.

wiegand.decoder.gpio_0

Definition at line 47 of file wiegand.py.

wiegand.decoder.gpio_1

Definition at line 48 of file wiegand.py.

wiegand.decoder.in_code

Definition at line 54 of file wiegand.py.

wiegand.decoder.num

Definition at line 75 of file wiegand.py.

wiegand.decoder.pi

Definition at line 46 of file wiegand.py.


The documentation for this class was generated from the following file:


cob_hand_bridge
Author(s): Mathias Lüdtke
autogenerated on Tue Oct 20 2020 03:35:58