
A.1.2: Update an Installed Application
Rev 3 9/21/17
38
41110479
2.
Confirm that the environment was set correctly:
$ echo $LEGATO_ROOT
If a directory path appears, the command worked. If no value was returned, there was a problem with the
command—make sure that you entered the alias correctly, using the actual directory name that you used to
install Legato.
A.1.2 Update an Installed Application
As you saw when you set up your AirVantage account, one of the mangOH platform applications loaded on your
device in
Build and Install Legato Platform and mangOH Red Platform on Target on page 20
was
redSensorToCloud. This application reports sensor readings to the cloud (e.g. AirVantage) every two minutes.
In this section you will increase the reporting frequency of the redSensorToCloud application and install the new
version on the mangOH Red.
To update redSensorToCloud:
1.
On the dev machine, open a new terminal window.
2.
Configure the window for development:
$ cfglegato
3.
Change directory to the folder containing the application’s source code:
$ cd $MANGOH_ROOT/apps/RedSensorToCloud
4.
The source code components for this application are in two sub-folders—avPublisherComponent and
sensorsComponent. The code that controls the publishing frequency is in avPublisherComponent—change
directory to that folder:
$ cd avPublisherComponent
5.
Open and edit the source code (avPublisher.c) with your preferred editor—two values must be updated to
adjust the reporting frequency:
a.
Search for the variable declaration for MaxIntervalBetweenPublish.
static const int MaxIntervalBetweenPublish (120)
b.
Change the interval value to 30—This increases the reporting frequency to at least once every 30
seconds from once every 120 seconds.
c.
Search for the variable declaration for TimeToStale.
static const int TimeToStale (60)
d.
Change the stale value to 30—This decreases the length of time a sensor reading is considered to be
’current’ before a new sensor reading must be taken.
e.
Save your changes and exit the editor.
At this point, you have modified the redSensorToCloud application’s source code. Now you have to build (compile)
it.
Note:
You can also use the command "~/legato_framework/legato/bin/legs" to configure the terminal, but this starts a new
shell session—your command history and any environment variables you have set will be lost.
Power is OFF