Sample Apps

The Legato team has included sample Apps to show examples of concepts and give code examples for you to follow to create your own Apps.

App Description
AirVantage Control App demonstrates using the AirVantage Service
AirVantage AssetData App demonstrates using Asset Data with AirVantage
Command Line App demonstrates an example of a sandboxing an App
eCall App demonstrates testing an eCall session
GPIO for CF3 App demonstrates using the GPIO service
GPIO for CF3 Selective Suspend App demonstrates using gpio to wakeup from selective suspend
GPS App demonstrates using GNSS for geocoding
Hello IPC App demonstrates host and target communications
Hello World App demonstrates starting Legato AF concepts
HTTP Get App demonstrates opening an data connection
HTTP Server App demonstrates how to create an HTTP server
Karaoke App demonstrates user interactivity
Legacy C App demonstrates steps to port Legacy C code to Legato
Low Power App demonstrates the Ultra Low Power Service
Modem Demo App demonstrates how to interact with the Modem Service
Shell Piping App demonstrates using tools within a sandbox
SMS App demonstrates using the SMS service
Voice Call App demonstrates using the voiceCallService
Firmware Update Downloader App demonstrates using the fwupdate service
Firmware Update Downloader with Resume App demonstrates using the fwupdate resume serivce
Stream Media App demonstrates audio streaming over IP interface
WiFi Access Point Test App App demonstrates the WiFi Access Point API
WiFi Client Sample App App demonstrates the WiFi Client API
WiFi Access Point Web Sample App App demonstrates configuring the target as a Wifi Access Point

All sample apps are located in $LEGATO_ROOT/apps/sample/. The built Apps are located in build/<target>/bin/samples.

Install and Start App

All of our sample Apps have an included make file that will assist in building and installing the app on a target.

To build a Sample App make sure that you have fully installed Legato AF on your dev machine. If you haven't already done it as part of the install process make sure that you have built Legato for your target device.

$ cd $LEGATO_ROOT
$ make <target>                         # e.g., make wp85

Next run bin/legs to set environment variables and open up a Legato customized shell.

$ cd $LEGATO_ROOT
$ bin/legs                              # legs stands for legato shell

Next to the directory of the sample app that you wish to install, most sample Apps are included in $LEGATO_ROOT/apps/sample/ <appName>. Sample Apps have a make file included with them that will configure the install file for your target. (e.g., Run make wp85 to build the sample app for a wp85xx device)

$ cd $LEGATO_ROOT/apps/sample/<appName>
$ make <target>                         # e.g., make wp85

Once that has successfully completed you will find an install package in the sample app directory called <appname>.<target>.update (e.g., helloWorld.wp85.update). You can now use the update tool to install the sample app on your target.

$ update <update file> <target ip>       # e.g., update helloWorld.wp85.update 192.168.2.2

Now the the App is installed you can start it on your target. SSH to your target device.

$ ssh <device ip>                       # e.g., ssh root@192.168.2.2

Start the App:

# app start <appName>                   # e.g., app start helloWorld

Viewing the Logs

If you wish to view the real time logs for the sample App:

Open 2 terminals to the target:

ssh root@192.168.2.2

In the 1st terminal (to continuously view the logs):

# logread -f | grep <appName>

In the 2nd terminal (to start the app):

# app status                            # check that <appName> is listed
# app start <appName>                   # e.g., app start helloWorld

In the 1st terminal you should see logging statements like:

# logread -f | grep "helloWorld"
<TIME> <target> user.info Legato:  INFO | supervisor[465]/supervisor T=main | app.c CreateTmpFs() 1204 | Mounted tmpfs at /legato/systems/current/appsWriteable/helloWorld/tmp.
<TIME> <target> user.info Legato:  INFO | supervisor[465]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/tmp/legato/serviceDirectoryServer' to '/legato/systems/current/appsWriteable/helloWorld/tmp/legato/serviceDirectoryServer'.
<TIME> <target> user.info Legato:  INFO | supervisor[465]/supervisor T=main | app.c CreateFileLink() 1504 | Created file link '/tmp/legato/serviceDirectoryClient' to '/legato/systems/current/appsWriteable/helloWorld/tmp/legato/serviceDirectoryClient'.
<TIME> <target> user.debug Legato:  DBUG | _UNKNOWN_[1518]/<invalid> T=main | _componentMain.c _helloWorldComponent_Init() 26 | Initializing helloWorldComponent component library.
<TIME> <target> user.info Legato:  INFO | helloWorld[1518]/helloWorldComponent T=main | helloWorldComponent.c _helloWorldComponent_COMPONENT_INIT() 5 | Hello, world.

Stop the App (if needed):

# app stop <app name> # e.g., app stop helloWorld

Run app help for options.