State of primitives and lua bindings

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/baseband-devel@lists.osmocom.org/.

Holger Freyther holger at freyther.de
Wed Nov 29 16:04:27 UTC 2017


Hey,

I think I have the minimal patchset to add primitives and lua
bindings to have useful functionality and know what is good/bad
with it and extend/iterate it from here. I would like to share
the state and what's next. On the higher level we have:

* Primitive for timers
* Primitives OP_IND for started/shutdown handling
* Primitives OP_IND for SMS status and RX SMS
* Primitives OP_IND for Mobility Management state changes


Next steps:

* Pack MNCC and enable/handle voice calls as well to do
call control.



What needs to change in future iterations:

* SMS, MM, started/shutdown indications should be async.
Especially for MM handling that will do further state changes
from within the new_mm_state. So if we enable/disable the MS
within this callback we ask for trouble.

* The lua scripting code is calling some routines directly. E.g.
for a "simple" SMS sending routine, to query state. This should
probably be converted to primitives as well. But that can be done
while keeping the lua API (e.g. with continuations or cache the
MS status).

* Finish the OsmocomBB manual documentation for the API

* Bikeshed. Number vs. Bool... ;)



Bugs found by scripting:

* I found an ASAN issue in mobile (fix pending)
* Noticed paging with outdated TMSI on NITB
* Trying to encode an alphabetic phone number causes issue in
libosmocore (bug report pending)


cheers

	holger




Examples:

# Print through logging framework
print("Hello from Lua");
log_notice("Notice from lua");
log_debug("Debug from Lua");
log_error("Error from Lua");
log_fatal("Fatal from Lua");

# Start a timer... and cancel it. Notice the ':'
local timer = osmo.timeout(1000, function()
	print("After timeout!!!")
end)
timer:cancel()

# Access a osmo.ms() singleton table/object
print("MS", type(osmo.ms()));
osmo.ms():imsi()
osmo.ms():imei()
osmo.ms():shutdown_state()
osmo.ms():started()
osmo.ms():sms_send_simple("1234", "21321324", "fooooooo", 23)

osmo.ms():start()
osmo.ms():shutdown(force)

# Callbacks...
function ms_started_cb(started)
end

function ms_shutdown_cb(old_state, new_state)
end

function sms_cb(sms, cause, valid)
	for i, v in pairs(sms) do
		print(i, v)
	end
end

function mm_cb(new_state, new_substate, old_substate)
	if new_state == 19 and new_substate == 1 then
		osmo.ms():sms_send_simple("1234", "21321324", "fooooooo", 23)
	end
end

local cbs = {
	Started=ms_started_cb,
	Shutdown=ms_shutdown_cb,
	Sms=sms_cb,
	Mm=mm_cb
}
osmo.ms():register(cbs)





More information about the baseband-devel mailing list