从Axess TMC x3设备读取和解析消息的简单数据包。
axess的Python项目详细描述
axessy是一个从axess tmc x3设备读取和解析消息的简单包。
更改日志
- 0.4: Added gate error messages and events (directions); added system error messages
- 0.3: Fixed message() method
- 0.1: First release
安装
安装软件包有两种方法:
将pip与以下命令一起使用:
pip install axessy
从此存储库启动setup.py文件:
python setup.py install
用法
您可以通过以下方式导入模块:
import axessy.axessy
在这个包中,有一个用以下方法定义的“axesspackage”类:
- parsePacket(params): “params” includes the GET parameters sent via an “/online” or “/batch” command from the device, and stores the data inside the class variables;
- message(msg, beep=100, show=2): builds a string that you can put inside an HttpResponse to send back to the device;
- sendKeepAlive(url, username, password): asks the device to send a keepalive message.
还为“/batch”和“/keepalive”命令的字符串响应定义了“axesspackage().ack”和“axesspackage().keepalive”变量。
“parsePacket”方法定义并自动使用一个字典,其中包含保存到事务“axesspackage().error_dict”中的所有可能错误。
最后,“checkPacket()”方法使用了两个新的错误类(此方法由“parsePacket”自动使用):
- MacAddressError
- CardError