Developing M2M apps with Lua
De!e"op#n$ M2M apps w#%h Lua Benjamin Cabé – Sierra Wireless
Developing M2M apps with Lua
� Wha% #s M2M?
Technology that supports wired or wireless communication between devices
Developing M2M apps with Lua
Communication Infrastructure
Smart Pill Box
Heartbeat Sensor
Weight Scale
Blood Pressure
Medical Services Gateway
Near field
Blood Sugar
In%e&ne% o' Th#n$s
Patient
Clinical Trial
Doctor
Developing M2M apps with Lua
Wha% #s Lua? • A programming language
• High Level
• Scripting
• Extensible
• Simple
• Efficient
• Portable
Developing M2M apps with Lua
Wha% #% #s no% • An acronym
• A replacement for C (C++)
• A that recent language (1993)
• Used only for games – Cisco, Adobe, Oracle, … – See: http://en.wikipedia.org/wiki/Lua_(programming_language)#Other
Developing M2M apps with Lua
Ex%ens#b"e • Small
– Trivial syntax and reduced keyword set
• Simple but not stupid – Simple enough for new user, powerful enough for
advanced users (first-class functions, garbage collection, closures, tail calls, coercion, coroutines)
• Lua core is tiny – Compiled size is ~150kB
– Lua uses libraries for its extensions
Developing M2M apps with Lua
Po&%ab"e • The exact same code runs on different targets
• Lua VM is written in pure C ANSI
Developing M2M apps with Lua
H#$h-"e!e" 'ea%u&e se% • Easy-to-use high level structures: strings, lists,
tables, sets, hash-tables
• Automatic memory management with garbage collector
• Proper error/exceptions management
Developing M2M apps with Lua
H#$h-"e!e" 'ea%u&e se% ((on%’d) • Easy user interaction and advanced tools
– console
– package manager, profilers, unit tests, …
• Shorter development cycles – write, load without rebooting, look at what
happens interactively, reload etc.
• Controlled execution model – Prevent pointer arithmetic and memory
management issues
– Graceful handling of incorrect arguments
Developing M2M apps with Lua
Lua !s. o%he& h#$h-"e!e" "an$ua$es • Same core features as Python, Ruby, Javascript
• Better concurrency management – Built-in – doesn’t rely on OS
• Cutting-edge execution technology & performances
• Restricted set of libraries – Stay simple, the developer brings his own
• Outstanding Lua/C integration – Performance
– Legacy
Developing M2M apps with Lua
Lua 'o& embedded and M2M • High-level languages usually trade hardware
resources for development & maintenance resources
• Transition fully embraced on PC and servers, not yet on embedded devices, largely due to a history of resource scarcity
Lua allows to reconcile high-level languages accomplishments with embedded constraints
Developing M2M apps with Lua
Lua app"#(a%#on '&amewo&) 'o& M2M • User application container, embedded runtime
• Set of libraries providing building blocks to develop user M2M applications: – Serial and I/O management,
– Networking (FTP, HTTP, E-mail clients),
– GPS,
– Cryptography,
– Modbus,
– Local storage,
– M2M server communication…
http://www.eclipse.org/mihini
Developing M2M apps with Lua
IDE 'o& Lua de!e"opmen% • Project structure
• Syntax coloring
• Content assist
• Code navigation
• Code formatting
• Documentation
• Code templates
• Debugger
• Remote development
June 2012: first release (0.8)
Dec. 2012: 0.9 release
June 2013: graduate w/ Kepler
20,000+ installations already!
Developing M2M apps with Lua
IDE 'o& M2M de!e"opmen% • We started working on Mihini support in
Koneki – Mihini execution environment for code assist
– Target Management for controlling the Application Container, accessing the logs, …
– Creation of software packages
Developing M2M apps with Lua
Lua 'o& end-use& app"#(a%#ons? • Many mobile development frameworks*
– Corona SDK**
– Gideros Mobile
– LÖVE2D
– etc.
* guess what? You can use Koneki LDT to develop for these frameworks!
** see http://youtu.be/XOlopalLKeU (« EclipseCon CoronaSDK »)
Developing M2M apps with Lua
Mo&e #n'o&ma%#on • M2M Portal
http://m2m.eclipse.org
• Koneki http://www.eclipse.org/koneki
• Mihini http://www.eclipse.org/mihini
Than) You!