summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2018-08-08Fix wrong computed lengthRomain Forlot1-2/+2
Change-Id: I020a1619c94a3a22d66e6657f64d4cedda3a1e62 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-08-08Add path to the installed widget path.Romain Forlot1-8/+24
This resolves the link to the binding library then set the directory path to the widget installation location. Change-Id: Iaad0d8aad6e3b8bfdcdedde19fb7906adf5f9610 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-08-08Controller: Converted README to a gitbook version.CorentinLGS17-417/+1431
-Split the README into a gitbook documentation. Change-Id: Iacf94e94d15606d68c925885dac5233d828f29b7 Signed-off-by: CorentinLGS <corentinlgs@gmail.com>
2018-07-30New defaults useful functions on lua tableRomain Forlot1-0/+21
Add a function that returns the size of a table as the operator '#' isn't considered are safe or accurate. Add another function to deep copy a table. Change-Id: Ia549315e305dd7d02b975a3e8a1278c4ab709eec Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-27More precise log message when loading a Lua fileRomain Forlot3-12/+15
This will indicates what is the error at the LUA file loading Change-Id: I258bf43a2200577998e05cf7b2253bdd510a468e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-26Fix: wrong legacy function signatureRomain Forlot1-1/+1
Old function had not the third argument. Change-Id: Ifdcf341c0339aff80f9a6741f63ae0e7f8fae682 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-25Split loading JSON controller file.Romain Forlot2-15/+18
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-23Release arguments once C function returned.Romain Forlot1-1/+2
There was a leack after poping arguments from Lua interpreter. Now when a Lua2C function is called, if there is something to keep from the argument then you should call json_object_get() on it to preserve it. Change-Id: I43e79ed73a507ac2ca7ed4cdc3f16ec009392194 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-23Fix : typo introduced in a previous commit.flounder_5.99.2flounder/5.99.25.99.2Romain Forlot1-1/+1
Wrong function signature. Change-Id: I20794a0ae59fc54c08f0960544185e7ba42b2627 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-23Fixed character counting that was shortening paths8000ff1-2/+2
Change-Id: I16e2f87980229b08426060ec062615d2fa3c1494 Signed-off-by: 8000ff <clementmallejac@gmail.com>
2018-07-20Keep json unmodified during action executionJonathan Aillet1-7/+12
Keep passed json object unmodified during action execution. Before, the action arguments were added in the json passed (so, the json was modified, even for its provider). Now, if action arguments need to be added to the json to execute an action, 'ActionExecOne' function clone the passed json object, add action arguments into it, and use it to call the action. Change-Id: If102cc943326c17aad52cfde735362a72ad35a9a Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-07-17Use prefix variable to find controller's pluginsRomain Forlot7-61/+70
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-10Use binding version to set controller definitionsJonathan Aillet1-5/+2
Use binding version to set controller definitions. It is cleaner to define binding version directly into repository cmake than into a header like before this commit. Change-Id: Ie0f2812c8ac980e69ff901fb6e347f47f284f21b Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-07-10ctl-lua: typo fixClément Bénier1-43/+43
change LUA_FIST_ARG into LUA_FIRST_ARG Change-Id: Ie084e78f68dd0a29c4dfc8387200be9af5180647 Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2018-07-10asynchronism for test: LockWait addedClément Bénier3-8/+40
added LockWait to wait for incoming events, as soon as an event is received, the wait is unlocked You can indicate the timeout Change-Id: If29ca754618edb5b9fdc32c1c40b47016c6fc88a Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2018-07-09Fix: plugin api assignement orderRomain Forlot1-2/+1
There was an issue because the assignement happens after the onLoad call. Change-Id: I97dc65ad2a14a6e72bb2f59bc443d9fc5779abee 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-07-03Always set the api member even if NULL.Romain Forlot1-1/+2
This should fix case where plugin doesn't have an onload section but need to set the apihandle to be able to use it later. Change-Id: I07d4d38ce236732575d97a3c0a01cb03acad255a Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-03Ability to add a plugin after the initial loadRomain Forlot1-13/+56
Plugins normally lie in a dedicated section and loaded once for all. With this function we are able to load a plugin after the initial load. Change-Id: Iebacdfce836767089f164ebe5cff72c7e45803be 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 Forlot2-10/+28
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-27Change LUA package path at LUA interpreter loadRomain Forlot1-0/+33
Set package.path lua variable use the CONTROL_PLUGIN_PATH as it could have to find external lua packages in those directories. Change-Id: Iebea763782cfc024c5fef1fdbefe8ed80dbc4dbb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-06-26Don't load two times a plugin even for LUARomain Forlot1-12/+13
Also detect problems when loading the script and report it. Change-Id: Iba22dcd0bbc6d7c307b5b7f66a56688ef3147250 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-06-18Fixed null value when push Lua argumentsSebastien Douheret1-13/+13
Still print a notice message when pushing a null object because having a null object in LUA may be problematic and it's always a good idea to warn developer. Also use json_object_to_json_string (safer than json_object_get_string in case of object is not a string) to dump json object in notice/debug messages. Change-Id: Ia3c252f38cbeca872b8f8fab1589da85d71a51ec Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-06-14Adjust to compile with incoming bindings v3José Bollo2-7/+9
Change-Id: I0a3a1db6dacf017ecea5b91dc35eb3ec2d86515d Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-14Remove declaration to not existing functionsJosé Bollo1-3/+0
Change-Id: Ib1b300e589b08d3172c5b6aeaa8ef33df2c4fc65 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
2018-06-13Add 2 lua utilities functionRomain Forlot1-0/+50
Sleep function and a recursive table equality function Change-Id: I4cb3a0f0909674f03caeadeebd8da35f16391198 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-06-11Update README.md for new metadata keys.Jonathan Aillet1-0/+2
Update README accordingly to new metadata keys. These keys was added in the commit : 'Handle more metadata in the controller'. Change-Id: Icdee5bdf4a6cf0d8b8bd5dde4adc3bbf04653a50 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-07Fix a compilation issue due to modif of AFB_ReqSuccessJonathan Aillet1-4/+4
The recent correction of the misspelling of AFB_ReqSuccess wasn't done in every file and results into a compilation error. This is corrected now. Change-Id: Ic378cbec105ab922d4195e6e525bf3a642895665 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-07README:md: update README accordingly to new json scheme.Clément Bénier1-10/+372
README.md synchronizes from deprecated repo https://github.com/iotbzh/afb-controller. Remove all audio stuff, update new config, running, satisfy new json scheme from http://iot.bzh/download/public/schema/json/ctl-schema.json. Change-Id: I77d858026aaf4a907018b1754b918c0fd141be31 Signed-off-by: Clément Bénier <clement.benier@iot.bzh>
2018-06-07Fixed crash due to call to json_object_putSebastien Douheret1-1/+0
Call to json_object_put seems no longer needed in LuaAfbSuccess. Change-Id: I2ee850605633b953217b3ad52a4a11059e841be3 Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-06-07Fix segfault when printing long message from luaSebastien Douheret1-4/+6
Change-Id: Idb3cb8ebe94cc1670e8757c6ff713ab7ef107a8b Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-06-07Fixed spelling of AFB_ReqSuccessSebastien Douheret5-6/+6
Also change event message from notice to debug level. Change-Id: I8dc891343ee7f744ea0e3c07455806eaf34c1d7e Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
2018-06-06Remove an unnecessary variableJonathan Aillet1-3/+1
This variable was meant to save the result of a function call, and be used into an 'if' statment. So, the function call was put directly into the 'if' statment. Bug-AGL: SPEC-1405 Change-Id: Ia352f5bbf310eadd91a19d80b813dc9f6d054028 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-06Make parsing of action loading non blockingJonathan Aillet1-1/+1
When an action is loaded in controller, parsing the json passed to describe the action was sending back an error if an unknown field was present. Now, the parsing just ignore unknown fields. Bug-AGL: SPEC-1405 Change-Id: If95144ad6190d5d2a45d731e82b28ab4caae7c32 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-06-01Use an external file for app fw functions linkJonathan Aillet2-120/+145
Use an external file for application framework include, for macro, and for typedef definitions used by the controller. In this way, it will be possible to include this file without getting all the specific controller definitions. Also define the correct version needed by the application framework for dynamic api. Change-Id: Ifaa09538f49ff2739eeb6a75527767961a2ef3b0 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-05-31Use macro to test request validityJonathan Aillet1-3/+3
Use macro to test request validity before reponding to an api call. This macro handles if request is a pointer or a structure (depending if dynamic api are used). Change-Id: I2cd6539e0fe0b6e0324e82fbeef62731d0323be9 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-05-29Fixed build warnings with gcc >= 7.3Sebastien Douheret4-6/+6
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-28Increase lua script max message sizeJonathan Aillet1-1/+1
Increase lua script max message size to avoid app-controller warning messages when a lua print message is too long with 4a-softmixer. Change-Id: I3c2496ea3e5bd971b7682328f7a6227e36b6d706 Signed-off-by: Jonathan Aillet <jonathan.aillet@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-28Correct way that api actions are handled in controllerJonathan Aillet1-23/+25
Don't create a new object each time a action is executed. Correction in the way that args are added in the api query. Correction to return the response of the api call if received. Optimization of how get/put are done in 'ActionExecOne' function. Change-Id: I30d0d6450599b7da7bfa9ad29b21d1be8ea6243e Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-05-28Handle more metadata in the controller.Jonathan Aillet2-5/+9
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 Bultel4-9/+9
Replaced some 'size_t' by 'int' Change-Id: Iaf58b4b65f9aa2e82c0a87af45f21ca62fa4d84e Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
2018-05-18Add an external field to CtlConfigTJonathan Aillet1-0/+1
Add an external field to CtlConfigT to store external data (by casting to void *). Change-Id: I368319f4cde6dc0409b5672809cc19a08e43dd67 Signed-off-by: Jonathan Aillet <jonathan.aillet@iot.bzh>
2018-05-18Make action item from a LUA action mandatoryRomain Forlot1-13/+1
It is already mandatory from a JSON schema point of view so here it should be the same. Also it simplifies the process avoiding the guess and deduction... Change-Id: I3197b4c7798589f4c62814407909270cdabd1dae Signed-off-by: Romain Forlot <romain.forlot@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 Forlot5-58/+75
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-18Update to the new JSON syntaxRomain Forlot1-1/+1
Change-Id: I4ee750f4d95e9fe47352e6cd1dfaeaa94c292e30 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-05-18Detect failure at OnLoad action callsRomain Forlot4-5/+12
Be able to detect that an action has failed on an Onload section processing to avoid retrieving a wrong context after that. Change-Id: If694b11eb0a37154b539c421e43bebdb15d498c0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>