aboutsummaryrefslogtreecommitdiffstats
path: root/ctl-lib/ctl-config.c
AgeCommit message (Collapse)AuthorFilesLines
2018-07-25Split loading JSON controller file.Romain Forlot1-14/+16
This make possible to load from a binding either a file or directly a JSON object. Change-Id: If3f3edb8aaed066922982250dd162d483a7dc47a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-17Use prefix variable to find controller's pluginsRomain Forlot1-2/+8
Prefix is the most reliable variable to find files or variables for a controller, so this lets you access it wherever it is needed without using global hardcoded variables. This helps to search for controller's plugins in several locations depending on environment variables and hardcoded variables (CONTROL_PLUGIN_PATH, CONTROL_CONFIG_PATH). This implies also a change a LUA interpreter loading step to correctly set the package.path variables with the environment variables, too. Correct the missing 'extern' in function declarations. Depends-On: Ic448ff017e6158bec05895d63688b8968b5c6434 Change-Id: I0ad19242612559d1f4b66b6f9af9e7032d4675a8 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-05Execute ConfigExec only if section is existingRomain Forlot1-1/+1
Test again if the section is present in the configuration JSON object before executing the callback. Change-Id: Ibad352e8443d5d33d7e727fc3b80c56a377c75d3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-06-27Be able to dispatch required api at the wanted timeflounder_5.99.1flounder/5.99.15.99.1Romain Forlot1-10/+27
Separate the require api step from ConfigExec and if called from anywhere but CtlConfigExec function, take care that not already initialized or that the previous has failed, so this is a new try. Change-Id: Ic98ef09487f7f58c1b1cb6c417eba261a5a81b13 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-06-19Fixed hidden bound variable (apiHandle)Sebastien Douheret1-10/+10
Change-Id: Id4c3e0eb9f770c78b38d8650e6a89577851984f9 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-05-29Fixed build warnings with gcc >= 7.3Sebastien Douheret1-2/+2
Reduced the number of warnings in native host configuration (here Tumbleweed) in order to not hide true/real warnings that may appear in the future. Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-05-28Prevent lost of config file path when searchingJonathan Aillet1-3/+7
Prevent lost of config file path when searching by keeping only the first file found. Add a warning if multiple files are found. Change-Id: I97262c4dbbc53bb921ef25b9100491cf3e29a056 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-05-28Handle more metadata in the controller.Jonathan Aillet1-3/+5
Add fields that will be searched for during controller metadata section parsing. These fields are optional, so they will be copied in CtlConfigT if they are present. Otherwise, no error will be raised. The added fields are : - 'author' which should contain the author name of the configuration file. - 'date' which should contain the date of the configuration file last modification. Change-Id: Iab480533d85c4a52ea5f6a70fb6f9b8d0b866af4 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-05-28Add possibility to set prefix to NULL in CtlConfigScanJonathan Aillet1-1/+1
When prefix is set to NULL, only the middle name of the process will be used to find configuration files. Example: when the binder is named 'afb-4a-hal', and the prefix parameter is set to NULL, the 'CtlConfigScan' function will search for 4a-*.json config files in 'dirList' list. Change-Id: I8a9ee7df670d992f5461c865591ced9ba46fe8a0 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-05-22Fixed compilation warnings with gcc-7.2.0Thierry Bultel1-4/+4
Replaced some 'size_t' by 'int' Change-Id: Iaf58b4b65f9aa2e82c0a87af45f21ca62fa4d84e Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-05-18Handle no prefix givenRomain Forlot1-3/+8
If no prefix given, then only use the binder name to search config file. Change-Id: I504ea27dccb8892e12e09d3e9e42bc281bcf87b0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-18Good usage of strncat and strncpyRomain Forlot1-15/+24
This change ensure that there are no write over the destination buffer size Change-Id: Ic213e70fab83dfae39a8ff030c823a6ce68aab64 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-18Improve reliability and function callsRomain Forlot1-2/+4
Don't calls two times the same function. As well as avoiding using the function return to get its length Change-Id: I26c37f9a376b2c243ffd7a5ad0ddf935c8b5d0e9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-14Fix: Dyn API Action loading procedureRomain Forlot1-0/+5
Change-Id: Ibb7dbc32580100c588d06e283abb57cc37875312 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-14Use new version of function GetBindingDirPathRomain Forlot1-4/+5
That follow the last update in afb-helpers submodule used. Change-Id: Ia6149ae96c1591f3d0791f4263e8beafbe6e764d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-14FormatRomain Forlot1-24/+21
Change-Id: Ied901f39cd6814e5afd9811248b0a1fb401f3e76 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-09Upgrade config schemaRomain Forlot1-5/+0
Change the way to load LUA scripts. They are now considerate as Plugin and loads with them. This imply rework of how to search and find plugins as well as the way to load LUA. Also load an harcoded LUA scripts providing LUA helpers and managing global variables lock unlock mechanism Change-Id: I64e38aa27278d0cfdca787155db2d0c89953f905 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-09Fix: callback execution conditionRomain Forlot1-1/+1
Test the wrong pointer to know if there is a CB to execute. Action pointer could be void as the loading callback isn't stored in it. Change-Id: I3281cdd603cc8b90059331fcff694b354eae1db0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-04-25Format, get rid of conversion type warning.Romain Forlot1-8/+6
Change-Id: I8cde66dc613fd36e7061f45918520ecd1cdf2825 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-19Add binding rootdir to searched path for conf and pluginsRomain Forlot1-1/+13
Change-Id: I4526dd9afc76ac9c63ecb6e800157a0678485955 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-18Make public ConfigSearch functionRomain Forlot1-1/+1
Change-Id: I6da8b9d463ef9adc604bc59285189e45dfb63a7a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-11Avoid compile warning, memory leaks, lintingRomain Forlot1-7/+8
Change-Id: Ida18aeab20d5b894609c1a9c2f6fc2a71a0b4a23 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-11-29Loading additional files from JSON sectionRomain Forlot1-23/+46
Now handle "files" object inside section loading to externalize JSON definition and could split them in several files if needed. "files" could be specified inside a section object, each files will be parsed to found same key than the current section and append content to the existing section's objects Change-Id: I4414684d08c5214cf96b365f9b0a72b13578a6ca Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-11-24Remove C++ warning ISO/C++11Romain Forlot1-25/+87
Change-Id: I03afd7479f0db8189cad41fd3b0fcb756f373603 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-11-24Fix: strncpy does't add null char at the endRomain Forlot1-17/+19
Fix: handle null response from CtlScanConfig() Change-Id: Icbe2a649886998078adda35b0d0dfd1c46e8fe31 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-11-24fix: wrong usage of strncat and strncpy functionRomain Forlot1-7/+7
3rd arguments match strlen of 2nd arguments and should not match the maximum length of destination variable. Change-Id: Ifebf6097bb995d0cf2c5633eb94d52d4517ade7b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-10-26Avoid duplicated _GNU_SOURCE definition warningRomain Forlot1-4/+0
Change-Id: I2b805a60b67db1a72b429093256999673e2c3964 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-10-25FormatingRomain Forlot1-8/+8
Change-Id: I2b805a60b67db1a72b429093256999673e2c3964 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-10-24First working version as submoduleFulup Ar Foll1-7/+10
2017-10-181st V2/pre-V3 versionfulup1-54/+68
2017-09-29Remove NetbeansFulup Ar Foll1-0/+176