Packaging and Deployment

Applications must be packaged in Debian installer format (.deb) and deployed to execute on the readers.

Development and Testing of user applications

During development phase, developers can run and debug app from the SSH command line of the reader using rfidadm user.

  • Copy the app to /apps folder on the reader (e.g. scp sample.py rfidadm@ip-addr-of-reader:/apps/)

  • Login into to the reader over SSH as user rfidadm (no password needed).

  • Then run the app from command line. For e.g., for a Python application do

cd /apps
python3 sample.py

Packaging

Once applications are developed/tested to confirm its functional, it can be packaged for deployment to one or more readers. Use an Ubuntu Linux host PC for packaging the application into a Debian installer.

Important

Make sure dpkg-deb command line tool is available on the host.

Following is the procedure to create a package of an any application. This procedure assumes an application sample.py needs to be packaged for installation.

  • Create a any application. Example Python sample.py DA app.

  • Create a Start script namely ‘start_sample.sh’. Rename the ‘sample’ with actual name of the DA application.

    EXECUTABLE_NAME= sample
    python3 /apps/${EXECUTABLE_NAME}.py &
    
  • Create a Stop script namely ‘stop_sample.sh’. Rename the ‘sample’ with actual name of the DA application.

    EXECUTABLE_NAME= sample
    PID=`ps -C 'python3 /apps/${EXECUTABLE_NAME}.py' -o pid=`
    kill -9 $PID
    unset EXECUTABLE_NAME
    unset PID
    
  • Replace line EXECUTABLE_NAME= sample in start_sample.sh and stop_sample.sh with name of the DA application.

  • Create a control file with the below content in it.

    Package: sample
    Version: 1.0.1
    Source: base
    Priority: optional
    Architecture: all
    Maintainer: Zebra
    Description: "Sample DA application"
    APP_TYPE: DA
    
  • In a suitable folder on the Linux host PC (e.g. ~/projects/sample_1.0.1) keep the application file sample.py and the scripts created in above step, and an empty folder named DEBIAN for manifest.

    sample_1.0.1 (folder)
    ├── DEBIAN (folder)
    |   └──  control
    ├── sample.py
    ├── start_sample.sh
    ├── stop_sample.sh
    
  • From shell prompt issue command: dpkg-deb with –build and -Zgzip options, followed by the folder tree where python script, start/stop bash scripts and DEBIAN manifest folder are present.

    user@dev-host:~/projects$ dpkg-deb --build -Zgzip sample_1.0.1/
    
  • Output Debian package generated can then be used for reader deployment.

Deployment

Application may be deployed to the reader using one of the following methods:

Reader Administrative Web Console

  • Access reader using Reader Administrative Console and navigate to Applications page.

  • In Install New Package click Browse and select the Debian package to be installed and click Install.

    ../_images/user_apps_webconsole.png
  • After installation, click Start. If app needs to be run at startup, keep the AutoStart option enabled.

Using IoT connector API

IoT connector provides commands through which the userapps can be installed. The supported commands are listed in the table below and can be sent using the management interface.

IoT Connector commands for UserApp management

Command

Description

get_userapps

Gets the list of all installed UserApps

set_installUserapp

Installs the userapp.

set_uninstallUserapp

Uninstalls the app.

set_startUserapp

Starts the user app

set_stopUserapp

Stops the user app

set_autostartUserapp

Enables/disables the autostart flag on the user app.

Please refer to API documentation for details on usage of these APIs.