Skip to main content

Python module to communicate with SportIdent stations

Project description

SportIdent Reader
=================

Website: http://bosco.durcheinandertal.ch/
GIT Repository: http://git.durcheinandertal.ch/?p=sireader.git;a=summary

Usage
-----

There are 3 classes in the sireader module. **SIReader** is the base class
containing common functions. It's imported to have easy access to it's
constants. **SIReaderReadout** implements classical card readout.
**SIReaderControl** implements a station configured as control which
continuously sends punches.

from sireader import SIReader, SIReaderReadout, SIReaderControl


SIReader only supports the so called "Extended Protocol" mode. If your
base station is not in this mode you have to change the protocol mode
first::

# change to extended protocol mode
si.set_extended_protocol()

To use a SportIdent base station for card readout::

from time import sleep

# connect to base station, the station is automatically detected,
# if this does not work, give the path to the port as an argument
# see the pyserial documentation for further information.
si = SIReaderReadout()

# wait for a card to be inserted into the reader
while not si.poll_sicard():
sleep(1)

# some properties are now set
card_number = si.sicard
card_type = si.cardtype

# read out card data
card_data = si.read_sicard()

# beep
si.ack_sicard()

To use a base station as a control sending punches::

# configure station
si.set_operating_mode(SIReader.M_CONTROL)
si.set_station_code(99)
si.set_autosend()

# connect to station
si = SIReaderControl()

# poll for new punches
punches = si.poll_punch()

# reset station configuration
si.set_operating_mode(SIReader.M_READOUT)
si.set_autosend(False)

Finally set the station back to basic protocol::

# change back to basic protocl
si.set_extended_protocol(False)



API Documentation
-----------------

Complete documentation is contained in the module source code and can
be read online at:

http://bosco.durcheinandertal.ch/epydoc-sireader/

This documentation is autogenerated from the source code and
represents the version in the GIT repository.

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page