summaryrefslogtreecommitdiffstats
path: root/conf.d/project/json.d
diff options
context:
space:
mode:
Diffstat (limited to 'conf.d/project/json.d')
-rw-r--r--conf.d/project/json.d/README.md20
-rw-r--r--conf.d/project/json.d/onload-audio-control.json128
-rw-r--r--conf.d/project/json.d/onload-daemon-sample.json (renamed from conf.d/project/json.d/onload-daemon-standalone.json)33
3 files changed, 35 insertions, 146 deletions
diff --git a/conf.d/project/json.d/README.md b/conf.d/project/json.d/README.md
new file mode 100644
index 0000000..153990c
--- /dev/null
+++ b/conf.d/project/json.d/README.md
@@ -0,0 +1,20 @@
+By default controller searches for a config filename with the same 'middlename' as daemon process. As an example if your process name is afb-daemon then middle name is 'daemon'.
+
+```
+ onload-middlename-xxxxx.json
+
+ # Middlename is taken from process middlename.
+```
+
+You may overload config search path with environement variables
+ * AFB_BINDER_NAME: change patern config search path. 'export AFB_BINDER_NAME=sample' will make controller to search for a configfile name 'onload-sample-xxx.json'.
+ * CONTROL_CONFIG_PATH: change default reserch path for configuration. You may provide multiple directories separated by ':'.
+ * CONTROL_LUA_PATH: same as CONTROL_CONFIG_PATH but for Lua script files.
+
+Example to load a config name 'onload-myconfig-test.json' do
+```
+ AFB_BINDER_NAME='myconfig' afb-daemon --verbose ...'
+```
+
+Note: you may change search pattern for Lua script by adding 'ctlname=afb-middlename-xxx' in the metadata section of your config 'onload-*.json'
+
diff --git a/conf.d/project/json.d/onload-audio-control.json b/conf.d/project/json.d/onload-audio-control.json
deleted file mode 100644
index 2e6da77..0000000
--- a/conf.d/project/json.d/onload-audio-control.json
+++ /dev/null
@@ -1,128 +0,0 @@
-{
- "$schema": "ToBeDone",
- "metadata": {
- "label": "sample-audio-control",
- "info": "Provide Default Audio Policy for Multimedia, Navigation and Emergency",
- "version": "1.0"
- },
- "onload": [{
- "label": "onload-default",
- "info": "onload initialisation config",
- "plugin": {
- "label" : "_MyPlug",
- "sharelib": "ctl-audio-plugin-sample.ctlso",
- "lua2c": ["Lua2cHelloWorld1", "Lua2cHelloWorld2"]
- },
- "require": ["intel-hda", "jabra-usb", "scarlett-usb"],
- "actions": [
- {
- "label": "onload-sample-cb",
- "info": "Call control sharelib install entrypoint",
- "callback": "SamplePolicyInit",
- "args": {
- "arg1": "first_arg",
- "nextarg": "second arg value"
- }
- }, {
- "label": "onload-sample-api",
- "info": "Assert AlsaCore Presence",
- "api": "alsacore",
- "verb": "ping",
- "args": {"data": "none"}
- }, {
- "label": "onload-hal-lua",
- "info": "Load avaliable HALs",
- "lua": "_Alsa_Get_Hal"
- }
- ]
- }],
- "controls":
- [
- {
- "label": "multimedia",
- "actions": {
- "label": "multimedia-control-lua",
- "info": "Call Lua Script function Test_Lua_Engin",
- "lua": "_Audio_Set_Multimedia"
- }
- }, {
- "label": "navigation",
- "actions": {
- "label": "navigation-control-lua",
- "info": "Call Lua Script to set Navigation",
- "lua": "_Audio_Set_Navigation"
- }
- }, {
- "label": "emergency",
- "actions": {
- "label": "emergency-control-ucm",
- "lua": "_Audio_Set_Emergency"
- }
- }, {
- "label": "multi-step-sample",
- "info" : "all actions must succeed for control to be accepted",
- "actions": [{
- "label": "multimedia-control-cb",
- "info": "Call Sharelib Sample Callback",
- "callback": "sampleControlNavigation",
- "args": {
- "arg1": "snoopy",
- "arg2": "toto"
- }
- }, {
- "label": "navigation-control-ucm",
- "api": "alsacore",
- "verb": "ping",
- "args": {
- "test": "navigation"
- }
- }, {
- "label": "navigation-control-lua",
- "info": "Call Lua Script to set Navigation",
- "lua": "_Audio_Set_Navigation"
- }]
- }
- ],
- "events":
- [
- {
- "label": "SampleEvent1",
- "info": "define action when receiving a given event",
- "actions": [
- {
- "label": "Event Callback-1",
- "callback": "SampleControlEvent",
- "args": {
- "arg": "action-1"
- }
- }, {
- "label": "Event Callback-2",
- "callback": "SampleControlEvent",
- "args": {
- "arg": "action-2"
- }
- }
- ]
- },
- {
- "label": "SampleEvent2",
- "info": "define action when receiving a given event",
- "actions": [
- {
- "label": "Event Callback-1",
- "callback": "SampleControlEvent",
- "args": {
- "arg": "action-1"
- }
- }, {
- "label": "Event Callback-2",
- "callback": "SampleControlEvent",
- "args": {
- "arg": "action-2"
- }
- }
- ]
- }
- ]
-}
-
diff --git a/conf.d/project/json.d/onload-daemon-standalone.json b/conf.d/project/json.d/onload-daemon-sample.json
index ab646fd..cb6ca55 100644
--- a/conf.d/project/json.d/onload-daemon-standalone.json
+++ b/conf.d/project/json.d/onload-daemon-sample.json
@@ -3,6 +3,7 @@
"metadata": {
"label": "sample-standalone-control",
"info": "Minimal Standalone Controller Config",
+ "name": "afb-sample-controller",
"version": "1.0"
},
"onload": [{
@@ -11,36 +12,32 @@
"actions":
{
"label": "control-init",
- "lua": "_Control_Init"
+ "lua": "_Sample_Controller_Init",
+ "args": {
+ "xxxx": 1234,
+ "yyyy": "Bien le bonjours à vous",
+ "zzzz": "simple-evt"
+ }
}
}],
"controls":
[
{
- "label": "Button-1",
- "actions": {
- "label": "Action on Button One",
- "lua": "_Button_Press",
- "args": {
- "button": 1
- }
- }
- }, {
- "label": "Button-1",
+ "label": "Button-Happy",
"actions": {
- "label": "Action on Button Two",
- "lua": "_Button_Press",
+ "label": "Action Happy",
+ "lua": "_Button_Happy",
"args": {
- "button": 2
+ "button": 5678
}
}
}, {
- "label": "Button-1",
+ "label": "Button-UnHappy",
"actions": {
- "label": "Action on Button Three",
- "lua": "_Button_Press",
+ "label": "Action Unhappy",
+ "lua": "_Button_UnHappy",
"args": {
- "button": 3
+ "button": "abcd"
}
}
}