aboutsummaryrefslogtreecommitdiffstats
path: root/docs/Usage.md
diff options
context:
space:
mode:
authorCorentinLGS <corentinlgs@gmail.com>2018-08-07 14:23:11 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 15:02:55 +0100
commit80ec58eac2bd1da4236b59c0f0c1042c50d99790 (patch)
treece622f3888d340ff44049401de4822c417e631fe /docs/Usage.md
parent80596c5dddf5174f485a963eac8fc7d1a1058e22 (diff)
Controller: Converted README to a gitbook version.
-Split the README into a gitbook documentation. Change-Id: Iacf94e94d15606d68c925885dac5233d828f29b7 Signed-off-by: CorentinLGS <corentinlgs@gmail.com>
Diffstat (limited to 'docs/Usage.md')
-rw-r--r--docs/Usage.md53
1 files changed, 53 insertions, 0 deletions
diff --git a/docs/Usage.md b/docs/Usage.md
new file mode 100644
index 0000000..65f1ce9
--- /dev/null
+++ b/docs/Usage.md
@@ -0,0 +1,53 @@
+# Usage
+
+## 1) Add app-controller-submodule as a submodule to include in your project
+
+```bash
+git submodule add https://gerrit.automotivelinux.org/gerrit/apps/app-controller-submodule
+```
+
+## 2) Add app-controller-submodule as a static library to your binding
+
+```cmake
+ # Library dependencies (include updates automatically)
+ TARGET_LINK_LIBRARIES(${TARGET_NAME}
+ ctl-utilities
+ ... other dependencies ....
+ )
+```
+
+## 3) Declare your controller config section in your binding
+
+```C
+// CtlSectionT syntax:
+// key: "section name in config file"
+// loadCB: callback to process section
+// handle: a void* pass to callback when processing section
+static CtlSectionT ctlSections[]= {
+ {.key="plugins" , .loadCB= PluginConfig, .handle= &halCallbacks},
+ {.key="onload" , .loadCB= OnloadConfig},
+ {.key="halmap" , .loadCB= MapConfigLoad},
+ {.key=NULL}
+};
+
+```
+
+## 4) Do the controller config parsing at binding pre-init
+
+```C
+ // check if config file exist
+ const char *dirList= getenv("CTL_CONFIG_PATH");
+ if (!dirList) dirList=CONTROL_CONFIG_PATH;
+
+ const char *configPath = CtlConfigSearch(apiHandle, dirList, "prefix");
+ if(!confiPath) return -1;
+
+ ctlConfig = CtlConfigLoad(dirList, ctlSections);
+ if (!ctlConfig) return -1;
+```
+
+## 5) Execute the controller config during binding init
+
+```C
+ int err = CtlConfigExec (ctlConfig);
+``` \ No newline at end of file