summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer.cpp
AgeCommit message (Collapse)AuthorFilesLines
2018-11-23Binding migration to v3guppy_6.99.1guppy/6.99.16.99.1Romain Forlot1-32/+27
Change-Id: I8a5bc18a0bf8ad05ce83b6ff64d4329d42bff2b0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-09-27Fix wrong JSON unpack typeRomain Forlot1-15/+22
This correct the retention value extraction as an 'int' instead of a Json object. Also made 'api' field mandatory. Format and improve log messages. Change-Id: I00b337839a49fc1952be8589b48bf1a38b863549 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-09-27Handle errors on signal initializationRomain Forlot1-4/+7
This reports errors at signals getSignals action call and removed incorrect signals from the source. This allows the binding to correctly respond to the user if there was an error in its signal definitions. Change-Id: I7779ab9339a979fcb2b7b41f8ebf4aa27b8af3a1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-08-08Typos, cleaning.flounder_5.99.3flounder/5.99.35.99.3Romain Forlot1-18/+2
Change-Id: I1f2b7484216271f97205cb9933bfd5ef2990bb2e Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-31Returns error in request responseRomain Forlot1-33/+35
Returns error in request response instead of binder log when you try to get a signal value. Change-Id: I12809591801db5718aa4713034f2bb1801b6bf2d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-27Fix: wrong default getSignals action defined.Romain Forlot1-4/+3
Since last controller changes this hardcoded default action definition. Change-Id: I0021fef000b2085efe0deda550cff243afd6711d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-25Improved performanceRomain Forlot1-51/+11
Before value was translated to a C type variable two times, at the reception then at the emission. Now it just receives and sends the signal value without translation nor interpretation except if you ask for an average, minimum or maximum value. Then in those cases it interprets the json to return you a value or an error if there is no numeric values to compute. Remove unneeded log message at event reception. Improved signal search engine, will search in source's signals map by the signal ID not the event name which lead to a more direct map match. Bugs-AGL: SPEC-1612 Depends-On: I43e79ed73a507ac2ca7ed4cdc3f16ec009392194 Change-Id: Ie253c3fe1e8cde42dabe8832da74e9f9bf442c14 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-23Adds a signal's metadata attributeflounder_5.99.2flounder/5.99.25.99.2Romain Forlot1-4/+6
This adds a signal's metadata attribute which lets you store any kind and number of metadata attributes to your signal. These metadata are just reissued at the event emission without alteration. Special case of "unit" attribute which is kept as a signal attribute and not as a metadata because it is an intrinsic signal attribute that all signals should have. Bug-AGL: SPEC-1419 Change-Id: I531b4012ac9b22f312a4ccebc1a07a8d93129403 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-22Fix the build for master with latest binderRomain Forlot1-4/+4
Update config.cmake file with app-templates improvments: - Now versioning is handled by app-templates based on gerrit tags - Binding version set up in config.cmake rather than in code. - Update variables name for build type and install prefix. Submodule afb-helpers 43ec971..a37225f: > Fix: use of GetBindingDirPath without dynapi > Retrieve directory list from environment variables > Remove the file .gitmodules > Remove unnecessary 'AFB_DEBUG' redefinition > Use binding version to handle dynapi > At search, use the prefix parameter as a prefix > Remove deprecated use of cmake/Qt macro > Rename method to avoid conflict with Qt's one Submodule conf.d/app-templates aa68dbd..f94e45e: > Align sample on actual default compile options > Add support to binding version 3. > Warning if not using wgtpkg-pack to make a widget > Rework CMAKE_INSTALL_PREFIX and INSTALL_PREFIX var > Be able to overwrite BUILD_TYPE using CLI > Use CACHE variable for other common CMAKE variable > Fix:: wrong wgt using RELEASE BUILD TYPE > Fix: SYSROOT location detection... Wrong test. > Change the default debug compilation options. > Clearer coverage compilation options configuration Submodule ctl-utilities 1ff524b..ff14c58: > Fix : typo introduced in a previous commit. > Use prefix variable to find controller's plugins > Use binding version to set controller definitions > ctl-lua: typo fix > asynchronism for test: LockWait added > Fix: plugin api assignement order > Execute ConfigExec only if section is existing > Always set the api member even if NULL. > Ability to add a plugin after the initial load > Be able to dispatch required api at the wanted time Depends-On : I135a723d21d70b8c54f4cab1c534210757318ed0 Change-Id: I90938f53dd1f606b3aa39a549e618c0fe413870c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-05Update submodulesRomain Forlot1-1/+1
Submodule conf.d/app-templates 6e1a3c3..aa68dbd: > Don't overwrite the autobuild script if it exists > Disable the in-tree build method. > Detect Yocto as OS distribution > Fix: wrong compile options added > Fallback using zip format if no wgtpkg-pack found > 02-variables.cmake: Avoid checking CXX version if not required > config.cmake.sample: Remove dependency to libsystemd > config.cmake.sample: Remove dependency to libmicrohttpd > Added -D_FORTIFY_SOURCE=2 to CFLAGS > start-on-target: uses RSYNC_PREFIX path for config > Fixed spelling. > Improve OS detection > Fix: OS detection > Launch from workdir > Change closing that could fix native debugging Submodule ctl-utilities 0129510...1ff524b: > Change LUA package path at LUA interpreter load > Don't load two times a plugin even for LUA > Fixed hidden bound variable (apiHandle) > Fixed null value when push Lua arguments > Adjust to compile with incoming bindings v3 > Remove declaration to not existing functions > Add 2 lua utilities function > Update README.md for new metadata keys. > Fix a compilation issue due to modif of AFB_ReqSuccess > README:md: update README accordingly to new json scheme. > Fixed crash due to call to json_object_put > Fix segfault when printing long message from lua > Fixed spelling of AFB_ReqSuccess > Remove an unnecessary variable > Make parsing of action loading non blocking > Use an external file for app fw functions link > Use macro to test request validity > Fixed build warnings with gcc >= 7.3 > Increase lua script max message size > Prevent lost of config file path when searching > Correct way that api actions are handled in controller > Handle more metadata in the controller. > Add possibility to set prefix to NULL in CtlConfigScan > Fixed compilation warnings with gcc-7.2.0 > Add an external field to CtlConfigT > Make action item from a LUA action mandatory > Handle no prefix given > Good usage of strncat and strncpy > Update to the new JSON syntax > Detect failure at OnLoad action calls > Improve reliability and function calls > Correctly release request JSON object > Add AFB macros > Don't use assert in controller. > Change lua2c JSON syntax. > Search for Event section > Fix: changes key name. > Fix: arguments pointer NULL check > Fix wrong error message. > Simplify action definition > Fix: Dyn API Action loading procedure > Use new version of function GetBindingDirPath > Format > Merge changes from topic 'sandbox/claneys/wip' > Upgrade config schema > Fix: callback execution condition < Format < Fix: callback execution condition < New action loading function. < Upgrade config schema Adapt json config file to new syntax Fix: prefix now add the "-" so it'isn't needed to add it in the prefix at search (signal-composer.cpp) Fix: calling a api verb without json_object fails because of config arguments not retrieved. (sources.cpp) Change-Id: I48c1bca9fbac485e6a34b4645e683d9bdb1cbf2b Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-05Rework loading sources and signals.Romain Forlot1-41/+23
Some function that are now included in the controller submodule do not need to be in the composer as well. Also initialize sources and signals in the same way . JSON configuration needs to be updated to fit this changes Change-Id: I2043791e7ee80f8350f33ed15bdf9980c0773b82 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-05Move "action" load to controllerRomain Forlot1-136/+11
Change-Id: Ic1a0621d9c0bbbffb7dcc0f9daf148a372818cdb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-05Improve signal handlingRomain Forlot1-2/+2
- Fix memleak: RRelease the Signal JSON representation once used - Change equality condition between signals - Use a REALTIME clock to retrieve the timestamp if not provided by the signal. This is the most simple to date a signal and use that time for further usage. - Add a method to retrieve the last_timestamp value from a signal This with the commit from ctl-utilities submodule "8ff0fe3c454ea32ba383a3cfa9c4e91237d6c494" fixes the issue. Change-Id: Ifed66796f92d789c80f10b161318f6bef788dda7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-05Initialize sources at binding start.Romain Forlot1-3/+14
This has changed and is now explicitly launched because last step of Controller configuration doesn't execute it. Change-Id: I104011b912172da62114b62eeab90c76e41459dd Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-03-22Linting, wrong variable type used.Romain Forlot1-6/+6
Change-Id: Ia3c79b64a44585f7d46e3cda5fbbc59b35322d5f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-03-21Linting improvments.Romain Forlot1-5/+6
Uninitiliazed variable in submodule Better handling of iterator assigments Avoid multiple call to vector.size() function Change-Id: I9cc8431e71b7d614a1619615a4048f19f5e31540 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-21Don't segfault at exit pointed to freed objectsRomain Forlot1-3/+6
Change-Id: Ic2f8ebee552ce982f858fe6ee93db2508a290617 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-19Bulk of small fixesRomain Forlot1-2/+2
Correctly grab lua script using simpler prefix Correctly free Composer object's members Adding default binding source as required-apis Change-Id: I91d34b636286e79c7bcc27f8ba2730897ec5f424 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-19Get builtin plugin as a normal pluginRomain Forlot1-44/+7
- Back in normal configuration file - Remove builtin special callback as it is just a plugin after all - Rename main configuration files to get it works on a target board. Change-Id: I69165c47e5e58eb519e727cfdd83ee628d90abba Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-19Update gitignore, minor fixRomain Forlot1-1/+0
Change-Id: I7f059cb6566461a96765be78841d97e9b70beee3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-18More security to add new signals/source at runtimeRomain Forlot1-4/+7
Also renamed loadConf to addObjects to avoid confusion with loadConf at init time. Improve file research if fullpath not procided by searching in the CONTROL_CONFIG_PATH. Change-Id: I8e541ff7437f0378bcdc7215ff9f391dcce6db9f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-18Several small fixes and improvements.Romain Forlot1-1/+1
Cleaning Make some additionnals test avoiding segfault, Filling opitonnal response object to avoid warning Wrong plugins type register macro called Change-Id: I012cc3ddc5f89b75dbc46c3ea535717141823884 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Fixing afb function call from LUA and cleaningRomain Forlot1-4/+0
Change-Id: I36d675ba7c38ce883a021da1a82dfbe8b077a39f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Avoid create duplicate source entries.Romain Forlot1-1/+11
Change-Id: If50a439634382fa6d1c856b5c3fb29db4eb93a31 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Fix memory leaks relative to json_objectRomain Forlot1-3/+14
Change-Id: I0cff16c1d44b9363522fde7c6c9b2bd10ba376ac Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Load additionnals object at runtimeRomain Forlot1-1/+31
Later integrated in controller submodule Change-Id: I7d5c7431e60fc16cc2053747674fe4f14efd6a14 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Hold all contexts (plugin & source) in signalCtx_Romain Forlot1-0/+1
Keeping persistence between call data are kept in that member also subscription Action now use getSignals_ context and no more the signal one, this is more accurate and simples Change-Id: Idd7c56ba30f1daa9eaf9b99a7261d58189ef0bb2 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Avoid warning about deleting void* variableRomain Forlot1-1/+1
And replace free calls by delete because operator new was used. Change-Id: Ifb0d301b0a09dd83e3ad574c97e02bd8af072ae6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh> # Conflicts: # signal-composer-binding/signal-composer.cpp
2017-12-14Avoid warning about deleting void* variableRomain Forlot1-1/+1
And replace free calls by delete because operator new was used. Change-Id: Ifb0d301b0a09dd83e3ad574c97e02bd8af072ae6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Avoid mem leack, overwriting, initializing variable.Romain Forlot1-6/+11
Fix a memory squashing bug that segfault binder when loading directory searching for binding. Change-Id: Iedc6747d8ce49e7ff5fc2013bb7d03b5b553b89c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Don't stop parsing signal even if one malformationRomain Forlot1-4/+3
Change-Id: I266dd03cde2c712ab1b2e713f0c57a89063f72e4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Controller object has changed: Fix building actionRomain Forlot1-36/+88
Change-Id: I055d1ad1f9f1305009f4237e56566784e2ecdcfb Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Update and use latest ctl-utilities.Romain Forlot1-39/+10
Controller will now handle loading additional files from section. Context retrieving change a bit, now we have source context and plugin context. Update json unpacking and packing. Cleaning, format. Change-Id: Ie7a4721f6b703796a0dac1a236922427f4755dc5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Typo, cleaning, formatRomain Forlot1-0/+1
Change-Id: Ibc0457d7395d336c9716e3ed7ca51b71c450f0db Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Update JSON obj to fit new controller libRomain Forlot1-1/+1
Change-Id: Ib6068ef81151bc61923ad6ec54048028033ca4af Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Migrate to ctl-utilities libraryRomain Forlot1-48/+116
New version of controller as a library. Loading additionnals files from each sections. Change-Id: I4f5e78d0baf9650cb8d1cc1da26f8e1fd73b792c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14LUA lib and bin embedded in projectRomain Forlot1-18/+62
Change-Id: I1a61b49f55e4daa305800e754a14b6041aa81b34 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Builtin plugin integrationRomain Forlot1-0/+21
Change-Id: I285c666c9ac77b6c1efb56406ce0a9cf33ec140f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Enhance list/get verbRomain Forlot1-14/+14
Handle options in a vector. Change-Id: Iafad2d93ea027db054750816750f4d07bd13c5d4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Inheritance of some signals parameters from sourceRomain Forlot1-38/+62
Stores sourceAPI as shared_ptr too. Change-Id: I2dcd919b3053f29812a9bece14feb4f620f23ce3 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Introduce retention setting in place of classRomain Forlot1-8/+8
Be able to tweak retention value for each signal in seconds Change-Id: I1cabe48a2660cdeb2e9b32b277e7c819c6b49bd9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14lua2c completely operationnalRomain Forlot1-6/+4
- Retrieve args from lua call correctly - Correctly push and set function pointer into plugin symbols Change-Id: I12d03e1101c458a042887a67a35a08082bd98f4c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Add a default behavior to subscribe to API signalsRomain Forlot1-1/+6
By default, if no getSignals action has been configured then a call to api/subscribe will occurs Change-Id: Ic54d7eb7c3117ccc0bf3c9819d14475d9145d61d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Enhance pointer manage and container browsingRomain Forlot1-21/+21
- SourceAPI now holds share_ptr of Signal - Signal are stored in a map<string,signal> that change way to browse the signals - subscribed property included in SourceAPI. - Clean old code - renaming struct SignalValue->signalValue Change-Id: Ic5c28296ddd7197c6562e12fbc91c504c1cc0b4d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14No errors on get if no values has been recordedRomain Forlot1-20/+35
Change-Id: Ib1d5da084b3a39fbfc9816070aba008e3486cfae Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Finalize subscription to be a simple relay for nowRomain Forlot1-29/+12
Adding new object holding signals subscribed and afb event that observes Signals using Reactive response observer design pattern Change-Id: I96647d36e0d27c25a399c1b3789621a803a845b6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14SubscribeRomain Forlot1-4/+20
Change-Id: I7bbe972254d60f89cb26c98ea8519af087d8ae90 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Rename bindingApp to ComposerRomain Forlot1-133/+160
Change-Id: Ib3256f5c89197a91d2bbfca7a92774e91de6f664 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Find all signals that matches the searched patternRomain Forlot1-39/+57
Change-Id: Ia562fbd90aaeaa57c1c731d0f66dd31865db7e71 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Make LUA worksRomain Forlot1-5/+16
- Added LUA library at link - Make app-template crash build if a checked file fails - Fix old defined variable CONTROL_LUA_PATH to a default one in the binding data directory - Add an example with unit conversion made in LUA Change-Id: I1b4712bde32a38044ad6b14ebd38b6782fd01fe9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>