Home > HMS NETWORKS > HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide
HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide
CAN@net NT/CANbridge NT Lua ADK
Descripon of Ixxat Lua ADK
2. Descripon of Ixxat Lua ADK
The Ixxat Lua ADK is based on the standard Lua 5.3.5 disribuon, a fully featured implemenaon of Lua 5.3. The
implemenaon is opmized for embedded system development and execuon to provide a scripng framework
that can be used to deliver useful applicaons within the limited RAM and Flash memory resources of embedded
processors.
• All standard Lua language constructs and data types are working.
• Main Lua standard libraries core(partly), coroutine, string, math, debugand tableare
implemented.
• File handling uncons like require, dofile, and loadfileare missing. To be able to load other Lua
les, like json.lua and misc.lua, the syslibrary provides the dofileuncon that is similar to the original
uncons.
2.1. Dierence between Standard Lua and Ixxat Lua ADK
Lua is primarily an extension language that makes no assumpons about a main program. Lua works embedded
in a host applicaon to provide a powerful, lightweight scripng language for use within applicaons. The host
applicaon can invoke uncons to execute a piece of Lua code, can write and read Lua variables, and can
register C uncons to be called by Lua code. Through the use of C uncons, Lua can be augmented to cope
with a wide range of dieren domains, thus creang customized programming languages that share a synaccal
framework.
The Ixxat Lua ADK is a rmware extension and must be layered over the standard rmware. The hooks and
features of Lua enable the Ixxat Lua ADK to be seamlessly integrated without losing any of the standard Lua
language features. The rmware has replaced some standard Lua modules that do not align well with the
rmware. For example, the standard ioand oslibraries do not work, but are partly replaced by the libraries
can, mqtt, and sys. To write to the terminal window that is provided by the CAN-Gateway Conguraor the
uncon print(string)is used by default.
The main impacts of the Ixxat Lua ADK are how applicaon programmers must approach the developing and
structuring of their applicaons. The ADK is nonpreempve and event driven. Tasks can be associated with given
events by using the ADK API to registering callback uncons to the corresponding events. Events are queued
internally within the ADK, and then the associated tasks are called one at a me. Each task returns the control to
the ADK when run to compleon (nished successfully).
The ADK libraries act as C wrappers around registered Lua callback uncons to enable these to be used as ADK
tasks. Therefore an event-driven programming style must be used in wring Lua programs.
2.2. Lua Library Funcons Enabling the Regisraon of Lua Callbacks
The following library uncons dene or use callbacks:
• sys.call_after()in Lua module sys
• can.register_msg()in Lua module can
• mqtt.subscribe()in Lua module mqtt
For canthe standard Lua callback uncon on_canis used and for mqttthe standard Lua callback uncon
on_mqtt.
The libraries (can, sys, mqtt, etc.) use the ADK callback mechanism to bind Lua processing to individual events
(for example a CAN message recepon). Developers should make full use of these events to keep Lua execuon
sequences short.
For more inormaon see the module documenaon in Lua API Funcon and Module Reference, p. 9.
Page 2 of 20
4.02.0332.20002 Version 1.5
| General | Details |
|---|---|
| Name | HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide |
| Make | HMS NETWORKS |
| Language | English |
| Filetype | PDF (Download) |
| File size | MB |
If you have any questions regarding HMS NETWORKS CANbridge NT Lua ADK Bridge Router User Guide, please ask here and describe the problem in detail.













