diff options
Diffstat (limited to 'conf.d')
-rw-r--r-- | conf.d/cmake/config.cmake | 5 | ||||
-rw-r--r-- | conf.d/project/lua.d/CMakeLists.txt | 8 | ||||
-rw-r--r-- | conf.d/project/lua.d/onload-audio-controls.lua | 11 | ||||
-rw-r--r-- | conf.d/project/lua.d/onload-audio-oncall.lua | 43 |
4 files changed, 41 insertions, 26 deletions
diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index ff8bf38..73a00f6 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -67,6 +67,7 @@ set (PKG_REQUIRED_LIST # Define CONTROL_CDEV_NAME should match MOST driver values # --------------------------------------------------------- + set(LUA_COMPILER "luac5.3" CACHE STRING "LUA syntaxe check") add_compile_options(-DCONTROL_ONLOAD_DEFAULT="onload-default") add_compile_options(-DCONTROL_MAXPATH_LEN=255) add_compile_options(-DCONTROL_DOSCRIPT_PRE="doscript") @@ -77,8 +78,8 @@ set (PKG_REQUIRED_LIST add_compile_options(-DCONTROL_LUA_EVENT="luaevt") add_compile_options(-DCONTROL_LUA_PATH="${CMAKE_SOURCE_DIR}/conf.d/project/lua.d:${CMAKE_INSTALL_PREFIX}/controler/ctl-lua.d") - set (CTL_PLUGIN_PRE "ctl-" cache "Prefix for Controler share plugin") - set (CTL_PLUGIN_EXT ".ctlso" cache "Postfix for Controler share plugin") + set (CTL_PLUGIN_PRE "ctl-" CACHE STRING "Prefix for Controler share plugin") + set (CTL_PLUGIN_EXT ".ctlso" CACHE STRING "Postfix for Controler share plugin") add_compile_options(-DCTL_PLUGIN_MAGIC=2468013579) add_compile_options(-DCONTROL_PLUGIN_PATH="${CMAKE_BINARY_DIR}:${BINDINGS_INSTALL_DIR}/ctlplug:/usr/lib/afb/ctlplug") diff --git a/conf.d/project/lua.d/CMakeLists.txt b/conf.d/project/lua.d/CMakeLists.txt index db54742..ecf1e6d 100644 --- a/conf.d/project/lua.d/CMakeLists.txt +++ b/conf.d/project/lua.d/CMakeLists.txt @@ -22,7 +22,7 @@ ################################################## PROJECT_TARGET_ADD(ctl-lua.d) - file(GLOB XML_FILES "*.lua") + file(GLOB LUA_FILES "*.lua") add_custom_target(${TARGET_NAME} DEPENDS ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} @@ -30,11 +30,11 @@ PROJECT_TARGET_ADD(ctl-lua.d) # check XML schema before pushing config add_custom_command( - DEPENDS ${XML_FILES} + DEPENDS ${LUA_FILES} OUTPUT ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - # COMMAND xmllint -schema ${XML_SCHEMA} ${XML_FILES} --noout (Fulup we miss this for JSON) + COMMAND ${LUA_COMPILER} ${LUA_FILES} COMMAND mkdir -p ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} COMMAND touch ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} - COMMAND cp -r ${XML_FILES} ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} + COMMAND cp -r ${LUA_FILES} ${PROJECT_PKG_BUILD_DIR}/${TARGET_NAME} ) diff --git a/conf.d/project/lua.d/onload-audio-controls.lua b/conf.d/project/lua.d/onload-audio-controls.lua index eb6a61b..2fbf4f5 100644 --- a/conf.d/project/lua.d/onload-audio-controls.lua +++ b/conf.d/project/lua.d/onload-audio-controls.lua @@ -19,10 +19,11 @@ --]] function Audio_Init_CB (status, result, context) - print ("***** result=", Dump_Table(result)) - print ("***** context=", Dump_Table(context)) + print ("--inlua:Audio_Init_CB-- result=", Dump_Table(result)) + print ("--inlua:Audio_Init_CB-- context=", Dump_Table(context)) - -- AFB:notice ("--LUA:Audio_Init_Hal result=%s context=%s", result, context) + -- (Fulup Bug) AFB:debug ("Audio_Init_Hal result=%s context=%s", result, context) + AFB:debug ("Audio_Init_Hal result=%s context=%s", {["ret1"]=5678, ["ret2"]="abcd"}, context) end @@ -37,12 +38,12 @@ end function Audio_Set_Navigation(args, query) - AFB:notice ("--LUA:Audio_Set_Use_Case args=%s query=%s", args, query); + AFB:notice ("LUA:Audio_Set_Use_Case args=%s query=%s", args, query); -- synchronous call to alsacore service local error,data= AFB:callsync ('alsacore', 'ping', {}) if (error) then - AFB:error ("--LUA:Audio_Set_Use_Case FAIL args=%s", args) + AFB:error ("LUA:Audio_Set_Use_Case FAIL args=%s", args) else AFB:notice ("--LUA:Audio_Set_Use_Case DONE args=%s response=%s", args, data["response"]) end diff --git a/conf.d/project/lua.d/onload-audio-oncall.lua b/conf.d/project/lua.d/onload-audio-oncall.lua index 22cba85..13cda4b 100644 --- a/conf.d/project/lua.d/onload-audio-oncall.lua +++ b/conf.d/project/lua.d/onload-audio-oncall.lua @@ -21,28 +21,40 @@ -- global counter to keep track of calls count=0 --- Adjust Volume function of vehicle speed -function Oncall_Helloworld (request, args) - count=count+1 +-- Display receive arguments and echo them to caller +function Simple_Echo_Args (request, args) + count=count+1 + AFB:notice("LUA OnCall Echo Args count=%d args=%s", count, args) - AFB:notice("LUA OnCall Helloworld count=%d args=%s", count, args); - AFB:success (request, {"count"=count}) + print ("--inlua-- args=", Dump_Table(args)) + + local response={ + ["count"]=count, + ["args"]=args, + } + + -- fulup Embdeded table ToeDone AFB:success (request, response) + AFB:success (request, {["func"]="Simple_Echo_Args", ["ret1"]=5678, ["ret2"]="abcd"}) end -function Test_Async_CB (request, result, context) +function Test_Async_CB (request, result, context) + response={ + ["result"]=result, + ["context"]=context, + } AFB:notice ("Test_Async_CB result=%s context=%s", result, context) - AFB:success (request, {"response"=result, "context"=context}) + AFB:success (request, response) end function Test_Call_Async (request, args) local context={ - "value1"="abcd", - "value2"=1234 + ["value1"]="abcd", + ["value2"]=1234 } - AFB:notice ("Test_Call_Async args=%s", args) - AFB:service("alsacore","ping", args, "Test_Async_CB", context) + AFB:notice ("Test_Call_Async args=%s cb=Test_Async_CB", args) + AFB:service("alsacore","ping", "Test_Async_CB", context) end function Test_Call_Sync (request, args) @@ -60,7 +72,8 @@ end function Test_Event_Make (request, args) AFB:notice ("Test_Event_Make args=%s", args) - local err eventFD AFB:event (args["evtname"]) + + local err evt_handle= AFB:event (args["evtname"]) if (err) then AFB:fail ("AFB:Test_Event_Make fail event=%s", args["evtname"]); else @@ -68,11 +81,11 @@ function Test_Event_Make (request, args) end local evtData = { - val1="My 1st private Event", - val2=5678 + ["val1"]="My 1st private Event", + ["val2"]=5678 } - AFB:notify (eventFD, evtData) + AFB:notify (evt_handle, evtData) end -- send an event on default binder event |