python模块与sportident主站通信

sireader的Python项目详细描述


sireader是一个python模块,用于与sportident主站通信 读取Sportident卡。sportident主要是一种电子冲孔系统 用于定向运动项目。

Sireader支持两种主要操作模式。可用于整张卡片 读出或在控制站模式下从控制装置发送冲头。第一种模式 通常用于在终点线后读取卡片数据 变成一个事件软件。第二种模式用于从 中间控制。

网站:http://bosco.durcheinandertal.ch/

git存储库:https://github.com/gaudenz/sireader/

用法

Sireader模块中有3个类。sireader是基类 包含共同功能的。它是进口的,便于使用 常数。sireaderread实现经典卡读出。 sireadercontrol实现配置为控件的工作站 不停地挥拳。

首先导入相关类:

from sireader import SIReader, SIReaderReadout, SIReaderControl

sireader只支持所谓的“扩展协议”模式。如果你的 基站不在此模式下,您必须更改协议模式 第一个:

# change to extended protocol mode
si.set_extended_protocol()

使用Sportident基站读取卡:

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()

使用基站作为控制发送穿孔:

# 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)

最后将站点设置回基本协议:

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

API文档

完整的文档包含在模块源代码中,可以 在线阅读:

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

此文档是从源代码和 表示Git存储库中的版本。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在java中的字符串字符下打印星号(*)   java在比较数据后得到错误的结果   java如何在使用JSP创建的网站中创建父子关系和处理?   java配置单元UDF:无法执行求值方法   java GAE项目Intellij远程调试在关闭时不释放端口   java按钮上的放大和缩小功能点击JfreeChart折线图?   java Selenium Chrome Web驱动程序SessionNotCreatedException   java由ADFactoryBuilder生成的线程工厂是线程安全的吗?   java将字符串[]传递给另一个类Android(使用intent)   我为什么要嘲笑java?   JavaLiferay门户不将对象从流程阶段发送到jsp   java我想在单击每个树节点时将要添加的信息放入jpanel jscrollpane中   在Java中模拟数组引用(即对引用的引用)的按引用传递   Jackson将JSON属性反序列化为不同的Java对象   java使用JSP/servlet在网页上显示Excel工作表?   仿射变换Java:使用仿射变换时游戏速度减慢   Servlet JBoss AS 7的java EJB注入   在Oracle数据库中使用Java的plsql   java管理Maven项目中的库依赖项   JavaEclipseLink(JPA)异常:复合主键@JoinColumn