Coder Social home page Coder Social logo

rodriguesfas / sllurp-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sllurp/sllurp

0.0 1.0 0.0 6.09 MB

Python client for LLRP-based RFID readers

License: GNU General Public License v3.0

Shell 0.67% PowerShell 1.31% Python 97.81% Batchfile 0.20%

sllurp-1's Introduction

https://circleci.com/gh/ransford/sllurp.svg?style=svg

sllurp is a Python library to interface with RFID readers. It is a pure-Python implementation of the Low Level Reader Protocol (LLRP).

These readers are known to work well with sllurp, but it should be adaptable with not much effort to other LLRP-compatible readers:

  • Impinj Speedway (R1000)
  • Impinj Speedway Revolution (R220, R420)
  • Impinj Speedway xPortal
  • Motorola MC9190-Z (handheld)

File an issue on GitHub if you would like help getting another kind of reader to work.

sllurp is distributed under version 3 of the GNU General Public License. See LICENSE.txt for details.

Quick Start

Install from PyPI:

$ virtualenv .venv
$ source .venv/bin/activate
$ pip install sllurp
$ sllurp inventory ip.add.re.ss

Run sllurp --help and sllurp inventory --help to see options.

Or install from GitHub:

$ git clone https://github.com/ransford/sllurp.git
$ cd sllurp
$ virtualenv .venv
$ source .venv/bin/activate
$ pip install .
$ sllurp inventory ip.add.re.ss

If the reader gets into a funny state because you're debugging against it (e.g., if your program or sllurp has crashed), you can set it back to an idle state by running sllurp reset ip.add.re.ss.

Reader API

sllurp relies on Twisted for network interaction with the reader. To make a connection, create an LLRPClientFactory and hand it to Twisted:

# Minimal example; see inventory.py for more.
from sllurp import llrp
from twisted.internet import reactor
import logging
logging.getLogger().setLevel(logging.INFO)

def cb (tagReport):
    tags = tagReport.msgdict['RO_ACCESS_REPORT']['TagReportData']
    print 'tags:', tags

factory = llrp.LLRPClientFactory()
factory.addTagReportCallback(cb)
reactor.connectTCP('myreader', llrp.LLRP_PORT, factory)
reactor.run()

Getting More Information From Tag Reports

When initializing LLRPClientFactory, set flags in the tag_content_selector dictionary argument:

llrp.LLRPClientFactory(tag_content_selector={
    'EnableROSpecID': False,
    'EnableSpecIndex': False,
    'EnableInventoryParameterSpecID': False,
    'EnableAntennaID': True,
    'EnableChannelIndex': False,
    'EnablePeakRSSI': True,
    'EnableFirstSeenTimestamp': False,
    'EnableLastSeenTimestamp': True,
    'EnableTagSeenCount': True,
    'EnableAccessSpecID': False,
}, ...)

Logging

sllurp logs under the name sllurp, so if you wish to log its output, you can do this the application that imports sllurp:

sllurp_logger = logging.getLogger('sllurp')
sllurp_logger.setLevel(logging.DEBUG)
sllurp_logger.setHandler(logging.FileHandler('sllurp.log'))
# or .setHandler(logging.StreamHandler()) to log to stderr...

Vendor Extensions

sllurp has limited support for vendor extensions through LLRP's custom message facilities. For example, sllurp inventory --impinj-search-mode N allows you to set the Impinj search mode to single target (1) or dual target (2).

Handy Reader Commands

To see what inventory settings an Impinj reader is currently using (i.e., to fetch the current ROSpec), ssh to the reader and

> show rfid llrp rospec 0

The "nuclear option" for resetting a reader is:

> reboot

If You Find a Bug

Start an issue on GitHub! Please follow Simon Tatham's guide on writing good bug reports.

Bug reports are most useful when they're accompanied by verbose error messages. Turn sllurp's log level up to DEBUG, which you can do by specifying the -d command-line option to sllurp. You can log to a logfile with the -l [filename] option. Or simply put this at the beginning of your own code:

import logging
logging.getLogger('sllurp').setLevel(logging.DEBUG)

Known Issues

Reader mode selection is confusing, not least because most readers seem to conflate ModeIndex and ModeIdentifier. If you're using sllurp inventory, use --mode-identifier N. Check your reader's manual to see what mode identifiers it supports via the C1G2RFControl parameter, or run sllurp --debug inventory against a reader to see a dump of the supported modes in the capabilities description.

Contributing

Want to contribute? Here are some areas that need improvement:

  • Encode more protocol messages in the construct branch.
  • Write tests for common encoding and decoding tasks.

Authors

Much of the code in sllurp is by Ben Ransford, although it began its life in August 2013 as a fork of LLRPyC. Many fine citizens of GitHub have contributed code to sllurp since the fork.

sllurp-1's People

Contributors

ransford avatar thijmenketel avatar fviard avatar jonasgroeger avatar lqf96 avatar ivarveen avatar sheeley avatar reingart avatar ewfuentes avatar ukrutt avatar daemacles avatar fifieldt avatar jettan avatar nhlien93 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.