summaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-lua.c
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-08-16 17:56:23 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:55 +0100
commit2e1e2ac4a61784d9cfd072e824d4aafd1d2b2f2a (patch)
tree7ac0dec659f66b13e292811138b99c65e489a4b7 /ctl-lib/ctl-lua.c
parent27904ccb0f535c2406db0b4ab9a6e2038ca57900 (diff)
Migration to v3
This makes controller fully compatible with binding v3 and also keeps the compatibility with the Pre-V3 + DYNAPI bindings. Change-Id: Iaa47e51b9cb964bbe2f050784fca355c780673f8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'ctl-lib/ctl-lua.c')
-rw-r--r--ctl-lib/ctl-lua.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/ctl-lib/ctl-lua.c b/ctl-lib/ctl-lua.c
index 9194d75..87e27d0 100644
--- a/ctl-lib/ctl-lua.c
+++ b/ctl-lib/ctl-lua.c
@@ -370,27 +370,27 @@ PrintMessage:
}
static int LuaPrintInfo(lua_State* luaState) {
- int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_INFO, _AFB_SYSLOG_LEVEL_INFO_);
+ int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_INFO, AFB_SYSLOG_LEVEL_INFO);
return err;
}
static int LuaPrintError(lua_State* luaState) {
- int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_ERROR, _AFB_SYSLOG_LEVEL_ERROR_);
+ int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_ERROR, AFB_SYSLOG_LEVEL_ERROR);
return err; // no value return
}
static int LuaPrintWarning(lua_State* luaState) {
- int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_WARNING, _AFB_SYSLOG_LEVEL_WARNING_);
+ int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_WARNING, AFB_SYSLOG_LEVEL_WARNING);
return err;
}
static int LuaPrintNotice(lua_State* luaState) {
- int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_NOTICE, _AFB_SYSLOG_LEVEL_NOTICE_);
+ int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_NOTICE, AFB_SYSLOG_LEVEL_NOTICE);
return err;
}
static int LuaPrintDebug(lua_State* luaState) {
- int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_DEBUG, _AFB_SYSLOG_LEVEL_DEBUG_);
+ int err = LuaFormatMessage(luaState, AFB_VERBOSITY_LEVEL_DEBUG, AFB_SYSLOG_LEVEL_DEBUG);
return err;
}
@@ -426,13 +426,7 @@ static int LuaAfbFail(lua_State* luaState) {
return 0;
}
-#ifdef AFB_BINDING_PREV3
-
static void LuaAfbServiceCB(void *handle, int iserror, struct json_object *responseJ, AFB_ApiT apiHandle) {
-#else
-
-static void LuaAfbServiceCB(void *handle, int iserror, struct json_object *responseJ) {
-#endif
LuaCbHandleT *handleCb = (LuaCbHandleT*) handle;
int count = 1;
@@ -991,11 +985,14 @@ static int LuaTimerClear(lua_State* luaState) {
if (!timerHandle)
return 1;
-#ifdef AFB_BINDING_PREV3
+#if(AFB_BINDING_VERSION == 3) || ((AFB_BINDING_VERSION == 0) && defined(AFB_BINDING_WANT_DYNAPI))
// API handle does not exit in API-V2
LuaCbHandleT *luaCbHandle = (LuaCbHandleT*) timerHandle->context;
-#endif
AFB_ApiNotice(luaCbHandle->source->api, "LuaTimerClear timer=%s", timerHandle->uid);
+#else
+ AFB_NOTICE("LuaTimerClear timer=%s", timerHandle->uid);
+#endif
+
TimerEvtStop(timerHandle);
return 0; //happy end