Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Bar code / RFID interface for InOut

Project description

InOut Scan

Draft for the command deamon that reads bar codes from the serial port and forwards them to an API.

Usage: inout_scan [OPTIONS] COMMAND [ARGS]...

  Gather bar codes from a scanner connected to the serial port and pass them
  to the InOut API. A local cache is maintained to be able to handle
  communication problems. Use the flush command to communicate unsubmitted
  bar codes.

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  flush  Flush unsubmitted data to the api
  scan   Listen for strings from a barcode scanner connected to the...

Scan

Usage: inout_scan scan [OPTIONS]

  Listen for strings from a barcode scanner connected to the (virtual)
  serial port and make an API call to InOut for each scanned code.

Options:
  --serial_port TEXT   Serial port device that the barcode scanner is
                       connected to.  [default: /dev/ttyACM0]
  --baud_rate INTEGER  Serial baud rate of the bar code scanner.  [default:
                       9600]
  --api_url TEXT       InOut API url.  [required]
  --api_key TEXT       InOut API key.
  --scanner TEXT       Unique scanner name, ie: "reception1".  [required]
  --help               Show this message and exit.

Flush

Usage: inout_scan flush [OPTIONS]

  Flush unsubmitted data to the api

Options:
  --api_url TEXT  InOut API url.  [required]
  --api_key TEXT  InOut API key.
  --help          Show this message and exit.

Testing without a bar code scanner

To test the software without a bar code connected, use a virtual bar code scanner. This can be done by using socat:

$ socat  -d -d  PTY PTY
2020/05/15 10:44:48 socat[47219] N PTY is /dev/pts/3
2020/05/15 10:44:48 socat[47219] N PTY is /dev/pts/4
2020/05/15 10:44:48 socat[47219] N starting data transfer loop with FDs [5,5] and [7,7]

It will output the pseudoterminal names. Leave it running.

In another terminal, run inout_scan:

$ inout_scan scan --serial_port /dev/pts/4  --api_url 'https://inout.example.com' --scanner fake_scanner

Now, send strings to the other end of the tunnel /dev/pts/3, ie:

$ seq 1 1000 | while read nr; do echo "mybadge$nr" > /dev/pts/3; sleep 1 ;done

History

0.1.0 (2020-05-13)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for inout-scan, version 0.2.2
Filename, size File type Python version Upload date Hashes
Filename, size inout_scan-0.2.2-py2.py3-none-any.whl (6.7 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size inout_scan-0.2.2.tar.gz (10.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page