summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-03 16:49:50 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-08-08 12:35:23 +0000
commit3891dcc4fc4c014422925c5705c575431b9939dd (patch)
tree6793f64d4ea867bf5c64a3eeba0bf10634ff3a16
parente7132f1707e1a1bee15ed52b3550c4919048fe7b (diff)
New function returning the binding root directory
Change-Id: If4d8416c87c668ebc55d3866ccd038c652317b43 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--ctl-lib/ctl-lua.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c
index 9e4f791..9194d75 100644
--- a/ctl-lib/ctl-lua.c
+++ b/ctl-lib/ctl-lua.c
@@ -670,6 +670,20 @@ static int LuaAfbGetUid(lua_State* luaState) {
return 1; // return argument
}
+static int LuaAfbGetRootDir(lua_State* luaState) {
+
+ CtlSourceT *source = LuaSourcePop(luaState, LUA_FIRST_ARG);
+ if (!source) {
+ lua_pushliteral(luaState, "LuaAfbEventSubscribe-Fail Invalid request handle");
+ return 0;
+ }
+
+ // extract and return afbSource from timer handle
+ lua_pushstring(luaState, GetBindingDirPath(source->api));
+
+ return 1; // return argument
+}
+
static int LuaAfbGetStatus(lua_State* luaState) {
CtlSourceT *source = LuaSourcePop(luaState, LUA_FIRST_ARG);
@@ -1274,6 +1288,7 @@ static const luaL_Reg afbFunction[] = {
{"evtmake", LuaAfbEventMake},
{"evtpush", LuaAfbEventPush},
{"getuid", LuaAfbGetUid},
+ {"getrootdir", LuaAfbGetRootDir},
{"status", LuaAfbGetStatus},
{"context", LuaClientCtx},
{"lockwait", LuaLockWait},