aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2017-08-20 17:16:28 +0200
committerFulup Ar Foll <fulup@iot.bzh>2017-08-20 17:16:28 +0200
commit27264c392166c21232e6d5fa63813d4daa45a929 (patch)
tree1364f8a449177f1d83745b722b0d02d1805969fa
parent9f4ac4a1de339ee6213e2615035d1b535aa2c70d (diff)
Updated to latest App Template
-rw-r--r--CMakeLists.txt5
-rw-r--r--README.md2
-rw-r--r--ctl-binding.c7
-rw-r--r--ctl-dispatch.c4
-rw-r--r--ctl-lua.c7
5 files changed, 15 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1eb886..c7602f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,7 +16,7 @@
# limitations under the License.
###########################################################################
-ADD_COMPILE_OPTIONS(-DCONTROL_ONLOAD_DEFAULT="onload-default")
+ADD_COMPILE_OPTIONS(-DCONTROL_ONLOAD_PROFILE="onload-default-profile")
ADD_COMPILE_OPTIONS(-DCONTROL_DOSCRIPT_PRE="doscript")
ADD_COMPILE_OPTIONS(-DCONTROL_CONFIG_PRE="onload")
@@ -57,9 +57,6 @@ PROJECT_TARGET_ADD(control-afb)
${link_libraries}
)
- # installation directory
- INSTALL(TARGETS ${TARGET_NAME}
- LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX} )
PROJECT_TARGET_ADD(audio-plugin-sample)
diff --git a/README.md b/README.md
index e6cab72..9bab485 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ Each bloc in the configuration file are defined with
* info: optional used for documentation purpose only
Note by default controller config search path is defined at compilation time, but path might be overloaded with CONTROL_CONFIG_PATH
-environment variable.
+environment variable. Setenv 'CONTROL_ONLOAD_PROFILE'=xxxx to overload 'onload-default-profile' initialisation sequence.
### Config is organised in 4 sections:
diff --git a/ctl-binding.c b/ctl-binding.c
index 8771fc0..ec33f82 100644
--- a/ctl-binding.c
+++ b/ctl-binding.c
@@ -55,9 +55,12 @@ PUBLIC int CtlBindingInit () {
errcount += LuaLibInit();
#endif
+ const char *profile= getenv("CONTROL_ONLOAD_PROFILE");
+ if (!profile) profile=CONTROL_ONLOAD_PROFILE;
+
// now that everything is initialised execute the onload action
- if (!errcount)
- errcount += DispatchOnLoad(CONTROL_ONLOAD_DEFAULT);
+ if (!errcount)
+ errcount += DispatchOnLoad(CONTROL_ONLOAD_PROFILE);
AFB_DEBUG ("Audio Policy Control Binding Done errcount=%d", errcount);
return errcount;
diff --git a/ctl-dispatch.c b/ctl-dispatch.c
index 1708204..0104229 100644
--- a/ctl-dispatch.c
+++ b/ctl-dispatch.c
@@ -178,6 +178,8 @@ PUBLIC void DispatchOneEvent(const char *evtLabel, json_object *eventJ) {
// Event name is mapped on control label and executed as a standard control
PUBLIC int DispatchOnLoad(const char *onLoadLabel) {
+ if (!configHandle) return 1;
+
DispatchHandleT **onloads = configHandle->onloads;
int err = DispatchOneControl(CTL_SOURCE_ONLOAD, onloads, onLoadLabel, NULL, NULL_AFBREQ);
@@ -650,7 +652,7 @@ PUBLIC int DispatchInit() {
// no dispatch config found remove control API from binder
if (!luaLoaded) {
- AFB_WARNING("DISPATCH-INIT:WARNING Not Found Control dispatch file [%s]", controlFile);
+ AFB_WARNING("DISPATCH-INIT:WARNING (setenv CONTROL_CONFIG_PATH) No Config '%s-*.json' in '%s'", controlFile, dirList);
}
AFB_NOTICE("DISPATCH-INIT:SUCCES: Audio Control Dispatch Init");
diff --git a/ctl-lua.c b/ctl-lua.c
index 4ef6b65..3f45055 100644
--- a/ctl-lua.c
+++ b/ctl-lua.c
@@ -965,7 +965,10 @@ PUBLIC int LuaLibInit () {
strncat (fullprefix, GetBinderName(), sizeof(fullprefix));
strncat (fullprefix, "-", sizeof(fullprefix));
- json_object *luaScriptPathJ = ScanForConfig(CONTROL_LUA_PATH , CTL_SCAN_RECURSIVE, fullprefix, "lua");
+ const char *dirList= getenv("CONTROL_LUA_PATH");
+ if (!dirList) dirList=CONTROL_LUA_PATH;
+
+ json_object *luaScriptPathJ = ScanForConfig(dirList , CTL_SCAN_RECURSIVE, fullprefix, "lua");
// open a new LUA interpretor
luaState = luaL_newstate();
@@ -1021,7 +1024,7 @@ PUBLIC int LuaLibInit () {
// no policy config found remove control API from binder
if (index == 0) {
- AFB_WARNING ("POLICY-INIT:WARNING No Control LUA file in path=[%s]", CONTROL_LUA_PATH);
+ AFB_WARNING ("POLICY-INIT:WARNING (setenv CONTROL_LUA_PATH) No LUA '%s*.lua' in '%s'", fullprefix, dirList);
}
AFB_DEBUG ("Audio control-LUA Init Done");