Review at  https://gerrit.osmocom.org/5040

WIP: start/stop for the MS..

Change-Id: I7d52e5f61e77ef1ecf00aeecad85e56cbafb4379
---
M src/host/layer23/src/mobile/script_lua.c
1 file changed, 30 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/40/5040/1

diff --git a/src/host/layer23/src/mobile/script_lua.c 
b/src/host/layer23/src/mobile/script_lua.c
index 0e57a32..fb54ddd 100644
--- a/src/host/layer23/src/mobile/script_lua.c
+++ b/src/host/layer23/src/mobile/script_lua.c
@@ -23,6 +23,7 @@
 #include <lauxlib.h>
 
 #include <osmocom/bb/common/osmocom_data.h>
+#include <osmocom/bb/mobile/app_mobile.h>
 #include <osmocom/bb/common/logging.h>
 
 #include <osmocom/bb/mobile/primitives.h>
@@ -190,9 +191,38 @@
        return 1;
 }
 
+static int lua_ms_no_shutdown(lua_State *L)
+{
+       struct osmocom_ms *ms = get_primitive(L)->ms;
+       int res;
+
+       res = mobile_init(ms);
+       lua_pushinteger(L, res);
+       return 1;
+}
+
+static int lua_ms_shutdown(lua_State *L)
+{
+       struct osmocom_ms *ms = get_primitive(L)->ms;
+       int argc = lua_gettop(L);
+       int force = 0;
+       int res;
+
+       if (argc >= 1) {
+               luaL_argcheck(L, lua_isboolean(L, -1), 1, "Force");
+               force = lua_toboolean(L, -1);
+       }
+
+       res = mobile_exit(ms, force);
+       lua_pushinteger(L, res);
+       return 1;
+}
+
 static const struct luaL_Reg ms_funcs[] = {
        { "imsi", lua_ms_imsi },
        { "imei", lua_ms_imei },
+       { "start", lua_ms_no_shutdown },
+       { "stop", lua_ms_shutdown },
        { NULL, NULL },
 };
 

-- 
To view, visit https://gerrit.osmocom.org/5040
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7d52e5f61e77ef1ecf00aeecad85e56cbafb4379
Gerrit-PatchSet: 1
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Owner: Holger Freyther <[email protected]>

Reply via email to