diff options
Diffstat (limited to 'conf.d/project/json.d')
-rw-r--r-- | conf.d/project/json.d/CMakeLists.txt | 32 | ||||
-rw-r--r-- | conf.d/project/json.d/README.md | 22 | ||||
-rw-r--r-- | conf.d/project/json.d/onload-aaaa-sample.json | 103 |
3 files changed, 157 insertions, 0 deletions
diff --git a/conf.d/project/json.d/CMakeLists.txt b/conf.d/project/json.d/CMakeLists.txt new file mode 100644 index 0000000..8070997 --- /dev/null +++ b/conf.d/project/json.d/CMakeLists.txt @@ -0,0 +1,32 @@ +########################################################################### +# Copyright 2017 IoT.bzh +# +# author: Fulup Ar Foll <fulup@iot.bzh> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +########################################################################### + + +################################################## +# Control Policy Config file +################################################## +PROJECT_TARGET_ADD(ctl-config.d) + + file(GLOB XML_FILES "*.json") + + add_input_files("${XML_FILES}") + + SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES + LABELS "DATA" + OUTPUT_NAME ${TARGET_NAME} + ) diff --git a/conf.d/project/json.d/README.md b/conf.d/project/json.d/README.md new file mode 100644 index 0000000..0f4967d --- /dev/null +++ b/conf.d/project/json.d/README.md @@ -0,0 +1,22 @@ +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' + +WARNING: Audio Control are the one from the HAL and not from Alsa LowLevel + diff --git a/conf.d/project/json.d/onload-aaaa-sample.json b/conf.d/project/json.d/onload-aaaa-sample.json new file mode 100644 index 0000000..c95a62f --- /dev/null +++ b/conf.d/project/json.d/onload-aaaa-sample.json @@ -0,0 +1,103 @@ +{ + "$schema": "ToBeDone", + "metadata": { + "label": "sample-aaaa-control", + "info": "Sample of Video AAAA controls", + "name": "afb-sample-controller", + "version": "1.0" + }, + "onload": [{ + "label": "onload-default", + "info": "onload initialisation config", + "require": ["alsacore","jabra-usb","intel-hda","hal-most-unicens"], + "actions": + { + "label": "control-init", + "lua": "_Audio_Controller_Init", + "args": { + "evtname": "agl-audio" + } + } + }], + "controls": + [ + { + "label": "Multimedia", + "permissions": "urn:AGL:permission:audio:public:multimedia", + "actions": { + "label": "authorize-multimedia", + "lua": "_Temporarily_Control" + } + }, { + "label": "Navigation", + "permissions": "urn:AGL:permission:audio:public:navigation", + "actions": { + "label": "authorize-navigation", + "lua": "_Temporarily_Control", + "args": { + "ctl" : "Multimedia_Playback_Volume", + "val": 40 + } + } + }, { + "label": "Telephony", + "permissions": "urn:AGL:permission:audio:public:telephony", + "actions": { + "label": "authorize-multimedia", + "lua": "_Temporarily_Control", + "args": { + "ctl" : "Multimedia_Playback_Volume", + "val": 20 + } + } + }, { + "label": "Emergency", + "permissions": "urn:AGL:permission:audio:public:emergency", + "actions": { + "label": "authorize-multimedia", + "lua": "_Temporarily_Control", + "args": { + "ctl" : "Multimedia_Playback_Switch", + "val": 0 + }, + "label": "authorize-multimedia", + "lua": "_Temporarily_Control", + "args": { + "ctl" : "Navigation_Playback_Switch", + "val": 0 + } + } + } + ], + "events": + [ + { + "label": "ReverseEngage", + "actions": [{ + "label": "adjust_volume-reverse", + "lua": "_Temporarily_Control", + "args": { + "ctl": "Multimedia_Playback_Volume", + "val": 20 + } + }, + { + "label": "prevent-telephony", + "lua": "_Temporarily_Control", + "args": { + "ctl": "Telephony_Playback_Switch", + "val": 0 + } + } + ] + }, + { + "label": "SpeedChanged", + "actions": { + "label": "adjust_volume", + "lua": "_Adjust_Volume" + } + } + ] +} + |