aboutsummaryrefslogtreecommitdiffstats
path: root/Controler-afb/ctl-binding.h
diff options
context:
space:
mode:
authorfulup <fulup.arfoll@iot.bzh>2017-08-11 19:44:21 +0200
committerfulup <fulup.arfoll@iot.bzh>2017-08-11 19:44:21 +0200
commitb65178642727536972d0c04e53b2310be58beb2e (patch)
treef06f8773ce44f8320e9e86cee60e59e1597d6b78 /Controler-afb/ctl-binding.h
parentc13952824e2cc110b9405e1bc9017801dd938ac0 (diff)
Almost working version with Json Config, Lua script and sharelib callbacks.
Diffstat (limited to 'Controler-afb/ctl-binding.h')
-rw-r--r--Controler-afb/ctl-binding.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/Controler-afb/ctl-binding.h b/Controler-afb/ctl-binding.h
index abcb2f4..deef93c 100644
--- a/Controler-afb/ctl-binding.h
+++ b/Controler-afb/ctl-binding.h
@@ -28,6 +28,13 @@
#endif
#define STATIC static
+// sharelib ctl-plugin*
+typedef struct {
+ long magic;
+ char *label;
+} CtlPluginMagicT;
+
+#define CTL_PLUGIN_REGISTER(pluglabel) CtlPluginMagicT CtlPluginMagic={.magic=CTL_PLUGIN_MAGIC,.label=pluglabel}; struct afb_binding_data_v2;
// polctl-binding.c
PUBLIC int CtlBindingInit ();
@@ -44,14 +51,6 @@ PUBLIC void ctlapi_event_test (afb_req request);
// -----------
typedef enum {
- CTLAPI_NAVIGATION,
- CTLAPI_MULTIMEDIA,
- CTLAPI_EMERGENCY,
-
- CTL_NONE=-1
-} DispatchCtlEnumT;
-
-typedef enum {
CTL_SCAN_FLAT=0,
CTL_SCAN_RECURSIVE=1,
} CtlScanDirModeT;
@@ -71,15 +70,23 @@ typedef struct DispatchActionS{
const char* call;
json_object *argsJ;
int timeout;
- json_object* (*actionCB)(struct DispatchActionS *action,json_object *response, void *context);
+ int (*actionCB)(afb_req request, struct DispatchActionS *action, void *context);
} DispatchActionT;
PUBLIC int DispatchInit(void);
-PUBLIC void ctlapi_dispatch (DispatchCtlEnumT control, afb_req request);
+PUBLIC void ctlapi_dispatch (char* control, afb_req request);
// ctl-lua.c
+
+typedef enum {
+ LUA_DOCALL,
+ LUA_DOSTRING,
+ LUA_DOSCRIPT,
+} LuaDoActionT;
+
PUBLIC int LuaLibInit ();
PUBLIC json_object* ScanForConfig (char* searchPath, CtlScanDirModeT mode, char *pre, char *ext);
+PUBLIC int LuaCallFunc (afb_req request, DispatchActionT *action);
PUBLIC void ctlapi_lua_docall (afb_req request);
PUBLIC void ctlapi_lua_dostring (afb_req request);
PUBLIC void ctlapi_lua_doscript (afb_req request);