# Edge Apps

# Summary

An Edge app is a LUA (opens new window) application that can be pushed to the users' gateway together with some configuration options for that app. Apps can have a multitude of properties, and some values from Lynx are automatically injected into the LUA environment. Apps are managed using the Edge-App portal or API:s.

# Architecture

All programs on the Gateway is run inside of the IoT Open Runtime (iotopen-rt). The runtime handles authentication of the gateway to API:s and on MQTT. The program managing the Edge-apps is called edged.

The edged program consists of several layers. The daemon itself handles fetching of configurations, updating the apps version and doing callbacks into the running environment of the app. Each app is started inside of an abstraction layer with a socket connection to the daemon. The socket is used for RPC communication from the daemon. The edged software also downloads the executable code and injects the user configuration into the environment.

fig1

# Callbacks

The following methods will be called inside of the app-runtime if defined.

Method Description When
onFunctionsUpdated Normally used to register new functions for inclusion in app or remove functions that are no longer relevant. If a function is changed/added/removed.
onStart Set up application with initial parameters and state At every start of app.
onCreate App needs to change something when created, fetch more info or write files to the system. First run of app (after onStart).
onDestroy Handle cleanup and unregister all resources. App is removed.
onExit Can be used to save the state. When asked to exit.

# Available packages

Most of the standard Lua packages are built into iotopen-rt. The following packages have been added to provide more functionality.

Package name Description Link
lynx Wrapper functions for API calls. More
timer Provide time based operations More
json JSON handling More
mq MQTT Connectivity More
log Logging helpers More
edge Helper functions for Edge compute More
cfg All parameters set by the user in when configuring the app
functions An updated list of all available functions on this installation
app Information of the current app