aboutsummaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/ctl-lua.h
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-10 19:46:02 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commit75cfbf3d0206f12422091e6479c508c69445bf4a (patch)
tree200085512507e7ee5adc43b377d34ff5953db8de /signal-composer-binding/ctl-lua.h
parentbdf2d19cf8a3d6005456508ca52dba74cd9c103f (diff)
Controller src integration
Change-Id: I0b18cd55057a784d183a5ba02c332810a34d1fca Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/ctl-lua.h')
-rw-r--r--signal-composer-binding/ctl-lua.h61
1 files changed, 7 insertions, 54 deletions
diff --git a/signal-composer-binding/ctl-lua.h b/signal-composer-binding/ctl-lua.h
index df2379f..c5f472d 100644
--- a/signal-composer-binding/ctl-lua.h
+++ b/signal-composer-binding/ctl-lua.h
@@ -12,60 +12,6 @@
#include "signal-composer-binding.hpp"
-#ifndef CONTROL_DOSCRIPT_PRE
-#define CONTROL_DOSCRIPT_PRE "doscript"
-#endif
-
-#ifndef CONTROL_CONFIG_PRE
-#define CONTROL_CONFIG_PRE "onload"
-#endif
-
-#ifndef CONTROL_LUA_EVENT
-#define CONTROL_LUA_EVENT "luaevt"
-#endif
-
-typedef int (*timerCallbackT)(void *context);
-
-typedef struct TimerHandleS {
- int count;
- int delay;
- const char*label;
- void *context;
- timerCallbackT callback;
- sd_event_source *evtSource;
-} TimerHandleT;
-
-int TimerEvtInit (void);
-afb_event TimerEvtGet(void);
-void TimerEvtStart(TimerHandleT *timerHandle, timerCallbackT callback, void *context);
-void TimerEvtStop(TimerHandleT *timerHandle);
-
-typedef enum {
- CTL_MODE_NONE=0,
- CTL_MODE_API,
- CTL_MODE_CB,
- CTL_MODE_LUA,
-} CtlRequestModeT;
-
-typedef enum {
- CTL_SOURCE_CLOSE=-1,
- CTL_SOURCE_UNKNOWN=0,
- CTL_SOURCE_ONLOAD=1,
- CTL_SOURCE_OPEN=2,
- CTL_SOURCE_EVENT=3,
-} DispatchSourceT;
-
-typedef struct DispatchActionS{
- const char *info;
- const char* label;
- CtlRequestModeT mode;
- const char* api;
- const char* call;
- json_object *argsJ;
- int timeout;
- int (*actionCB)(DispatchSourceT source, const char*label, json_object *argsJ, json_object *queryJ, void *context);
-} DispatchActionT;
-
typedef enum {
LUA_DOCALL,
LUA_DOSTRING,
@@ -73,3 +19,10 @@ typedef enum {
} LuaDoActionT;
typedef int (*Lua2cFunctionT)(char *funcname, json_object *argsJ, void*context);
+
+typedef int (*Lua2cWrapperT) (lua_State* luaState, char *funcname, Lua2cFunctionT callback);
+
+int LuaLibInit ();
+void LuaL2cNewLib(const char *label, luaL_Reg *l2cFunc, int count);
+int Lua2cWrapper(lua_State* luaState, char *funcname, Lua2cFunctionT callback, void *context);
+int LuaCallFunc (DispatchSourceT source, DispatchActionT *action, json_object *queryJ) ;