From de0a0595316d15c0cb639816fc3c0413541a49d5 Mon Sep 17 00:00:00 2001 From: Fulup Ar Foll Date: Wed, 23 Aug 2017 21:55:48 +0200 Subject: Added sample for synchronous control request and update documentation to support monitoring. --- README.md | 5 +++++ conf.d/cmake/config.cmake | 5 ++++- conf.d/project/.vscode/c_cpp_properties.json | 18 ------------------ conf.d/project/lua.d/onload-daemon-04-oncall.lua | 10 +++++----- conf.d/project/vscode.d/c_cpp_properties.json | 18 ++++++++++++++++++ htdocs/index.html | 4 +++- 6 files changed, 35 insertions(+), 25 deletions(-) delete mode 100644 conf.d/project/.vscode/c_cpp_properties.json create mode 100644 conf.d/project/vscode.d/c_cpp_properties.json diff --git a/README.md b/README.md index 6b6019e..00aaaa4 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,11 @@ Controler AAAA(AGL Advance Audio Controler) and more. - Dependencies: the only dependencies are audio-common for JSON-WRAP and Filescan-utils capabilities. - Controler relies on Lua-5.3, when not needed Lua might be removed at compilation time. +## Monitoring + - Default test HTML page expect monitoring HTML page to be accessible from /monitoring for this to work you should + * place monitoring HTML pages in a well known location eg: $HOME/opt/monitoring + * start your binder with the alias option e.g. afb-daemon --port=1234 --alias=/monitoring:/home/fulup/opt/afb-monitoring --ldpaths=. --workdir=. --roothttp=../htdocs + ## Config Configuration is loaded dynamically during startup time. The controller scans CONTROL_CONFIG_PATH for a file corresponding to pattern diff --git a/conf.d/cmake/config.cmake b/conf.d/cmake/config.cmake index fec5082..b97cb7a 100644 --- a/conf.d/cmake/config.cmake +++ b/conf.d/cmake/config.cmake @@ -134,7 +134,10 @@ set(COMPILE_OPTIONS # Print a helper message when every thing is finished # ---------------------------------------------------- -set(CLOSING_MESSAGE "Debug from ./buid: afb-daemon --port=1234 --ldpaths=. --workdir=. --roothttp=../htdocs --tracereq=common --token='' --verbose") +if(IS_DIRECTORY $ENV{HOME}/opt/afb-monitoring) +set(MONITORING_ALIAS "--alias=/monitoring:$ENV{HOME}/opt/afb-monitoring") +endif() +set(CLOSING_MESSAGE "Debug from afb-daemon --port=1234 ${MONITORING_ALIAS} --ldpaths=. --workdir=. --roothttp=../htdocs --tracereq=common --token= --verbose ") set(PACKAGE_MESSAGE "Install widget file using in the target : afm-util install ${PROJECT_NAME}.wgt") # (BUG!!!) as PKG_CONFIG_PATH does not work [should be an env variable] diff --git a/conf.d/project/.vscode/c_cpp_properties.json b/conf.d/project/.vscode/c_cpp_properties.json deleted file mode 100644 index 5512cb3..0000000 --- a/conf.d/project/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "name": "null", - "includePath": [], - "defines": [], - "browse": { - "path": [ - "${workspaceRoot}" - ], - "limitSymbolsToIncludedHeaders": true, - "databaseFilename": "" - }, - "intelliSenseMode": "clang-x64" - } - ], - "version": 2 -} \ No newline at end of file diff --git a/conf.d/project/lua.d/onload-daemon-04-oncall.lua b/conf.d/project/lua.d/onload-daemon-04-oncall.lua index 4e78fd8..b450932 100644 --- a/conf.d/project/lua.d/onload-daemon-04-oncall.lua +++ b/conf.d/project/lua.d/onload-daemon-04-oncall.lua @@ -54,17 +54,17 @@ function _Test_Call_Async (request, args) } AFB:notice ("Test_Call_Async args=%s cb=Test_Async_CB", args) - AFB:service("alsacore","ping", "Test_Async_CB", context) + AFB:service("monitor","ping", "Test_Async_CB", context) end -function _Test_Call_Sync (request, args) +function _Simple_Monitor_Call (request, args) - AFB:notice ("Test_Call_Sync args=%s", args) - local err, response= AFB:servsync ("alsacore","ping", args) + AFB:notice ("_Simple_Server_Call args=%s", args) + local err, result= AFB:servsync ("monitor","get", args) if (err) then AFB:fail ("AFB:service_call_sync fail"); else - AFB:success (request, response) + AFB:success (request, result["response"]) end end diff --git a/conf.d/project/vscode.d/c_cpp_properties.json b/conf.d/project/vscode.d/c_cpp_properties.json new file mode 100644 index 0000000..5512cb3 --- /dev/null +++ b/conf.d/project/vscode.d/c_cpp_properties.json @@ -0,0 +1,18 @@ +{ + "configurations": [ + { + "name": "null", + "includePath": [], + "defines": [], + "browse": { + "path": [ + "${workspaceRoot}" + ], + "limitSymbolsToIncludedHeaders": true, + "databaseFilename": "" + }, + "intelliSenseMode": "clang-x64" + } + ], + "version": 2 +} \ No newline at end of file diff --git a/htdocs/index.html b/htdocs/index.html index 52baba3..3d51f2f 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -9,7 +9,8 @@

Simple Control Test

- + +

@@ -21,6 +22,7 @@

  • +

  • -- cgit 1.2.3-korg