Embedded AdvanNet

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.

AdvanNet embedded development

Introduction

Series 150 and Series 60 run AdvanNet as an embedded service.

Most of its configuration can be done easily from the Manager web application. However, some advance configuration still requires access to the xml configuration files. Those files can be found in the embedded file system

Connect to the Device

Discover Device

To discover the device IP address, look into our wiki: Discover Devices. Once the device IP address is found, connect to the device.

Connect to the Device

Contact our Support Team to get the credentials to connect to the Device

Connect to the Device by SSH:

    • Linux: Open a terminal and use the following command:

ssh keonn@<ip-address> (for example ssh keonn@192.168.1.119)

      • Write the User provided by our Support Team:

      • Write the password provided by our Support Team (the password will not be shown while writing it):

Development life-cycle

Stop AdvanNet

Before attempting to perform any change, make sure to stop the running process. It will ask for the same password used to enter the device:

sudo killall java

After that, make sure no java process is still running. The following command

$ps ax | grep java

Will return something like

12635 pts/0 S+ 0:00 grep java

In case the java process does not stop normally. The above command returns

398 ? Sl 1937:42 /home/keonn/ejdk1.8.0/linux_arm_vfp_hflt/jre/bin/java -Dcom.thingmagic.DATETIME_PATCH=1 -DKERNEL_HOME=/home/keonn/kernel/bin/.. -Dsystemlog=0 -DLOG_LEVEL=info -Xms64M -Xmx160M -Dcom.keonn.system.defs=adrd-150-series -Dgnu.io.rxtx.SerialPorts=/dev/ttyO1 -Djava.library.path=/home/keonn/kernel/bin/../module/app.AdvanNet/native-lib/linux-arm -Dadvannet.nativelib.path=/home/keonn/kernel/bin/../module/app.AdvanNet/native-lib -Dnet.ihg.mutil.log.DummyLogger.dateTimeFormat=HH:mm:ss.SSS com.keonn.kernel.util.KernelStarter -d /home/keonn/kernel/bin/../module
12633 pts/0 S+ 0:00 grep java

it is possible to force its stop

sudo kill -9 398

(change 398 by Process ID of the AdvanNet process)

Make configuration changes

Make sure the system does not contain any persisted settings. As the changes done could be overridden by the persisted settings.

sudo rm -rf /root/.advannet/conf

Once the AdvanNet process is stopped, it's time to apply configuration changes. The most important files are:

/home/keonn/kernel/module/app.AdvanNet/META-INF/connectors.xml
/home/keonn/kernel/module/app.AdvanNet/META-INF/devices/device-file.xml

device-file changes depending on the device in use.

Its better to download the files using a FTP program like Filezilla or WinSCP, modify the files in a computer, and upload the files into the Keonn Device.

The AdvanNet page is a good start to learn what can be changed.

Copy new libraries (optional)

In case new AdvanNet libraries need to be copied, just transfer them to

/home/keonn/kernel/module/app.AdvanNet/lib

In case the AdvanNetRest..war is upgraded, also make sure the temporal folder is removes

rm -rf /home/keonn/tmp/AdvanNet-2.x.x

Start AdvanNet

Once changes are applied, it's time to start again AdvanNet

The recommendation is to start AdvanNet directly in the terminal:

cd /home/keonn/kernel

sudo bin/keonn-kernel.sh

AdvanNet can also be astarted as a service (in background):

sudo /etc/init.d/keonn-startup.sh start

Device ID change

A common need is to change the device ID.

The quick procedure below allows to change the device ID:

  • Make sure AdvanNet is stopped. Follow the chapter below.

  • Change the device ID

    • Open and change the tag <id> in file /home/keonn/kernel/module/app.AdvanNet/META-INF/devices/device-file.xml

    • Open and change the tag <id>, inside <DEVICE_MANAGER> block, in file /home/keonn/kernel/module/app.AdvanNet/META-INF/connectors.xml

  • Start AdvanNet again

Other

AdvanNet logs

AdvanNet logs work as follows:

    • AdvanNet logs are first created in /run/log/AdvanNet-kernel.log

    • Every 5 minutes a cron job appends the contents on the previous file into /home/keonn/logs/AdvanNet-kernel.log

    • Also every 5 minutes, the file /home/keonn/logs/AdvanNet-kernel.log is checked and logrotated if required.

The reason why logs are first created in /run/log/AdvanNet-kernel.log is to avoid write pressure on the disk. The directory /run is a ramfs disk file, so that log operations are initially persisted to RAM.