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

◆ __init__()

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

◆ _cb()

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.

◆ cancel()

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

Definition at line 106 of file wiegand.py.

Member Data Documentation

◆ bit_timeout

wiegand.decoder.bit_timeout

Definition at line 52 of file wiegand.py.

◆ bits

wiegand.decoder.bits

Definition at line 74 of file wiegand.py.

◆ callback

wiegand.decoder.callback

Definition at line 50 of file wiegand.py.

◆ cb_0

wiegand.decoder.cb_0

Definition at line 62 of file wiegand.py.

◆ cb_1

wiegand.decoder.cb_1

Definition at line 63 of file wiegand.py.

◆ code_timeout

wiegand.decoder.code_timeout

Definition at line 78 of file wiegand.py.

◆ gpio_0

wiegand.decoder.gpio_0

Definition at line 47 of file wiegand.py.

◆ gpio_1

wiegand.decoder.gpio_1

Definition at line 48 of file wiegand.py.

◆ in_code

wiegand.decoder.in_code

Definition at line 54 of file wiegand.py.

◆ num

wiegand.decoder.num

Definition at line 75 of file wiegand.py.

◆ pi

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 Fri Aug 2 2024 09:40:57