AirVantage 1.0 to 2.0 Migration

AirVantage Connector 2.0 changes the way that the Legato AF connects to the AirVantage Cloud service.

Comparison of Changes

The following are a comparison of high level changes within AirVantage. For the complete description of the new AirVantage 2.0 features see AirVantage Connector API.

AVC 1.0 AVC 2.0
Asset model defined in .cdef Asset model defined in code on the fly
AssetData Resource paths are LWM2M standard formatted AssetData Resource paths are Unix Path Formatted
AssetData Permissions are write only AssetData Permissions are read/write allowing dynamic updates
Authentication Failures are retried immediately Authentication failures are retried 2s later
Device reconnects in 20s after a FOTA update No device reconnection, Apps can initiate the connection.
TimeSeries resources are part of AssetData TimeSeries resources can be used separate from Asset Data
TimeSeries data points can only be pushed one at a time TimeSeries can accommodate multiple data points pushed and acknowledge at one time

Migrating from AVC 1.0 to AVC 2.0

AVC 1.0 configurations are automatically migrated to AVC 2.0 when Legato AF 17.05+ is upgraded on your target.

To re-import AVC 1.0 configuration again (if there are any issues) then the re-import can be done by removing the file (/data/le_fs/avc/config/isImported).

# rm -rf /data/le_fs/avc/config/isImported

Asset Data Models

AirVantage 2.0 now supports dynamic asset data models, meaning that you no longer need to set the model in your control app's .cdef at build time. Now you are able to define and update the model dynamically at compile time. You can now create get or set jobs for your assets from the AirVantage server.

In AVC 2.0 system data (assets) are dynamically created/assigned on the fly and are identified by their unique resource paths (e.g., /myApp/Room/Kitchen/Temperature). (e.g., Calling the le_avdata_CreateResource(/myApp/Room/Kitchen/Temperature) will create a new asset.)

Note
the assets section in the .cdef file has been removed and assets can no longer be defined through the .cdef. To add asset data to the app model, the manifest.app must be hand edited.

Data Model

There is no longer a need to create a data model and the section has been removed from the .cdef. You are now able to call functions to work with variables, settings, and commands.

Command Arguments

In AVC 2.0 commands with arguments are able to be used, whereas we do not have such provision in AVC 1.0.

See AirVantage System and click on Applicative Command to find more details on sending commands from AirVantage.

Resource Paths

The resource paths are now formatted in the traditional *nix path standard, instead of the LWM2M standard.

AVC 1.0

le_${APP_NAME}.1000.0.0

AVC 2.0

/myApp/Room/Kitchen/Temperature

Time Series

TimeSeries provides the ability to collect an app data set periodically, store the data locally, and then send all data to the server based on a specified trigger event (e.g., collect driving behavior during a trip, and send all data only when the car is parked).

To use a TimeSeries you can push the changes within your App, TimeSeries no longer depends on the asset that were defined in the Component.cdef.

There is now no need to turn on the observe function before pushing TimeSeries data to the AirVantage Server.

Example of pushing data to the AirVantage server:

static void PushCallbackHandler
(
void* contextPtr
)
{
if (status == LE_AVDATA_SENT_SUCCESS)
{
// data pushed successfully
}
}
 
static void SendData()
{
struct timeval tv;
uint64_t utcMilliSec;
le_result_t result;
 
 
gettimeofday(&tv, NULL);
utcMilliSec = (uint64_t)(tv.tv_sec) * 1000 + (uint64_t)(tv.tv_usec) / 1000; // get current time
result = le_avdata_RecordFloat(recRef, "speed", 0.08, utcMilliSec);
 
if (result == LE_OK)
{
le_avdata_PushRecord(recRef, PushCallbackHandler, NULL);
}
 
}