Note: Your user name is not your email address.
Your account is locked out! Please click here to unlock your account.
Your account is not activated yet. Please check your email and click on the activation link that was sent to you when you registered to our site. Did not received the activation email? Please click here to contact us.
Login failed, username or password is incorrect.
The ALEOS Application Framework provides the means to create embedded applications that run inside ALEOS devices. These embedded applications can interact with the ALEOS parameters and can access attached devices or assets. In the ALEOS AF, the AirVantage library provides access to the AV Application Services. These services provide the means to send data from the embedded application to the AV server, and from the server to the embedded application to set variable values on the device and send commands to be executed on the device. Data models are used to define the data types and the commands used in the interchange between the embedded application and the server.
The AirVantage library must be included in the application using the require feature. This makes the library functions available to the application.
local airvantage = require 'airvantage'
Then the library must be initialized using the init() function:
airvantage.init() -- Initialize the library
Next an asset instance of the library is created with the newAsset('id') function, where the id argument is a string.
myAsset = airvantage.newAsset('newassetid')
Next the newly created instance, myAsset, must be registered with the ReadyAgent using the start() function.
assert (myAsset:start(), 'Can't register the Agent')
In order to handle data and commands between the application and the server, a data model is required to define each variable or command. A data model is created using the Developer Studio for ALEOS. See the Developer Studio for ALEOS User Guide and the AirVantage ALEOS AF Tutorial for examples of using the IDE to create data models.
All data elements, either sent to the server or received from the server, are identified by a path in the asset's data tree. The root of the path is the application's asset instance. If the asset instance is created with the following:
The simplest way to send data to the server is to use the pushData function for sending "undeclared" data. There is no need to establish the path and name of a data element before using it in the pushData statement in the application. However, it is necessary for each data element and its path to be entered into the data model in order for the data elements to be utilized in the server. So, in a sense, the data elements are being declared in the data model. The pushData function has the following form:
myAsset:pushData (path, data, sendpolicy)
myAsset:pushData ('info', {x=1, y=2})
myAsset:pushData ('info.x', 1, 'now')
local uplinkData = {MessageCount=count, FloatingPoint=randomnumber, String=stringvalue, timestamp=os.time()} myAsset:pushdata ("uplink", uplinkData, "hourly")
myAsset:pushData ("", x=3)
Send policies determine when data will be sent to the server. Usually, there is a set of send policies that are included in the default configuration. These are:
Sending can be forced at any time with the triggerPolicy function. It has the form:
myAsset.triggerPolicy(policy)
Data sent from the server will be written into an asset's data tree under the designated path. If a function is found in the designated path, that function will handle the data, otherwise, the data element is written into the data tree. These functions in the data tree are called "data handlers".
Data handlers are functions that will handle the data sent by the server. The handler will handle all data elements in the path at its level and below it. For example, if a handler, handleDownLink is registered at:
myAsset.tree.downlink = handleDownLink
myAsset.tree.downlink.x1 myAsset.tree.downlink.next.y2
More typically, the handler will be at a single element:
myAsset.tree.downlink.x1 = Handle_x1
The handlers have the form:
local function Handle_x1 (assetInstance, value, path)
Individual data elements and handlers need to be registered in the asset's data tree before starting the asset. Note the order in the example below:
local airvantage = require 'airvantage' airvantage.init() -- Initialize the library myAsset = airvantage.newAsset('newassetid') -- Register the data path elements before starting the asset myAsset.tree.downlink = {} myAsset.tree.downlink.Var1 = var1CallBack -- where var1CallBack is a function myAsset:start()
Commands may be sent from the server to be executed in the application. Commands are simply functions installed on the special path myAsset.tree.commands where myAsset is the current asset instance. The commands functions have the same form as the handlers:
local function CommandX (assetInstance, value, path)
myAsset.tree.commands.DoSomething = DoSomethingCallBack myAsset:start()
This tutorial will guide you in creating an ALEOS AF application that leverages the AirVantage Application Services platform to transmit, receive and remotely store data.