summaryrefslogtreecommitdiffstats
path: root/doc/examples/mobile/lua_sms_receive.lua
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2017-12-27 10:51:32 +0800
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2017-12-27 10:51:32 +0800
commit96e5f8cbe57d55a274cfba1ac7f4961b29bab6fe (patch)
tree45450fcb4b27fccf0235c3a8c4bcb2f9a9d4fa56 /doc/examples/mobile/lua_sms_receive.lua
parentceb0875f1a2c90de826450f1de127450b62bcd9b (diff)
mobile: Add lua examples for basic functions that are available
Link to Lua docs, link to our manual. Demo logging, timer, MS on/off, sms sending and sms receiving. For the MM state I will need to export constants/names to make this usable. Currently it is a bit of a hack (first time to MM_IDLE) to send a SMS. We would know when we attached though. Change-Id: I10ac656330b65e3905d6cbbb7865aa0f969cd9ff
Diffstat (limited to 'doc/examples/mobile/lua_sms_receive.lua')
-rw-r--r--doc/examples/mobile/lua_sms_receive.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/examples/mobile/lua_sms_receive.lua b/doc/examples/mobile/lua_sms_receive.lua
new file mode 100644
index 00000000..4be4e0a5
--- /dev/null
+++ b/doc/examples/mobile/lua_sms_receive.lua
@@ -0,0 +1,15 @@
+-- See https://www.lua.org/manual/5.3/ for Lua
+-- See http://ftp.osmocom.org/docs/latest/osmocombb-usermanual.pdf -- Scripting with Lua
+
+function sms_cb(sms, cause, valid)
+ print("SMS data cb", sms, cause, valid)
+ for i, v in pairs(sms) do
+ print(i, v)
+ end
+end
+
+local cbs = {
+ Sms=sms_cb,
+}
+
+osmo.ms():register(cbs)