diff options
Diffstat (limited to 'conf.d/project')
-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 |
3 files changed, 38 insertions, 24 deletions
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 |