AdvanReader-m10 Java examples

DISCLAIMER OF LIABILITY

THE PROCEDURES AND SAMPLES IN THIS PAGE ARE PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND (EITHER EXPRESS OR IMPLIED), INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A SPECIFIC OR GENERAL PURPOSE AND THOSE ARISING BY STATUTE OR BY LAW, OR FROM A CAUSE OF DEALING OR USAGE OF TRADE.

THIS ALSO APPLIES TO THE CONSEQUENCES OF ANY ACTIONS TAKEN ON THE BASIS OF THE INFORMATION PROVIDED.

Introduction

We provide some examples in Java you can run to test AdvanReader-m1-10 and AdvanReader-m2-10. To check their features, please see the corresponding pages:

Requirements

    • Linux or Windows 10 OS (tested on Linux Mint 18.2 Cinnamon 64-bit)

    • Java (tested on version 1.8.0_162)

    • Eclipse IDE (tested on Oxygen)

Available examples

The following examples are available in the repository:

    • ADRD_M1_10Asynch

    • ADRDFastEncoding: Example with different encoding approaches:

* WRITE EPC

- Write incremental EPC with TID filter

- Write incremental EPC without TID filter

- Write random EPC with TID filter

- Write random EPC without TID filter

* MODIFY EPC

- Write 1 word to EPC bank with TID filter

- Write 1 word to EPC bank without TID filter

- Write 2 words to EPC bank with TID filter

- Write 2 words to EPC bank without TID filter

- Write 3 words to EPC bank with TID filter

- Write 3 words to EPC bank without TID filter

- Write 4 words to EPC bank with TID filter

- Write 4 words to EPC bank without TID filter

    • ADRDMQTTPublish

    • ADRDRabittMQPublish

How to run the examples

In order to run the examples provided, you can follow these steps:

1. Download the examples from the Downloads section

2. Connect the AdvanReader according to the provided section:

3. Detect which port the reader is using. By default, /dev/ttyUSB0 is used if not specified:

    • In Linux: similar to ttyUSB0. You can check all the devices using the command: ls /dev/

    • In windows: use the Device Manager from the Control Panel and look for the COM ports:

4. Open Eclipse and Open the project:

4.1. Go to File --> Open Projects from File System:

4.2. Click on Directory and Browse to find the project in your disk. Then, click on Finish

5. Specify the arguments of the program (libraries and usb port). To do so, add the run Configuration:

5.1. Click on the arrow next to the green button and then on Run Configurations

5.2. Double click on Java Application. Select a name (1), click on Browse (2) and find the project on your disk. Then, click on Search (3) to find the Main class of the example. In our case, we are going to test the "ADRD_M1_10Asynch example:

5.3. Click on Apply

5.4. Go to the Arguments tab and specify the port and the serial library. In our case, since we are using the ttyUSB0 Linux port, and the 64 bits architecture, the Program and VM arguments are as follows:

For Windows systems, the Program arguments will be similar to this:

eapi://COM10

Where COM10 must be changed for the port you are using (COM1, COM2)... more info available using the command "mode" on the terminal.

As for the VM arguments, will be similar to the following one (for Windows 64 bits):

-Djava.library.path=./native-lib/win-amd64

The Program and VM arguments will depend on the OS (Windows, Linux, Mac...) and architecture (32 or 64 bits).

To figure out which is the one suitable for you, take a look at the "readme.txt" available in the zip

6. Click on Run. The program should print the tags read on the console:

Troubleshooting

Error: Port not found

If you try to run the example, but you get an error like the one on the photo:

Then Open Eclipse IDE with Administrator privileges (as root). You can do it by using the console with sudo or using the command gksudo (you will have to specify the installation path)

Downloads

You can find our examples in our GitHub page: https://github.com/Keonn-Technologies/AdvanReader-10-Java-Examples