aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2017-08-17 00:56:43 +0200
committerFulup Ar Foll <fulup@iot.bzh>2017-08-17 00:56:43 +0200
commit5e919fde0a4c66b0203c46b8f06f303fcceaedde (patch)
tree6e4937b46d7370e9c8abe1f9a829759deda75ba2
parenta4899ab57f08aeb2741d08f74d7593c85a0ad3f4 (diff)
Implemented Timer and Event from Lua
-rw-r--r--Controler-afb/CMakeLists.txt2
-rw-r--r--Controler-afb/ctl-apidef.h8
-rw-r--r--Controler-afb/ctl-apidef.json2
-rw-r--r--Controler-afb/ctl-binding.h15
-rw-r--r--Controler-afb/ctl-lua.c293
-rw-r--r--Controler-afb/ctl-timer.c (renamed from Controler-afb/ctl-events.c)65
-rw-r--r--conf.d/project/lua.d/onload-audio-oncall.lua31
-rw-r--r--conf.d/project/lua.d/onload-audio-timer.lua73
-rw-r--r--htdocs/audio-control.html1
-rw-r--r--nbproject/configurations.xml302
10 files changed, 479 insertions, 313 deletions
diff --git a/Controler-afb/CMakeLists.txt b/Controler-afb/CMakeLists.txt
index 30fcb37..a9e8e60 100644
--- a/Controler-afb/CMakeLists.txt
+++ b/Controler-afb/CMakeLists.txt
@@ -38,7 +38,7 @@ endif(CONTROL_SUPPORT_LUA)
PROJECT_TARGET_ADD(control-afb)
# Define project Targets
- ADD_LIBRARY(${TARGET_NAME} MODULE ctl-binding.c ctl-events.c ctl-dispatch.c ${CTL_LUA_SOURCE})
+ ADD_LIBRARY(${TARGET_NAME} MODULE ctl-binding.c ctl-timer.c ctl-dispatch.c ${CTL_LUA_SOURCE})
# Generate API-v2 hat from OpenAPI json definition
SET_TARGET_GENSKEL(${TARGET_NAME} ctl-apidef)
diff --git a/Controler-afb/ctl-apidef.h b/Controler-afb/ctl-apidef.h
index 9eb271d..848fd14 100644
--- a/Controler-afb/ctl-apidef.h
+++ b/Controler-afb/ctl-apidef.h
@@ -31,7 +31,7 @@ static const char _afb_description_v2_control[] =
" End\",\"get\":{\"x-permissions\":{\"$ref\":\"#/components/x-permissions"
"/monitor\"},\"parameters\":[{\"in\":\"query\",\"name\":\"event_patern\","
"\"required\":true,\"schema\":{\"type\":\"string\"}}],\"responses\":{\"20"
- "0\":{\"$ref\":\"#/components/responses/200\"}}}},\"/event_test\":{\"desc"
+ "0\":{\"$ref\":\"#/components/responses/200\"}}}},\"/timer_test\":{\"desc"
"ription\":\"Pause Resume Test\",\"get\":{\"x-permissions\":{\"$ref\":\"#"
"/components/x-permissions/monitor\"},\"parameters\":[{\"in\":\"query\",\""
"name\":\"delay\",\"required\":false,\"schema\":{\"type\":\"interger\"}},"
@@ -64,7 +64,7 @@ static const struct afb_auth _afb_auths_v2_control[] = {
};
void ctlapi_monitor(struct afb_req req);
- void ctlapi_event_test(struct afb_req req);
+ void ctlapi_timer_test(struct afb_req req);
void ctlapi_dispatch(struct afb_req req);
void ctlapi_lua_docall(struct afb_req req);
void ctlapi_lua_dostring(struct afb_req req);
@@ -79,8 +79,8 @@ static const struct afb_verb_v2 _afb_verbs_v2_control[] = {
.session = AFB_SESSION_NONE_V2
},
{
- .verb = "event_test",
- .callback = ctlapi_event_test,
+ .verb = "timer_test",
+ .callback = ctlapi_timer_test,
.auth = &_afb_auths_v2_control[0],
.info = NULL,
.session = AFB_SESSION_NONE_V2
diff --git a/Controler-afb/ctl-apidef.json b/Controler-afb/ctl-apidef.json
index 93456ab..621fd5e 100644
--- a/Controler-afb/ctl-apidef.json
+++ b/Controler-afb/ctl-apidef.json
@@ -147,7 +147,7 @@
}
}
},
- "/event_test": {
+ "/timer_test": {
"description": "Pause Resume Test",
"get": {
"x-permissions": {
diff --git a/Controler-afb/ctl-binding.h b/Controler-afb/ctl-binding.h
index 33a9049..c998007 100644
--- a/Controler-afb/ctl-binding.h
+++ b/Controler-afb/ctl-binding.h
@@ -24,6 +24,8 @@
#include <json-c/json.h>
#include <filescan-utils.h>
#include <wrap-json.h>
+#include <systemd/sd-event.h>
+
#ifdef CONTROL_SUPPORT_LUA
#include "lua.h"
@@ -46,9 +48,22 @@ PUBLIC int CtlBindingInit ();
// ctl-timerevt.c
// ----------------------
+typedef int (*timerCallbackT)(void *context);
+
+typedef struct TimerHandleS {
+ int count;
+ int delay;
+ const char*label;
+ void *context;
+ timerCallbackT callback;
+ sd_event_source *evtSource;
+} TimerHandleT;
+
PUBLIC int TimerEvtInit (void);
PUBLIC afb_event TimerEvtGet(void);
PUBLIC void ctlapi_event_test (afb_req request);
+PUBLIC void TimerEvtStart(TimerHandleT *timerHandle, timerCallbackT callback, void *context);
+PUBLIC void TimerEvtStop(TimerHandleT *timerHandle);
// ctl-policy
// -----------
diff --git a/Controler-afb/ctl-lua.c b/Controler-afb/ctl-lua.c
index 7c59186..9d2cceb 100644
--- a/Controler-afb/ctl-lua.c
+++ b/Controler-afb/ctl-lua.c
@@ -31,6 +31,8 @@
#define LUA_FIST_ARG 2 // when using luaL_newlib calllback receive libtable as 1st arg
#define LUA_MSG_MAX_LENGTH 512
#define JSON_ERROR (json_object*)-1
+static afb_req NULL_AFBREQ = {};
+
static lua_State* luaState;
@@ -47,12 +49,14 @@ static LuaAfbEvent *luaDefaultEvt;
typedef struct {
int ctxMagic;
afb_req request;
+ void *handle;
char *info;
} LuaAfbContextT;
typedef struct {
const char *callback;
json_object *context;
+ void *handle;
} LuaCallServiceT;
typedef enum {
@@ -83,7 +87,7 @@ STATIC LuaAfbContextT *LuaCtxCheck (lua_State *luaState, int index) {
return afbContext;
}
-STATIC LuaAfbContextT *LuaCtxPush (lua_State *luaState, afb_req request, const char* info) {
+STATIC LuaAfbContextT *LuaCtxPush (lua_State *luaState, afb_req request, void *handle, const char* info) {
// LuaAfbContextT *afbContext = (LuaAfbContextT *)lua_newuserdata(luaState, sizeof(LuaAfbContextT));
// luaL_setmetatable(luaState, CTX_TOKEN);
LuaAfbContextT *afbContext = (LuaAfbContextT *)calloc(1, sizeof(LuaAfbContextT));
@@ -95,11 +99,13 @@ STATIC LuaAfbContextT *LuaCtxPush (lua_State *luaState, afb_req request, const c
afbContext->ctxMagic=CTX_MAGIC;
afbContext->info=strdup(info);
afbContext->request= request;
+ afbContext->handle= handle;
return afbContext;
}
STATIC void LuaCtxFree (LuaAfbContextT *afbContext) {
- free (afbContext->info);
+ free(afbContext->info);
+ free(afbContext);
}
// Push a json structure on the stack as a LUA table
@@ -153,7 +159,7 @@ STATIC int LuaPushArgument (json_object *argsJ) {
return 1;
}
-STATIC json_object *PopOneArg (lua_State* luaState, int idx);
+STATIC json_object *LuaPopOneArg (lua_State* luaState, int idx);
STATIC json_object *LuaTableToJson (lua_State* luaState, int index) {
int idx;
@@ -173,7 +179,7 @@ STATIC json_object *LuaTableToJson (lua_State* luaState, int index) {
snprintf(number, sizeof(number),"%d", idx);
key=number;
}
- json_object *argJ= PopOneArg(luaState, LUA_VALUE_INDEX);
+ json_object *argJ= LuaPopOneArg(luaState, LUA_VALUE_INDEX);
json_object_object_add(tableJ, key, argJ);
lua_pop(luaState, 1); // removes 'value'; keeps 'key' for next iteration
}
@@ -186,7 +192,7 @@ STATIC json_object *LuaTableToJson (lua_State* luaState, int index) {
return tableJ;
}
-STATIC json_object *PopOneArg (lua_State* luaState, int idx) {
+STATIC json_object *LuaPopOneArg (lua_State* luaState, int idx) {
json_object *value=NULL;
int luaType = lua_type(luaState, idx);
@@ -205,7 +211,7 @@ STATIC json_object *PopOneArg (lua_State* luaState, int idx) {
value= json_object_new_boolean(lua_toboolean(luaState, idx));
break;
case LUA_TSTRING:
- value= json_object_new_string(lua_tostring(luaState, idx));
+ value= json_object_new_string(lua_tostring(luaState, idx));
break;
case LUA_TTABLE:
value= LuaTableToJson(luaState, idx);
@@ -213,9 +219,12 @@ STATIC json_object *PopOneArg (lua_State* luaState, int idx) {
case LUA_TNIL:
value=json_object_new_string("nil") ;
break;
+ case LUA_TUSERDATA:
+ value=json_object_new_int64((int64_t)lua_touserdata(luaState, idx)); // store userdata as int !!!
+ break;
default:
- AFB_NOTICE ("PopOneArg: script returned Unknown/Unsupported idx=%d type:%d/%s", idx, luaType, lua_typename(luaState, luaType));
+ AFB_NOTICE ("LuaPopOneArg: script returned Unknown/Unsupported idx=%d type:%d/%s", idx, luaType, lua_typename(luaState, luaType));
value=NULL;
}
@@ -230,12 +239,12 @@ static json_object *LuaPopArgs (lua_State* luaState, int start) {
// start at 2 because we are using a function array lib
if (start == stop) {
- responseJ=PopOneArg (luaState, start);
+ responseJ=LuaPopOneArg (luaState, start);
} else {
// loop on remaining return arguments
responseJ= json_object_new_array();
for (int idx=start; idx <= stop; idx++) {
- json_object *argJ=PopOneArg (luaState, idx);
+ json_object *argJ=LuaPopOneArg (luaState, idx);
if (!argJ) goto OnErrorExit;
json_object_array_add(responseJ, argJ);
}
@@ -413,6 +422,8 @@ STATIC void LuaAfbServiceCB(void *handle, int iserror, struct json_object *respo
if (err) {
AFB_ERROR ("LUA-SERICE-CB:FAIL response=%s err=%s", json_object_get_string(responseJ), lua_tostring(luaState,-1) );
}
+
+ free (contextCB);
}
@@ -472,60 +483,69 @@ STATIC int LuaAfbServiceSync(lua_State* luaState) {
return 1;
}
-STATIC int LuaAfbMakeEvent(lua_State* luaState) {
- int count = lua_gettop(luaState);
- LuaAfbEvent *afbevt=calloc(1,sizeof(LuaAfbEvent));
+STATIC int LuaAfbEventPush(lua_State* luaState) {
+ LuaAfbEvent *afbevt;
+ int index;
- if (count != 1 || !lua_isstring(luaState, 1)) {
- lua_pushliteral (luaState, "LuaAfbMakeEvent-Syntax is evtHandle= AFB:event ('myEventName')");
- goto OnErrorExit;
+ // if no private event handle then use default binding event
+ if (lua_islightuserdata(luaState, LUA_FIST_ARG)) {
+ afbevt = (LuaAfbEvent*) lua_touserdata(luaState, LUA_FIST_ARG);
+ index=LUA_FIST_ARG+1;
+ } else {
+ index=LUA_FIST_ARG;
+ afbevt=luaDefaultEvt;
}
-
- // event name should be the only argument
- afbevt->name= strdup (lua_tostring(luaState,1));
- // create a new binder event
- afbevt->event = afb_daemon_make_event(afbevt->name);
if (!afb_event_is_valid(afbevt->event)) {
- lua_pushliteral (luaState, "LuaAfbMakeEvent-Fail to Create Binder event");
+ lua_pushliteral (luaState, "LuaAfbMakePush-Fail invalid event");
goto OnErrorExit;
}
-
- // push event handler as a LUA opaque handle
- lua_pushlightuserdata(luaState, afbevt);
- return 1;
+
+ json_object *ctlEventJ= LuaTableToJson(luaState, index);
+ if (!ctlEventJ) {
+ lua_pushliteral (luaState, "LuaAfbEventPush-Syntax is AFB:signal ([evtHandle], {lua table})");
+ goto OnErrorExit;
+ }
+
+ int done = afb_event_push(afbevt->event, ctlEventJ);
+ if (!done) {
+ lua_pushliteral (luaState, "LuaAfbEventPush-Fail No Subscriber to event");
+ AFB_ERROR ("LuaAfbEventPush-Fail name subscriber event=%s count=%d", afbevt->name, afbevt->count);
+ goto OnErrorExit;
+ }
+ afbevt->count++;
+ return 0;
OnErrorExit:
lua_error(luaState);
return 1;
}
-STATIC int LuaAfbPushEvent(lua_State* luaState) {
+STATIC int LuaAfbEventSubscribe(lua_State* luaState) {
LuaAfbEvent *afbevt;
- int index;
-
+
+ LuaAfbContextT *afbContext= LuaCtxCheck(luaState, LUA_FIST_ARG);
+ if (!afbContext) {
+ lua_pushliteral (luaState, "LuaAfbEventSubscribe-Fail Invalid request handle");
+ goto OnErrorExit;
+ }
+
// if no private event handle then use default binding event
- if (lua_islightuserdata(luaState, 1)) {
- afbevt = (LuaAfbEvent*) lua_touserdata(luaState, 1);
- index=1;
+ if (lua_islightuserdata(luaState, LUA_FIST_ARG+1)) {
+ afbevt = (LuaAfbEvent*) lua_touserdata(luaState, LUA_FIST_ARG+1);
} else {
- index=2;
afbevt=luaDefaultEvt;
}
- if (!lua_isstring(luaState, index)) {
- lua_pushliteral (luaState, "LuaAfbPushEvent-Syntax is AFB:signal ([evtHandle], 'myEventName', 'data-1', ... 'data-n')");
- goto OnErrorExit;
+ if (!afb_event_is_valid(afbevt->event)) {
+ lua_pushliteral (luaState, "LuaAfbMakePush-Fail invalid event handle");
+ goto OnErrorExit;
}
-
- // use every other arguments as event parameters
- index++;
- json_object *ctlEventJ= LuaTableToJson(luaState, index);
-
- int done = afb_event_push(afbevt->event, ctlEventJ);
- if (!done) {
- lua_pushliteral (luaState, "LuaAfbPushEvent-Fail to Push Binder event");
- AFB_ERROR ("LuaAfbPushEvent-Fail to Push Binder event=%s count=%d", afbevt->name, afbevt->count);
+
+ int err = afb_req_subscribe(afbContext->request, afbevt->event);
+ if (err) {
+ lua_pushliteral (luaState, "LuaAfbEventSubscribe-Fail No Subscriber to event");
+ AFB_ERROR ("LuaAfbEventPush-Fail name subscriber event=%s count=%d", afbevt->name, afbevt->count);
goto OnErrorExit;
}
afbevt->count++;
@@ -536,6 +556,34 @@ STATIC int LuaAfbPushEvent(lua_State* luaState) {
return 1;
}
+STATIC int LuaAfbEventMake(lua_State* luaState) {
+ int count = lua_gettop(luaState);
+ LuaAfbEvent *afbevt=calloc(1,sizeof(LuaAfbEvent));
+
+ if (count != LUA_FIST_ARG || !lua_isstring(luaState, LUA_FIST_ARG)) {
+ lua_pushliteral (luaState, "LuaAfbEventMake-Syntax is evtHandle= AFB:event ('myEventName')");
+ goto OnErrorExit;
+ }
+
+ // event name should be the only argument
+ afbevt->name= strdup (lua_tostring(luaState,LUA_FIST_ARG));
+
+ // create a new binder event
+ afbevt->event = afb_daemon_make_event(afbevt->name);
+ if (!afb_event_is_valid(afbevt->event)) {
+ lua_pushliteral (luaState, "LuaAfbEventMake-Fail to Create Binder event");
+ goto OnErrorExit;
+ }
+
+ // push event handler as a LUA opaque handle
+ lua_pushlightuserdata(luaState, afbevt);
+ return 1;
+
+ OnErrorExit:
+ lua_error(luaState);
+ return 1;
+}
+
// Function call from LUA when lua2c plugin L2C is used
PUBLIC int Lua2cWrapper(lua_State* luaState, char *funcname, Lua2cFunctionT callback, void *context) {
@@ -608,7 +656,7 @@ STATIC void LuaDoAction (LuaDoActionT action, afb_req request) {
goto OnErrorExit;
}
// Push AFB client context on the stack
- LuaAfbContextT *afbContext= LuaCtxPush(luaState, request, script);
+ LuaAfbContextT *afbContext= LuaCtxPush(luaState, request,NULL,script);
if (!afbContext) goto OnErrorExit;
break;
@@ -628,7 +676,7 @@ STATIC void LuaDoAction (LuaDoActionT action, afb_req request) {
lua_getglobal(luaState, func);
// Push AFB client context on the stack
- LuaAfbContextT *afbContext= LuaCtxPush(luaState, request, func);
+ LuaAfbContextT *afbContext= LuaCtxPush(luaState, request, NULL, func);
if (!afbContext) goto OnErrorExit;
// push query on the stack
@@ -702,7 +750,7 @@ STATIC void LuaDoAction (LuaDoActionT action, afb_req request) {
lua_getglobal(luaState, func);
// Push AFB client context on the stack
- LuaAfbContextT *afbContext= LuaCtxPush(luaState, request, func);
+ LuaAfbContextT *afbContext= LuaCtxPush(luaState, request, NULL, func);
if (!afbContext) goto OnErrorExit;
// push function arguments
@@ -746,6 +794,131 @@ PUBLIC void ctlapi_lua_doscript (afb_req request) {
LuaDoAction (LUA_DOSCRIPT, request);
}
+STATIC int LuaTimerClear (lua_State* luaState) {
+
+ // Get Timer Handle
+ LuaAfbContextT *afbContext= LuaCtxCheck(luaState, LUA_FIST_ARG);
+ if (!afbContext) goto OnErrorExit;
+
+ // retrieve useful information opaque handle
+ TimerHandleT *timerHandle = (TimerHandleT*)afbContext->handle;
+
+ AFB_NOTICE ("LuaTimerClear timer=%s", timerHandle->label);
+ TimerEvtStop(timerHandle);
+
+ return 0; //happy end
+
+OnErrorExit:
+ return 1;
+}
+STATIC int LuaTimerGet (lua_State* luaState) {
+
+ // Get Timer Handle
+ LuaAfbContextT *afbContext= LuaCtxCheck(luaState, LUA_FIST_ARG);
+ if (!afbContext) goto OnErrorExit;
+
+ // retrieve useful information opaque handle
+ TimerHandleT *timerHandle = (TimerHandleT*)afbContext->handle;
+
+ // create response as a JSON object
+ json_object *responseJ= json_object_new_object();
+ json_object_object_add(responseJ,"label", json_object_new_string(timerHandle->label));
+ json_object_object_add(responseJ,"delay", json_object_new_int(timerHandle->delay));
+ json_object_object_add(responseJ,"count", json_object_new_int(timerHandle->count));
+
+ // return JSON object as Lua table
+ int count=LuaPushArgument(responseJ);
+
+ // free json object
+ json_object_put(responseJ);
+
+ return count; // return argument
+
+OnErrorExit:
+ return 0;
+}
+
+// Timer Callback
+
+// Set timer
+STATIC int LuaTimerSetCB (void *handle) {
+ LuaCallServiceT *contextCB =(LuaCallServiceT*) handle;
+ TimerHandleT *timerHandle = (TimerHandleT*) contextCB->handle;
+ int count;
+
+ // push timer handle and user context on Lua stack
+ lua_getglobal(luaState, contextCB->callback);
+
+ // Push timer handle
+ LuaAfbContextT *afbContext= LuaCtxPush(luaState, NULL_AFBREQ, contextCB->handle, timerHandle->label);
+ if (!afbContext) goto OnErrorExit;
+ count=1;
+
+ // Push user Context
+ count+= LuaPushArgument(contextCB->context);
+
+ int err=lua_pcall(luaState, count, LUA_MULTRET, 0);
+ if (err) {
+ AFB_ERROR ("LUA-TIMER-CB:FAIL response=%s err=%s", json_object_get_string(contextCB->context), lua_tostring(luaState,-1));
+ goto OnErrorExit;
+ }
+
+ // get return parameter
+ if (!lua_isboolean(luaState, -1)) {
+ return (lua_toboolean(luaState, -1));
+ }
+
+ // timer last run free context resource
+ if (timerHandle->count == 1) {
+ LuaCtxFree(afbContext);
+ }
+ return 0; // By default we are happy
+
+ OnErrorExit:
+ return 1; // stop timer
+}
+
+STATIC int LuaTimerSet(lua_State* luaState) {
+ const char *label=NULL, *info=NULL;
+ int delay=0, count=0;
+
+ json_object *timerJ = LuaPopOneArg(luaState, LUA_FIST_ARG);
+ const char *callback = lua_tostring(luaState, LUA_FIST_ARG + 1);
+ json_object *contextJ = LuaPopOneArg(luaState, LUA_FIST_ARG + 2);
+
+ if (lua_gettop(luaState) != LUA_FIST_ARG+2 || !timerJ || !callback || !contextJ) {
+ lua_pushliteral(luaState, "LuaTimerSet-Syntax timerset (timerT, 'callback', contextT)");
+ goto OnErrorExit;
+ }
+
+ int err = wrap_json_unpack(timerJ, "{ss, s?s si, si !}", "label", &label, "info", &info, "delay", &delay, "count", &count);
+ if (err) {
+ lua_pushliteral(luaState, "LuaTimerSet-Syntax timerT={label:xxx delay:ms, count:xx}");
+ goto OnErrorExit;
+ }
+
+ // everything look fine create timer structure
+ TimerHandleT *timerHandle = malloc (sizeof (TimerHandleT));
+ timerHandle->delay=delay;
+ timerHandle->count=count;
+ timerHandle->label=label;
+
+ // Allocate handle to store context and callback
+ LuaCallServiceT *contextCB = calloc (1, sizeof(LuaCallServiceT));
+ contextCB->callback= callback;
+ contextCB->context = contextJ;
+ contextCB->handle = timerHandle;
+
+ // fire timer
+ TimerEvtStart (timerHandle, LuaTimerSetCB, contextCB);
+
+ return 0; // Happy No Return Function
+
+OnErrorExit:
+ lua_error(luaState);
+ return 1; // return error code
+}
+
// Register a new L2c list of LUA user plugin commands
PUBLIC void LuaL2cNewLib(const char *label, luaL_Reg *l2cFunc, int count) {
// luaL_newlib(luaState, l2cFunc); macro does not work with pointer :(
@@ -756,17 +929,21 @@ PUBLIC void LuaL2cNewLib(const char *label, luaL_Reg *l2cFunc, int count) {
}
static const luaL_Reg afbFunction[] = {
- {"notice" , LuaPrintNotice},
- {"info" , LuaPrintInfo},
- {"warning", LuaPrintWarning},
- {"debug" , LuaPrintDebug},
- {"error" , LuaPrintError},
- {"callsync", LuaAfbServiceSync},
- {"service", LuaAfbService},
- {"success", LuaAfbSuccess},
- {"fail" , LuaAfbFail},
- {"event" , LuaAfbMakeEvent},
- {"signal" , LuaAfbPushEvent},
+ {"timerclear", LuaTimerClear},
+ {"timerget" , LuaTimerGet},
+ {"timerset" , LuaTimerSet},
+ {"notice" , LuaPrintNotice},
+ {"info" , LuaPrintInfo},
+ {"warning" , LuaPrintWarning},
+ {"debug" , LuaPrintDebug},
+ {"error" , LuaPrintError},
+ {"callsync" , LuaAfbServiceSync},
+ {"service" , LuaAfbService},
+ {"success" , LuaAfbSuccess},
+ {"fail" , LuaAfbFail},
+ {"subscribe" , LuaAfbEventSubscribe},
+ {"evtmake" , LuaAfbEventMake},
+ {"evtpush" , LuaAfbEventPush},
{NULL, NULL} /* sentinel */
};
diff --git a/Controler-afb/ctl-events.c b/Controler-afb/ctl-timer.c
index 18aac53..f7ee6f0 100644
--- a/Controler-afb/ctl-events.c
+++ b/Controler-afb/ctl-timer.c
@@ -25,20 +25,11 @@
#define DEFAULT_PAUSE_DELAY 3000
#define DEFAULT_TEST_COUNT 1
-typedef int (*timerCallbackT)(void *context);
typedef struct {
int value;
const char *label;
} AutoTestCtxT;
-typedef struct TimerHandleS {
- int count;
- int delay;
- AutoTestCtxT *context;
- timerCallbackT callback;
- sd_event_source *evtSource;
-} TimerHandleT;
-
static afb_event afbevt;
STATIC int TimerNext (sd_event_source* source, uint64_t timer, void* handle) {
@@ -48,12 +39,16 @@ STATIC int TimerNext (sd_event_source* source, uint64_t timer, void* handle) {
// Rearm timer if needed
timerHandle->count --;
- if (timerHandle->count == 0) sd_event_source_unref(source);
+ if (timerHandle->count == 0) {
+ sd_event_source_unref(source);
+ free (handle);
+ return 0;
+ }
else {
// otherwise validate timer for a new run
sd_event_now(afb_daemon_get_event_loop(), CLOCK_MONOTONIC, &usec);
sd_event_source_set_enabled(source, SD_EVENT_ONESHOT);
- sd_event_source_set_time(source, usec + timerHandle->delay);
+ sd_event_source_set_time(source, usec + timerHandle->delay*1000);
}
done= timerHandle->callback(timerHandle->context);
@@ -62,10 +57,33 @@ STATIC int TimerNext (sd_event_source* source, uint64_t timer, void* handle) {
return 0;
OnErrorExit:
- AFB_WARNING("TimerNext Callback Fail Tag=%s", timerHandle->context->label);
+ AFB_WARNING("TimerNext Callback Fail Tag=%s", timerHandle->label);
return -1;
}
+PUBLIC void TimerEvtStop(TimerHandleT *timerHandle) {
+
+ sd_event_source_unref(timerHandle->evtSource);
+ free (timerHandle);
+}
+
+
+PUBLIC void TimerEvtStart(TimerHandleT *timerHandle, timerCallbackT callback, void *context) {
+ uint64_t usec;
+
+ // populate CB handle
+ timerHandle->callback=callback;
+ timerHandle->context=context;
+
+ // set a timer with ~250us accuracy
+ sd_event_now(afb_daemon_get_event_loop(), CLOCK_MONOTONIC, &usec);
+ sd_event_add_time(afb_daemon_get_event_loop(), &timerHandle->evtSource, CLOCK_MONOTONIC, usec+timerHandle->delay*1000, 250, TimerNext, timerHandle);
+}
+
+PUBLIC afb_event TimerEvtGet(void) {
+ return afbevt;
+}
+
STATIC int DoSendEvent (void *context) {
AutoTestCtxT *ctx= (AutoTestCtxT*)context;
@@ -84,25 +102,8 @@ STATIC int DoSendEvent (void *context) {
return (done);
}
-STATIC void TimerEvtStart(TimerHandleT *timerHandle, void *context) {
- uint64_t usec;
-
- // populate CB handle
- timerHandle->callback=DoSendEvent;
- timerHandle->context=context;
-
- // set a timer with ~250us accuracy
- sd_event_now(afb_daemon_get_event_loop(), CLOCK_MONOTONIC, &usec);
- sd_event_add_time(afb_daemon_get_event_loop(), &timerHandle->evtSource, CLOCK_MONOTONIC, usec+timerHandle->delay, 250, TimerNext, timerHandle);
-}
-
-PUBLIC afb_event TimerEvtGet(void) {
- return afbevt;
-}
-
-
// Generated some fake event based on watchdog/counter
-PUBLIC void ctlapi_event_test (afb_req request) {
+PUBLIC void ctlapi_timer_test (afb_req request) {
json_object *queryJ, *tmpJ;
TimerHandleT *timerHandle = malloc (sizeof (TimerHandleT));
AutoTestCtxT *context = calloc (1, sizeof (AutoTestCtxT));
@@ -119,7 +120,7 @@ PUBLIC void ctlapi_event_test (afb_req request) {
afb_req_fail_f(request, "TEST-LABEL-MISSING", "label is mandatory for event_test");
goto OnErrorExit;
}
- context->label = strdup(json_object_get_string (tmpJ));
+ timerHandle->label = strdup(json_object_get_string (tmpJ));
json_object_object_get_ex(queryJ, "delay", &tmpJ);
timerHandle->delay = json_object_get_int (tmpJ) * 1000;
@@ -130,7 +131,7 @@ PUBLIC void ctlapi_event_test (afb_req request) {
if (timerHandle->count == 0) timerHandle->count=DEFAULT_TEST_COUNT;
// start a lool timer
- TimerEvtStart (timerHandle, context);
+ TimerEvtStart (timerHandle, DoSendEvent, context);
afb_req_success(request, NULL, NULL);
return;
diff --git a/conf.d/project/lua.d/onload-audio-oncall.lua b/conf.d/project/lua.d/onload-audio-oncall.lua
index 13cda4b..08b25e5 100644
--- a/conf.d/project/lua.d/onload-audio-oncall.lua
+++ b/conf.d/project/lua.d/onload-audio-oncall.lua
@@ -68,34 +68,3 @@ function Test_Call_Sync (request, args)
end
end
--- create a new event name
-function Test_Event_Make (request, args)
-
- AFB:notice ("Test_Event_Make args=%s", args)
-
- local err evt_handle= AFB:event (args["evtname"])
- if (err) then
- AFB:fail ("AFB:Test_Event_Make fail event=%s", args["evtname"]);
- else
- AFB:success (request, {})
- end
-
- local evtData = {
- ["val1"]="My 1st private Event",
- ["val2"]=5678
- }
-
- AFB:notify (evt_handle, evtData)
-end
-
--- send an event on default binder event
-function Test_Event_Notify (request, args)
-
- AFB:notice ("Test_Event_Notify args=%s", args)
- local err AFB:notify (args)
- if (err) then
- AFB:fail ("AFB:Test_Event_Make fail event=%s", args["evtname"]);
- else
- AFB:success (request, {})
- end
-end
diff --git a/conf.d/project/lua.d/onload-audio-timer.lua b/conf.d/project/lua.d/onload-audio-timer.lua
new file mode 100644
index 0000000..5f25de7
--- /dev/null
+++ b/conf.d/project/lua.d/onload-audio-timer.lua
@@ -0,0 +1,73 @@
+--[[
+ Copyright (C) 2016 "IoT.bzh"
+ Author Fulup Ar Foll <fulup@iot.bzh>
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+
+ Provide Sample Timer Handing to push event from LUA
+--]]
+
+-- Create event on Lua script load
+print ("*** Create MyTestEvent ***")
+MyEventHandle= AFB:evtmake("MyTestEvent")
+
+-- Call count time every delay/ms
+function Timer_Test_CB (timer, context)
+
+ local evtinfo= AFB:timerget(timer)
+ print ("timer=", Dump_Table(evtinfo))
+
+ --send an event an event with count as value
+ AFB:evtpush (MyEventHandle, {["label"]= evtinfo["label"], ["count"]=evtinfo["count"], ["info"]=context["info"]})
+
+ -- note when timerCB return!=0 timer is kill
+ return 0
+
+end
+
+-- sendback event depending on count and delay
+function Simple_Timer_Test (request, args)
+
+ local context = {
+ ["info"]="My 1st private Event",
+ }
+
+ -- if delay not defined default is 5s
+ if (args["delay"]==nil) then args["delay"]=5000 end
+
+ -- if count is not defined default is 10
+ if (args["count"]==nil) then args["count"]=10 end
+
+ -- we could use directly args but it is a sample
+ local myTimer = {
+ ["label"]=args["label"],
+ ["delay"]=args["delay"],
+ ["count"]=args["count"],
+ }
+ AFB:notice ("Test_Timer myTimer=%s", myTimer)
+
+ -- subscribe to event
+ AFB:subscribe (request, MyEventHandle)
+
+ -- settimer take a table with delay+count as input (count==0 means infinite)
+ AFB:timerset (myTimer, "Timer_Test_CB", context)
+
+ -- nothing special to return send back args
+ AFB:success (request, myTimer)
+
+ return 0
+end
+
+
+
diff --git a/htdocs/audio-control.html b/htdocs/audio-control.html
index d51f527..d51ae55 100644
--- a/htdocs/audio-control.html
+++ b/htdocs/audio-control.html
@@ -32,6 +32,7 @@
<li><button onclick="callbinder('control','lua_dostring','print(\'Bonjours\'); return true, 1234');">LUA string</button></li>
<li><button onclick="callbinder('control','lua_docall' , {'func':'Simple_Echo_Args', 'args':{speed:20}});">LUA function</button></li>
<li><button onclick="callbinder('control','lua_doscript', {'script':'helloworld.lua', args:{'arg1':'abcd', 'next':7890, 'last':[1,2,3,4]}});">LUA script</button></li>
+ <li><button onclick="callbinder('control','lua_docall' , {'func':'Simple_Timer_Test', args:{label:'MyTimer', 'delay':3000, 'count':10}});">LUA Timer</button></li>
</ol>
diff --git a/nbproject/configurations.xml b/nbproject/configurations.xml
index fb247d1..a5d9f8e 100644
--- a/nbproject/configurations.xml
+++ b/nbproject/configurations.xml
@@ -46,10 +46,10 @@
<df name="Controler-afb">
<in>ctl-binding.c</in>
<in>ctl-dispatch.c</in>
- <in>ctl-events.c</in>
<in>ctl-lua.c</in>
<in>ctl-misc.c</in>
<in>ctl-plugin-sample.c</in>
+ <in>ctl-timer.c</in>
</df>
<df name="HAL-afb">
<df name="HAL-interface">
@@ -147,39 +147,87 @@
ex="false"
tool="0"
flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
</cTool>
</item>
<item path="Alsa-afb/Alsa-AddCtl.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>Audio-Common</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>build/Alsa-afb</pElem>
+ </incDir>
</cTool>
</item>
<item path="Alsa-afb/Alsa-ApiHat.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>build/Alsa-afb</pElem>
+ </incDir>
</cTool>
</item>
<item path="Alsa-afb/Alsa-RegEvt.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>Audio-Common</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>build/Alsa-afb</pElem>
+ </incDir>
</cTool>
</item>
<item path="Alsa-afb/Alsa-SetGet.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>Audio-Common</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>build/Alsa-afb</pElem>
+ </incDir>
</cTool>
</item>
<item path="Alsa-afb/Alsa-Ucm.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>../../../opt/include/alsa</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>Audio-Common</pElem>
+ <pElem>../../../opt/include</pElem>
+ <pElem>build/Alsa-afb</pElem>
+ </incDir>
</cTool>
</item>
<item path="Audio-Common/audio-common.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>Audio-Common</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>build/Audio-Common</pElem>
+ </incDir>
</cTool>
</item>
- <item path="Audio-Common/filescan-utils.c" ex="false" tool="0" flavor2="2">
- <cTool flags="0">
+ <item path="Audio-Common/filescan-utils.c" ex="false" tool="0" flavor2="3">
+ <cTool flags="2">
+ <incDir>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>Audio-Common</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>build/Audio-Common</pElem>
+ </incDir>
</cTool>
</item>
<item path="Audio-Common/wrap-json.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>Audio-Common</pElem>
+ <pElem>/usr/include/json-c</pElem>
+ <pElem>build/Audio-Common</pElem>
+ </incDir>
</cTool>
</item>
<item path="Common/AudioCommonLib.c" ex="false" tool="0" flavor2="2">
@@ -218,37 +266,19 @@
</cTool>
</item>
<item path="Controler-afb/ctl-dispatch.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
<incDir>
- <pElem>../../../opt/include</pElem>
- <pElem>../../../opt/include/alsa</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>Controler-afb</pElem>
<pElem>/usr/include/json-c</pElem>
<pElem>/usr/include/lua5.3</pElem>
<pElem>Audio-Common</pElem>
+ <pElem>../../../opt/include</pElem>
<pElem>build/Controler-afb</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/config.d:/usr/local/controler/config.d"</Elem>
- <Elem>CONTROL_CONFIG_POST="control"</Elem>
- <Elem>CONTROL_CONFIG_PRE="onload"</Elem>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_LUA_EVENT="luaevt"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/lua.d:/usr/local/controler/ctl-lua.d"</Elem>
- <Elem>CONTROL_MAXPATH_LEN=255</Elem>
- <Elem>CONTROL_ONLOAD_DEFAULT="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build:/home/fulup/opt/audio-bindings/ctlplug:/usr/lib/afb/ctlplug"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
- <Elem>MAX_LINEAR_DB_SCALE=24</Elem>
- <Elem>MAX_SND_CARD=16</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>TLV_BYTE_SIZE=256</Elem>
- <Elem>control_afb_EXPORTS</Elem>
- </preprocessorList>
</cTool>
</item>
- <item path="Controler-afb/ctl-events.c" ex="false" tool="0" flavor2="3">
+ <item path="Controler-afb/ctl-lua.c" ex="false" tool="0" flavor2="3">
<cTool flags="0">
<incDir>
<pElem>../../../opt/include</pElem>
@@ -279,94 +309,65 @@
</preprocessorList>
</cTool>
</item>
- <item path="Controler-afb/ctl-lua.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <item path="Controler-afb/ctl-misc.c" ex="false" tool="0" flavor2="3">
+ <cTool flags="2">
<incDir>
- <pElem>../../../opt/include</pElem>
- <pElem>../../../opt/include/alsa</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>Controler-afb</pElem>
<pElem>/usr/include/json-c</pElem>
- <pElem>/usr/include/lua5.3</pElem>
- <pElem>Audio-Common</pElem>
<pElem>build/Controler-afb</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/config.d:/usr/local/controler/config.d"</Elem>
- <Elem>CONTROL_CONFIG_POST="control"</Elem>
- <Elem>CONTROL_CONFIG_PRE="onload"</Elem>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_LUA_EVENT="luaevt"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/lua.d:/usr/local/controler/ctl-lua.d"</Elem>
- <Elem>CONTROL_MAXPATH_LEN=255</Elem>
- <Elem>CONTROL_ONLOAD_DEFAULT="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build:/home/fulup/opt/audio-bindings/ctlplug:/usr/lib/afb/ctlplug"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
- <Elem>MAX_LINEAR_DB_SCALE=24</Elem>
- <Elem>MAX_SND_CARD=16</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>TLV_BYTE_SIZE=256</Elem>
- <Elem>control_afb_EXPORTS</Elem>
- </preprocessorList>
</cTool>
</item>
- <item path="Controler-afb/ctl-misc.c" ex="false" tool="0" flavor2="3">
+ <item path="Controler-afb/ctl-plugin-sample.c" ex="false" tool="0" flavor2="3">
<cTool flags="2">
<incDir>
<pElem>../../../opt/include/afb</pElem>
<pElem>Controler-afb</pElem>
<pElem>/usr/include/json-c</pElem>
+ <pElem>/usr/include/lua5.3</pElem>
<pElem>build/Controler-afb</pElem>
</incDir>
</cTool>
</item>
- <item path="Controler-afb/ctl-plugin-sample.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <item path="Controler-afb/ctl-timer.c" ex="false" tool="0" flavor2="3">
+ <cTool flags="2">
<incDir>
- <pElem>../../../opt/include</pElem>
- <pElem>../../../opt/include/alsa</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>Controler-afb</pElem>
<pElem>/usr/include/json-c</pElem>
- <pElem>/usr/include/lua5.3</pElem>
- <pElem>Audio-Common</pElem>
+ <pElem>../../../opt/include</pElem>
<pElem>build/Controler-afb</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/config.d:/usr/local/controler/config.d"</Elem>
- <Elem>CONTROL_CONFIG_POST="control"</Elem>
- <Elem>CONTROL_CONFIG_PRE="onload"</Elem>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_LUA_EVENT="luaevt"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/lua.d:/usr/local/controler/ctl-lua.d"</Elem>
- <Elem>CONTROL_MAXPATH_LEN=255</Elem>
- <Elem>CONTROL_ONLOAD_DEFAULT="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build:/home/fulup/opt/audio-bindings/ctlplug:/usr/lib/afb/ctlplug"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
- <Elem>MAX_LINEAR_DB_SCALE=24</Elem>
- <Elem>MAX_SND_CARD=16</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>TLV_BYTE_SIZE=256</Elem>
- <Elem>audio_plugin_sample_EXPORTS</Elem>
- </preprocessorList>
</cTool>
</item>
<item path="HAL-afb/HAL-interface/hal-interface.c"
ex="false"
tool="0"
flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>Audio-Common</pElem>
+ <pElem>build/HAL-afb/HAL-interface</pElem>
+ </incDir>
</cTool>
</item>
<item path="HAL-afb/HAL-interface/hal-volramp.c"
ex="false"
tool="0"
flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>Audio-Common</pElem>
+ <pElem>build/HAL-afb/HAL-interface</pElem>
+ </incDir>
</cTool>
</item>
<item path="HAL-afb/HAL-interface/hal-volume.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
+ <incDir>
+ <pElem>build/HAL-afb/HAL-interface</pElem>
+ </incDir>
</cTool>
</item>
<item path="HAL-afb/HAL-plugin/HalPlugPcm.c" ex="false" tool="0" flavor2="3">
@@ -374,21 +375,21 @@
</cTool>
</item>
<item path="HAL-afb/HDA-intel/IntelHdaHAL.c" ex="false" tool="0" flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
</cTool>
</item>
<item path="HAL-afb/Jabra-Solemate/JabraUsbHAL.c"
ex="false"
tool="0"
flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
</cTool>
</item>
<item path="HAL-afb/Scarlett-Focusrite/ScarlettUsbHAL.c"
ex="false"
tool="0"
flavor2="3">
- <cTool flags="0">
+ <cTool flags="2">
</cTool>
</item>
<item path="HAL-afb/Unicens-USB/UnicensHAL.c" ex="false" tool="0" flavor2="3">
@@ -453,11 +454,11 @@
<folder path="0/Alsa-Plugin">
<cTool>
<incDir>
- <pElem>../../../opt/include</pElem>
+ <pElem>Alsa-Plugin/Alsa-Policy-Hook</pElem>
<pElem>../../../opt/include/alsa</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
<pElem>/usr/include/json-c</pElem>
- <pElem>/usr/include/lua5.3</pElem>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>../../../opt/include</pElem>
<pElem>build/Alsa-Plugin/Alsa-Policy-Hook</pElem>
</incDir>
<preprocessorList>
@@ -484,62 +485,9 @@
<folder path="0/Alsa-afb">
<cTool>
<incDir>
- <pElem>../../../opt/include</pElem>
- <pElem>../../../opt/include/alsa</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
- <pElem>/usr/include/json-c</pElem>
- <pElem>/usr/include/lua5.3</pElem>
- <pElem>Audio-Common</pElem>
- <pElem>build/Alsa-afb</pElem>
- </incDir>
- <preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/config.d:/usr/local/controler/config.d"</Elem>
- <Elem>CONTROL_CONFIG_POST="control"</Elem>
- <Elem>CONTROL_CONFIG_PRE="onload"</Elem>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_LUA_EVENT="luaevt"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/lua.d:/usr/local/controler/ctl-lua.d"</Elem>
- <Elem>CONTROL_MAXPATH_LEN=255</Elem>
- <Elem>CONTROL_ONLOAD_DEFAULT="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build:/home/fulup/opt/audio-bindings/ctlplug:/usr/lib/afb/ctlplug"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
- <Elem>MAX_LINEAR_DB_SCALE=24</Elem>
- <Elem>MAX_SND_CARD=16</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>TLV_BYTE_SIZE=256</Elem>
- <Elem>alsa_lowlevel_EXPORTS</Elem>
- </preprocessorList>
- </cTool>
- </folder>
- <folder path="0/Audio-Common">
- <cTool>
- <incDir>
- <pElem>../../../opt/include</pElem>
- <pElem>../../../opt/include/alsa</pElem>
- <pElem>/usr/include/p11-kit-1</pElem>
- <pElem>/usr/include/json-c</pElem>
- <pElem>/usr/include/lua5.3</pElem>
- <pElem>Audio-Common</pElem>
- <pElem>build/Audio-Common</pElem>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>Alsa-afb</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_CONFIG_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/config.d:/usr/local/controler/config.d"</Elem>
- <Elem>CONTROL_CONFIG_POST="control"</Elem>
- <Elem>CONTROL_CONFIG_PRE="onload"</Elem>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_LUA_EVENT="luaevt"</Elem>
- <Elem>CONTROL_LUA_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/conf.d/project/lua.d:/usr/local/controler/ctl-lua.d"</Elem>
- <Elem>CONTROL_MAXPATH_LEN=255</Elem>
- <Elem>CONTROL_ONLOAD_DEFAULT="onload-default"</Elem>
- <Elem>CONTROL_PLUGIN_PATH="/home/fulup/Workspace/AGL-AppFW/audio-bindings-dev/build:/home/fulup/opt/audio-bindings/ctlplug:/usr/lib/afb/ctlplug"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>CTL_PLUGIN_MAGIC=2468013579</Elem>
- <Elem>MAX_LINEAR_DB_SCALE=24</Elem>
- <Elem>MAX_SND_CARD=16</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>TLV_BYTE_SIZE=256</Elem>
- </preprocessorList>
</cTool>
</folder>
<folder path="0/Common">
@@ -604,15 +552,9 @@
<folder path="0/HAL-afb/HAL-interface">
<cTool>
<incDir>
+ <pElem>../../../opt/include/afb</pElem>
<pElem>HAL-afb/HAL-interface</pElem>
- <pElem>Audio-Common</pElem>
- <pElem>build/HAL-afb/HAL-interface</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>NATIVE_LINUX</Elem>
- </preprocessorList>
</cTool>
</folder>
<folder path="0/HAL-afb/HAL-plugin">
@@ -635,46 +577,34 @@
<folder path="0/HAL-afb/HDA-intel">
<cTool>
<incDir>
- <pElem>HAL-afb/HAL-interface</pElem>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>HAL-afb/HDA-intel</pElem>
<pElem>Audio-Common</pElem>
+ <pElem>HAL-afb/HAL-interface</pElem>
<pElem>build/HAL-afb/HDA-intel</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>hal_intel_hda_EXPORTS</Elem>
- </preprocessorList>
</cTool>
</folder>
<folder path="0/HAL-afb/Jabra-Solemate">
<cTool>
<incDir>
- <pElem>HAL-afb/HAL-interface</pElem>
+ <pElem>HAL-afb/Jabra-Solemate</pElem>
+ <pElem>../../../opt/include/afb</pElem>
<pElem>Audio-Common</pElem>
+ <pElem>HAL-afb/HAL-interface</pElem>
<pElem>build/HAL-afb/Jabra-Solemate</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>hal_jabra_usb_EXPORTS</Elem>
- </preprocessorList>
</cTool>
</folder>
<folder path="0/HAL-afb/Scarlett-Focusrite">
<cTool>
<incDir>
- <pElem>HAL-afb/HAL-interface</pElem>
+ <pElem>../../../opt/include/afb</pElem>
+ <pElem>HAL-afb/Scarlett-Focusrite</pElem>
<pElem>Audio-Common</pElem>
+ <pElem>HAL-afb/HAL-interface</pElem>
<pElem>build/HAL-afb/Scarlett-Focusrite</pElem>
</incDir>
- <preprocessorList>
- <Elem>CONTROL_DOSCRIPT_PRE="doscript"</Elem>
- <Elem>CONTROL_SUPPORT_LUA</Elem>
- <Elem>NATIVE_LINUX</Elem>
- <Elem>hal_scalett_usb_EXPORTS</Elem>
- </preprocessorList>
</cTool>
</folder>
<folder path="0/HAL-afb/Unicens-USB">
@@ -1231,11 +1161,11 @@
<cTool flags="0">
</cTool>
</item>
- <item path="Controler-afb/ctl-events.c" ex="false" tool="0" flavor2="0">
+ <item path="Controler-afb/ctl-lua.c" ex="false" tool="0" flavor2="0">
<cTool flags="0">
</cTool>
</item>
- <item path="Controler-afb/ctl-lua.c" ex="false" tool="0" flavor2="0">
+ <item path="Controler-afb/ctl-timer.c" ex="false" tool="0" flavor2="0">
<cTool flags="0">
</cTool>
</item>
@@ -1614,7 +1544,7 @@
</preprocessorList>
</cTool>
</item>
- <item path="Controler-afb/ctl-events.c" ex="false" tool="0" flavor2="2">
+ <item path="Controler-afb/ctl-lua.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
<pElem>Audio-Common</pElem>
@@ -1625,7 +1555,7 @@
</preprocessorList>
</cTool>
</item>
- <item path="Controler-afb/ctl-lua.c" ex="false" tool="0" flavor2="2">
+ <item path="Controler-afb/ctl-misc.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
<pElem>Audio-Common</pElem>
@@ -1636,24 +1566,24 @@
</preprocessorList>
</cTool>
</item>
- <item path="Controler-afb/ctl-misc.c" ex="false" tool="0" flavor2="2">
+ <item path="Controler-afb/ctl-plugin-sample.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
- <pElem>Audio-Common</pElem>
<pElem>build/Controler-afb</pElem>
</incDir>
<preprocessorList>
- <Elem>control_afb_EXPORTS</Elem>
+ <Elem>audio_plugin_sample_EXPORTS</Elem>
</preprocessorList>
</cTool>
</item>
- <item path="Controler-afb/ctl-plugin-sample.c" ex="false" tool="0" flavor2="2">
+ <item path="Controler-afb/ctl-timer.c" ex="false" tool="0" flavor2="2">
<cTool flags="0">
<incDir>
+ <pElem>Audio-Common</pElem>
<pElem>build/Controler-afb</pElem>
</incDir>
<preprocessorList>
- <Elem>audio_plugin_sample_EXPORTS</Elem>
+ <Elem>control_afb_EXPORTS</Elem>
</preprocessorList>
</cTool>
</item>