When you configure and run Impinj Speedway Connect on-reader software, as described in Support Article: Speedway Connect System Configuration, data is output as tags are read by the reader or gateway. Here we describe the data format to enable you to develop your application to consume the data stream. Because of the portable nature of the data format, your code can be rewritten in virtually every modern programming language and development tool.
Impinj Speedway Connect outputs RAIN RFID data in two different formats, JSON or Key-Value Pair. As of Impinj Speedway Connect release 2.4.0, all three different operating modes are supported, namely, Inventory, Location, and Direction.
Depending on the output format and the operating mode, the data created by Impinj Speedway Connect will vary. To illustrate this, sample data was captured reading 3 tags with EPC's 999908290000000000000004, 999908290000000000000003, and 999908290000000000000001 by running an Impinj xArray RAID RFID gateway in each of the 3 operating modes.
In Location mode, confidenceData provides a list of key/values. Only the values for key=130 and key= 136 are used by applications. These applications calculate the location of a tag when read by multiple Impinj xArrays.
These data formats are common among all types of Impinj Speedway Connect output channels, namely, HTTP Post, TCP/IP socket, Serial, keyboard emulation, and USB Flash Drive.
Operating Mode | Output Data Format: JSON |
Output Data Format: Key-Value Pairs |
---|---|---|
Inventory (All Models) |
{"antennaPort":7, {"antennaPort":23, {"antennaPort":25, |
Format: <AntennaPort>,<EPC>,<TID>,<FirstSeenTImestamp>, Example: 44,999908290000000000000003, 34,999908290000000000000001, 19,999908290000000000000004, |
Location (xArray) |
{"epc":"999908290000000000000004", {"epc":"999908290000000000000001", {"epc":"999908290000000000000003", |
999908290000000000000004, 999908290000000000000001, 999908290000000000000003, |
Direction (xArray) - the 3 tags transitioned |
{"epc":"999908290000000000000004", {"epc":"999908290000000000000003", {"epc":"999908290000000000000001", |
999908290000000000000003, 999908290000000000000004, 999908290000000000000001, |
When sending data over HTTP, additional data is provided for the HTTP server to identify which reader or gateway is communicating with it.
JSON | Key-Value Pairs |
---|---|
{ "reader_name": "xarray-xx-xx-xx", "mac_address":"XX:XX:XX:XX:XX:XX", "tag_reads":[ <data stream described above> ]} |
The POST variables sent by Speedway Connect:
|
Testing the Output
Once Impinj Speedway Connect is configured and before developing your application, you will want to see the data as it is generated. Here are a few options to try when testing Impinj Speedway Connect and developing software to consume data.
1) TCP/Socket Output
The simplest method is to open a TCP/IP connection to the reader using an SSH program such as PuTTY.
Step 1) Make sure that in the Speedway Connect configuration page, under "Output: Connection" has the following setup. For how to access the Speedway Connect configuration page, see Support Article: Speedway Connect System Configuration. Also select the data output format: JSON or Key-Value Pairs.
Step 2) Start Impinj Speedway Connect and make sure that the "Status" string at the top is green after the "Apply" string is clicked.
Step 3) Connect to Impinj Speedway RAIN RFID readers or gateways using an SSH client program. Here we use PuTTY:
Step 4) Press the "Open" button to start the SSH session and now you should see the live data stream assuming that there are tags in the antenna's field of view.
2) HTTP Post in JSON Output Data Format
To examine the HTTP Post output sent from Impinj Speedway Connect, please try the following:
Step 1) In the Impinj Speedway Connect configuration page, under "Output : Connection", turn on the HTTP Post checkbox, and under "Output : Data", select the JSON output format.
"Output: Data" in the configuration page
Step 2) Use the following Python program to display the HTTP post data
You can view HTTP post traffic from Impinj Speedway Connect with a short python script.
1) Install Python 2.7 or greater
2) Install Flask by typing command: pip install Flask
3) Save this file shown below as PostServer.py
from flask import Flask, request app = Flask(__name__) @app.route('/connect', methods = ['POST', 'GET']) def message(): if request.method == 'POST': app.logger.info('Request received.') app.logger.info('Url: %s', request.url) app.logger.info('Data: %s', request.data) app.logger.info('Is JSON: %s', request.is_json) else: app.logger.info('GET request received.') return 'OK\n' if __name__ == '__main__': app.run(host='0.0.0.0', port='5000', debug=1)
PostServer.py
4) run command: python PostServer.py to see the HTTP post output.
Best Practices
- Make sure that the port (default 5000) accepts inbound traffic so adjusting the firewall on your computer may be necessary.
- The HTTP post interval (default 300 seconds) can be lowered to say 10 seconds so you will not have to wait very long for the data to appear.
3) Parsing Key Value Pair HTTP Post Data
This server-side php script parses the POST data and insert it into a relational database.
To output Key-Value Pairs data, remember to set the output format correctly in "Output : Data" in the Speedway Connect configuration page.
"Output : Data: in the Speedway Connect configuration page
Developing an Application
The most popular method today is to develop an application that receives HTTP posts in JSON format. This method is supported by all major programming languages and a wide variety of programming tools are available. Since HTTP post is a standard approach to sending data over the internet, Impinj Speedway Connect can post data up to a cloud application without the concern of being blocked by a firewall.
Comments
Article is closed for comments.