summaryrefslogtreecommitdiffstats
path: root/docs/Usage.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/Usage.md')
-rw-r--r--docs/Usage.md104
1 files changed, 52 insertions, 52 deletions
diff --git a/docs/Usage.md b/docs/Usage.md
index e89aade..420d42a 100644
--- a/docs/Usage.md
+++ b/docs/Usage.md
@@ -1,5 +1,56 @@
# Usage
+## Add libappcontroller as a static library to your binding
+
+In your `config.cmake` file, add a dependency to the controller library, i.e:
+
+```cmake
+set(PKG_REQUIRED_LIST
+ json-c
+ afb-daemon
+ appcontroller --> this is the controller library dependency name.
+)
+```
+
+Or you can also use the [FIND_PACKAGE](https://cmake.org/cmake/help/v3.6/command/find_package.html?highlight=find_package)
+CMake command to add it.
+
+## 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}
+};
+
+```
+
+## 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;
+```
+
+## Execute the controller config during binding init
+
+```C
+ int err = CtlConfigExec (ctlConfig);
+```
+
## (Optional) Migrate from the git submodule version
### Remove the git submodule version
@@ -133,55 +184,4 @@ should migrate:
#define AFB_ApiOnEvent afb_api_on_event
#define AFB_ApiOnInit afb_api_on_init
#define AFB_ApiSeal afb_api_seal
-```
-
-## Add libappcontroller as a static library to your binding
-
-In your `config.cmake` file, add a dependency to the controller library, i.e:
-
-```cmake
-set(PKG_REQUIRED_LIST
- json-c
- afb-daemon
- appcontroller --> this is the controller library dependency name.
-)
-```
-
-Or you can also use the [FIND_PACKAGE](https://cmake.org/cmake/help/v3.6/command/find_package.html?highlight=find_package)
-CMake command to add it.
-
-## 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}
-};
-
-```
-
-## 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;
-```
-
-## Execute the controller config during binding init
-
-```C
- int err = CtlConfigExec (ctlConfig);
-```
+``` \ No newline at end of file