Skip to content
A binding example for AGL
Branch: master
Clone or download
pmarzin Merge pull request #8 from pmarzin/master
test: Add test scripts to test hello binding
Latest commit b8b87c7 Apr 24, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
conf.d conf.d: Correct name of the required-api Apr 10, 2019
helloworld-skeleton Reorganization, new helloworld variant Dec 11, 2018
helloworld-subscribe-event binding: change api name Apr 23, 2019
nbproject Update For New App Template Aug 25, 2017
test test: Correct helloworld tests Apr 19, 2019
.gitignore Git ignore private files/dirs (starting by __*) Aug 25, 2017
CMakeLists.txt app-templates migration to cmake module Nov 6, 2018
LICENSE Initial commit Jun 7, 2017 readme: Update agl script name Apr 10, 2019


A binding example for AGL


Please follow this guide to add the AGL-Master repository to your distribution. In order to load these files into the current shell script, use the following command :

  • Debian/Ubuntu
source /etc/profile.d/

Then install the cmake module using your distribution package manager.

  • Debian/Ubuntu
sudo apt-get install agl-cmake-apps-module-bin
  • openSUSE
sudo zypper install agl-cmake-apps-module
  • Fedora
sudo dnf install agl-cmake-apps-module

Because the helloworld-service binding uses json, the following package has to be installed.

  • Debian/Ubuntu
sudo apt-get install libjson-c-dev
  • openSUSE
sudo zypper install libjson-c-dev
  • Fedora
sudo dnf install libjson-c-dev

Binder and client communicate through HTTP protocol :

  • Debian/Ubuntu
sudo apt-get install agl-libmicrohttpd-dev
  • openSUSE
sudo zypper install agl-libmicrohttpd-dev
  • Fedora
sudo dnf install agl-libmicrohttpd-dev


git clone --recursive
cd helloworld-service

Build for AGL

#setup your build environement
. /xdt/sdk/environment-setup-aarch64-agl-linux
#build your application
./conf.d/autobuild/agl/autobuild package

Build for 'native' Linux distros (Fedora, openSUSE, Debian, Ubuntu, ...)

./conf.d/autobuild/linux/autobuild package

You can also use binary package from OBS:



export YOUR_BOARD_IP=192.168.1.X
export APP_NAME=helloworld-service
scp build/${APP_NAME}.wgt root@${YOUR_BOARD_IP}:/tmp
ssh root@${YOUR_BOARD_IP} afm-util install /tmp/${APP_NAME}.wgt
APP_VERSION=$(ssh root@${YOUR_BOARD_IP} afm-util list | grep ${APP_NAME}@ | cut -d"\"" -f4| cut -d"@" -f2)
ssh root@${YOUR_BOARD_IP} afm-util start ${APP_NAME}@${APP_VERSION}



export YOUR_BOARD_IP=192.168.1.X
export PORT=8000
ssh root@${YOUR_BOARD_IP} afb-daemon --ws-client=unix:/run/user/0/apis/ws/helloworld --port=${PORT} --token='x' -v

#On an other terminal
ssh root@${YOUR_BOARD_IP} afb-client-demo -H${PORT}/api?token=x helloworld ping true
curl http://${YOUR_BOARD_IP}:${PORT}/api/helloworld/ping?token=x
#For a nice display
curl http://${YOUR_BOARD_IP}:${PORT}/api/helloworld/ping?token=x 2>/dev/null | python -m json.tool

Native Linux

For native build you need to have tools afb-daemon. You can build it by your self app-framework-binder, or use binary package from OBS:

export PORT=8000
afb-daemon --port=${PORT}  --ldpaths=/opt/AGL/helloworld-service/lib/

curl http://localhost:${PORT}/api/helloworld/ping
#For a nice display
curl http://localhost:${PORT}/api/helloworld/ping 2>/dev/null | python -m json.tool

Activate authentification security

To test auth just switch the line:

 static const struct afb_verb_v2 verbs[]= {
   /*Without security*/
-  { .verb = "ping"     , .session = AFB_SESSION_NONE, .callback = pingSample  , .auth = NULL},
+  /*{ .verb = "ping"     , .session = AFB_SESSION_NONE, .callback = pingSample  , .auth = NULL},*/
   /*With security "urn:AGL:permission:monitor:public:get"*/
-  /*{ .verb = "ping"     , .session = AFB_SESSION_NONE, .callback = pingSample  , .auth = &_afb_auths_v2_monitor[1]},*/
+  { .verb = "ping"     , .session = AFB_SESSION_NONE, .callback = pingSample  , .auth = &_afb_auths_v2_monitor[1]},

And rebuild your application

You can’t perform that action at this time.