configuration

Introduction

The samples defined here involve configuring devices and system wide settings.

    • Device definition files: device files are located in directory $ADVANNET/conf/META-INF/devices. Any file in that directory will be treaded as a device file

    • System configuration file: system configuration file is located at $ADVANNET/conf/META-INF/ directory and is named connectors.xml

$ADVANNET directory is usually located at

  • c:\Program files or c:\Program Files (x68)\AdvanNet-2.x.x (Windows systems)

Statically defined devices

Keonn devices implement a self-discovery feature that makes easy initial set-up and testing. However, in production systems it's advisable to configure devices statically from xml configuration files.

How device loading occurs?

  • Statically configured devices are loaded first. The directory $ADVANNET_HOME/conf/META-INF/devices is scanned, each file on that directory is considered to be a device file. Each device file defines a real device that is loaded.

  • Self-discovered devices are loaded as a second step in the start-up process.

How to create a configuration file?

  • Each Keonn device (e.g AdvanReader) has a device template file located under $ADVANNET_HOME/templates/devices

  • Copy the template for the device you want to configure and copy it to $ADVANNET_HOME/conf/META-INF/devices

  • Change the file name to something it makes sense to define your device.

  • Open the device file and adjust:

    • Device id: choose a unique id that identifies your device.

    • Device ip: IP of the device

    • Any other adjustment.

Repeat that same process for all devices you want to configure.

How to control the start-up of a device?

Once a device is loaded the system may decide whether to start it or wait until commands are received. A common scenario is to request a device to start operation immediately upon system start up. The following explains how to command AdvanNet to start device operation.

  • Make sure to have each device statically configured.

  • Open file $ADVANNET_HOME/conf/META-INF/connectors.xml

  • Locate a block of configuration (at the beginning of the file)

<DEVICE_MANAGER>

..

<device>...</device>

<device>...</device>

..

</DEVICE_MANAGER>

  • For each device add a configuration block <device> like this

<DEVICE_MANAGER>

..

<devices>

<device> <id>adrd@1</id> <class>DEFAULT_DEVICE_RUNTIME</class> <controllerMode> <class>CONTROLLER_MODE_ASYNCH</class> <startOnBoot>true</startOnBoot> <restartOnError>true</restartOnError> </controllerMode> </device>

...

</devices>

</DEVICE_MANAGER>

  • Make sure the id points to the same id defined in the device file.

  • When several systems are connected into the same network, the self-discovery may slow down device tracking and re-connection after network cuts. In those scenarios it's a good idea to disable self-discovery.

    • Open file $ADVANNET_HOME/conf/META-INF/connectors.xml

    • Make sure there is a configuration block like the following:

<DEVICE_DISCOVERER> <class>com.keonn.impl.device.discovery.AliasesFilesDeviceDiscoverer</class> <id>CONFIG_FILE</id> <slave> <class>LANTRONIX_DISCOVERER_V1</class> <doNotExecuteDiscovery>true</doNotExecuteDiscovery> </slave> </DEVICE_DISCOVERER>

  • Restart AdvanNet if it was running.

Change device ID

AdvanReader-100

Change the device ID is a two-step process:

  • Change device ID

    • Locate the device file: devices files are located under $ADVANNET/META-INF/devices/device-file.xml

    • Open file and change the tag <id> content. For example: <id>DEVICE_ID</id>

  • Change controller device ID:

    • Locate the connectors.xml file, it is located at: $ADVANNET/META-INF/connectors.xml

    • Locate the old device id in a block like

<device>

<id>adrd-m4-100</id>

...

    • Change the ID by the new device ID.

Change device power and sensitivity

  • Locate the device file: devices files are located under $ADVANNET/META-INF/devices/device-file.xml

  • Locate a configuration block that starts with <reader>

  • Add a tag (if not exists) <readPower>. Read power is expressed in dBm

  • Add a tag (if not exists) <sensitivity>. Read power is expressed in dBm

Change RFID band

  • Locate the device file: devices files are located under $ADVANNET/META-INF/devices/device-file.xml

  • Locate a configuration block that starts with <reader>

  • Add a tag (if not exists) <region>.

Valid region definitions are:

These are bands that may not conform to local regulations. Please ensure they meet all country regulations.

Change the Device IP

Only available to Readers or Systems based on Series 150 readers: AdvanReader-150, AdvanSafe-100, AdvanEAS-100, ...

To change the IP address of a device from the web interface:

  • Open a Web Browser (preferably Chrome or Chromium) at <DeviceIPaddress>:3161, connect to the device if it is not connected, and go to the "Network & Time" tab.

    • To set a Static IP select the method Static, and set an IP address, mask and gateway, considering that, if the IP address is out of the range of the PC running the Web Browser, the System will not be accessible by it.

    • To set a Dynamic IP select the method DHCP.

    • To apply the network configuration click in the "Apply Network config" button.

Remember to verify the reader responds at the new IP address. Under some conditions, the change may not be applied.

Export data

CSV files

Any Keonn device based on any AdvanReader can export data into a CSV files.

To enable and configure the export, follow the [STEPS] below:

  • [STEP] Make sure you are using AdvanNet-2.0.x release. Releases can be downloaded from here.

  • [STEP] Locate AdvanNet install directory $ADVAN_NET. In windows it is usually c:\Program files or c:\Program Files (x68)\AdvanNet-2.x.x

  • [STEP] Open connectors.xml configuration file from $ADVAN_NET/conf/META-INF

  • [STEP] Apply configuration samples that follow

CSV. One file per read cycle

This is appropriate for sequential operation mode.

  • [STEP] Inside connectors.xml, locate the <CSV> tag

  • [STEP] Replace the <CSV>....</CSV> by

<CSV>

<class>PROCESSOR_CSV_EXPORTER</class>

<instance.unique-id>PROCESSOR_CSV</instance.unique-id>

<method>process</method>

<enabled>true</enabled>

<csvFile>output_file.csv</csvFile>

<keepSameFile>false</keepSameFile>

<uniqueEPCPerFile>false</uniqueEPCPerFile>

</CSV>

(do not change properties in this color)

The above configuration will:

    • <csvFile>: controls where the CSV file will be created. This can be either a relative to the AdvanNet start directory or an absolute path. Examples are:

      • sample.csv: will create a file name sample in the $ADVANNET/bin directory

      • c:\csvs\sample.csv: will create a file name in the c: \csvs directory.

    • It will create an initial configuration file with a name similar to: output_file-XXXXXX-20140323-1246-21-config.csv

      • The XXXXXX is a random code that allows bounding a certain configuration with the real inventories.

    • It will create a new CSV file any time an inventory is finished. The name of each file will be similar to: output_file-XXXXXX-20140323-1247-24.csv

      • Inventory files that share the XXXXXX code with a configuration file, do use the same configuration.

This CSV configuration is mainly used in SEQUENTIAL mode

CSV. Reuse same file

This is appropriate for autonomous operation mode.

  • [STEP] Inside connectors.xml, locate the <CSV> tag

  • [STEP] Replace the <CVS>....</CSV> by

<CSV>

<class>PROCESSOR_CSV_EXPORTER</class>

<instance.unique-id>PROCESSOR_CSV</instance.unique-id>

<method>process</method>

<enabled>true</enabled>

<csvFile>simulator.csv</csvFile>

<keepSameFile>true</keepSameFile>

<cronSpec>*/1 * * * *</cronSpec>

<uniqueEPCPerFile>false</uniqueEPCPerFile>

</CSV>

(do not change properties in this color)

The above configuration will:

    • It will create CSV files at <csvFile> location. This can be either a relative to the AdvanNet start directory or an absolute path.

    • It will create an initial configuration file with a name similar to: output_file-XXXXXX-20140323-1246-21-config.csv

      • The XXXXXX is a random code that allows bounding a certain configuration with the real inventories.

    • It will append new data into the same CSV file.

CSV. Reuse same file for a given time amount before creating a new one.

This is appropriate for autonomous operation mode.

  • [STEP] Inside connectors.xml, locate the <CSV> tag

  • [STEP] Replace the <CVS>....</CSV> by

<CSV>

<class>PROCESSOR_CSV_EXPORTER</class>

<instance.unique-id>PROCESSOR_CSV</instance.unique-id>

<method>process</method>

<enabled>true</enabled>

<csvFile>simulator.csv</csvFile>

<keepSameFile>false</keepSameFile>

<cronSpec>*/1 * * * *</cronSpec>

<uniqueEPCPerFile>true/false</uniqueEPCPerFile>

</CSV>

(do not change properties in this color)

The above configuration will:

    • It will create CSV files at <csvFile> location. This can be either a relative to the AdvanNet start directory or an absolute path.

    • It will create an initial configuration file with a name similar to: output_file-XXXXXX-20140323-1246-21-config.csv

      • The XXXXXX is a random code that allows bounding a certain configuration with the real inventories.

    • If <uniqueEPCPerFile> is true, the same EPC ill only appear in one file only one time. Once the CSV is backed up, any EPC will be included.

    • It will append new data into the same CSV file.

    • Any time the cron definition triggers an event, the current CVS file will be backed up and a new file will be created.

MSSQL databases

Any Keonn device based on AdvanReader can export data into an SQL database. In particular there is pre-configured code for MicroSoft SQL Server.

To configure the SQL exporter

Make sure thCopy jtds-1.3.1.jar into $ADVAN_NET/lib

Connectors configuration

System wide configuration is defined in the file:

$ADVAN_NET/conf/META-INF/connectors.xml

In order to achieve a better integration level, some changes are required in that file:

  • [STEP] Open connectors.xml

  • [STEP] Modify DEVICE_CONTROLLER configuration block

Copy or modify the configuration block into connectors.xml

<DEVICE_CONTROLLER>

<class>com.keonn.device.impl.controller.AsynchDeviceController</class>

<messageInterval>10000</messageInterval>

<events>

<enable>true</enable>

<eventTypes>TAG_DIRECTION</eventTypes>

</events>

<processor>

<class>PROCESSOR_FILTER</class>

<!-- Whether the high level filter is enabled or not -->

<enabled>false</enabled>

<debug>false</debug>

<!-- regular expression used to filter tags based on their EPC. No matching tags are excluded -->

<regExpFilter>^.*3075.*</regExpFilter>

<slave>

<!--

Echo processor: prints on the standard output information about

the tags being read.

-->

<class>PROCESSOR_ECHO</class>

<debug>true</debug>

<verbose>false</verbose>

<encoding>gtin96</encoding>

<slave>

<class>INVENTORY_PROCESSOR</class>

<slave>

<class>MSSQL_EXPORTER</class>

</slave>

</slave>

</slave>

</processor>

</DEVICE_CONTROLLER>

This configuration block enables the SQL exporter and defines it as a MS SQL exporter.

  • [STEP] Configure connection settings by adding the configuration block

<MSSQL_EXPORTER>

<connString>jdbc:jtds:sqlserver://ip_or_hostname:1433/advannet</connString>

<user>username</user>

<password>password</password>

</MSSQL_EXPORTER>

Replace red tokens by its real values.

  • [STEP] Restart AdvanNet (if started)

Required steps are marked as [STEP]

MySQL

Any Keonn device based on AdvanReader can export data into an SQL database. This will be the procedure to connect AdvanNet with a MySQL database:

  1. If your device is AdvanReader-150/60, you will need to access the Linux board inside, ask our support team for guidance (support@keonn.com).

  2. Save the MySQL connector library in (Download it in the Download section):

      1. AdvanReader-100: ADVANNET_FOLDER/lib

      2. AdvanReader-150/60: /home/keonn/kernel/module/app.AdvanNet/lib

    1. Delete the persisted configuration, if any, until the following procedure is finished.

    2. To configure the connection between AdvanNet and MySQL database open the connectors.xml:

      1. Location:

        1. Location with AdvanReader-100: ADVANNET_FOLDER/conf/META-INF/

        2. Location with AdvanReader-150/60: /home/keonn/kernel/module/app.AdvanNet/META-INF/

      2. Modification, changing the connString, user and password, AdvanNet will create the necessary tables and will make insert queries for every tag read:

<SQL>

<class>GENERICSQL_EXPORTER</class>

<instance.unique-id>PROCESSOR_SQL</instance.unique-id>

<enabled>true</enabled>

<engine>

<class>MYSQL_EXPORTER</class>

<encoding>gtin96</encoding>

<debug>true</debug>

<connString>jdbc:mysql://localhost/advannet</connString>

<user>username</user>

<password>password</password>

<cleanDBCron>* * * * *</cleanDBCron>

<cleanDbSqls>

<cleanDbSql>

<class>SQL_STATEMENT</class>

<statement>DELETE from inventory where time &lt; (${now}-3600*24*10*1000)</statement>

</cleanDbSql>

<cleanDbSql>

<class>SQL_STATEMENT</class>

<statement>DELETE from events where time &lt; (${now}-3600*24*10*1000)</statement>

</cleanDbSql>

</cleanDbSqls>

</engine>

</SQL>

If it was necessary to change the insert queries, the MYSQL_EXPORTER can be changed:

<MYSQL_EXPORTER>

<class>PROCESSOR_SQL_EXPORTER</class>

<encoding></encoding>

<debug>false</debug>

<enabled>true</enabled>

<!-- odbc msaccess -->

<driverClass>com.mysql.jdbc.Driver</driverClass>

<dateFormat>yyyyMMdd-HHmm-ss</dateFormat>

<connString>jdbc:mysql://localhost/advannet</connString>

<user>user</user>

<password>password</password>

<initSqls>

<initSql>

<class>SQL_STATEMENT</class>

<statement>CREATE TABLE IF NOT EXISTS `advannet`.`inventory` (`id` bigint(20) NOT NULL AUTO_INCREMENT,`ip` varchar(128) DEFAULT NULL,`data_source` varchar(128) DEFAULT NULL,`epc_hex` varchar(128) DEFAULT NULL,`epc_decoded` varchar(128) DEFAULT NULL,`epc_serial` bigint(20) DEFAULT 0,`location` varchar(128) DEFAULT NULL,`location_id` varchar(128) DEFAULT NULL,`location_x` bigint(20) DEFAULT 0,`location_y` bigint(20) DEFAULT 0,`location_z` bigint(20) DEFAULT 0,`time` bigint DEFAULT 0,`date_time` timestamp NOT NULL,`reader_port` int(2) DEFAULT NULL,`mux1_port` int(2) DEFAULT NULL,`mux2_port` int(2) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1</statement>

<checkSql>show tables like 'inventory'</checkSql>

</initSql>

<initSql>

<class>SQL_STATEMENT</class>

<statement>CREATE TABLE IF NOT EXISTS `advannet`.`events` (`id` bigint(20) NOT NULL AUTO_INCREMENT,`ip` varchar(128) DEFAULT NULL,`data_source` varchar(128) DEFAULT NULL,`epc_hex` varchar(128) DEFAULT NULL,`epc_decoded` varchar(128) DEFAULT NULL,`epc_serial` bigint(20) DEFAULT 0,`time` bigint DEFAULT 0,`event` varchar(128) DEFAULT NULL,`event_param1` varchar(128) DEFAULT NULL,`event_param2` varchar(128) DEFAULT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1</statement>

<checkSql>show tables like 'events'</checkSql>

</initSql>

</initSqls>

<onReadSqls>

<onReadSql>

<class>SQL_STATEMENT</class>

<statement>INSERT into inventory (`id`,`ip`,`epc_hex`,`epc_decoded`,`epc_serial`,`data_source`,`time`,`date_time`,`location`,`location_id`,`location_x`,`location_y`,`location_z`,`reader_port`,`mux1_port`,`mux2_port`) values (0,?,?,?,?,?,?,FROM_UNIXTIME(?),?,?,?,?,?,?,?,?)</statement>

<paramsDef>

[{"type":"STRING","v":"${device_ip}"},{"type":"STRING","v":"${epc_hex}"},{"type":"STRING","v":"${epc_decoded}"},

{"type":"LONG","v":"${epc_serial}"},{"type":"STRING","v":"${data_source}"},{"type":"TIMESTAMP","v":"${time}"},

{"type":"TIMESTAMP","v":"${time}"},{"type":"STRING","v":"${location}"},{"type":"STRING","v":"${location_id}"},{"type":"LONG","v":"${location_x}"},

{"type":"LONG","v":"${location_y}"},{"type":"LONG","v":"${location_z}"},{"type":"INTEGER","v":"${reader_port}"},

{"type":"INTEGER","v":"${mux1_port}"},{"type":"INTEGER","v":"${mux1_por2}"}]

</paramsDef>

</onReadSql>

</onReadSqls>

<onEventSqls>

<onEventSql>

<class>SQL_STATEMENT</class>

<statement>INSERT into events (`id`,`ip`,`epc_hex`,`epc_decoded`,`epc_serial`,`data_source`,`time`,`event`,`event_param1`,`event_param2`) values (0,?,?,?,?,?,?,?,?,?)</statement>

<paramsDef>

[{"type":"STRING","v":"${device_ip}"},{"type":"STRING","v":"${epc_hex}"},{"type":"STRING","v":"${epc_decoded}"},

{"type":"LONG","v":"${epc_serial}"},{"type":"STRING","v":"${data_source}"},{"type":"TIMESTAMP","v":"${time}"},

{"type":"STRING","v":"${event}"},{"type":"STRING","v":"${event_param1}"},{"type":"STRING","v":"${event_param2}"}]

</paramsDef>

</onEventSql>

</onEventSqls>

</MYSQL_EXPORTER>

Download files

Find the User Guide and other downloadable content below.

For a direct download, use the small blue arrow