aboutsummaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer-binding.cpp
AgeCommit message (Collapse)AuthorFilesLines
2021-01-25Fix potential memory leakneedlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin_12.92.0marlin_12.91.0marlin_12.90.1marlin_12.90.0marlin/12.93.0marlin/12.92.0marlin/12.91.0marlin/12.90.1marlin/12.90.0lamprey_11.92.0lamprey_11.91.0lamprey/11.92.0lamprey/11.91.0koi_10.93.0koi/10.93.013.93.012.93.012.92.012.91.012.90.112.90.011.92.011.91.010.93.0Li Xiaoming1-2/+7
allSignalsJ should be freed before function returns if its owership is not transfered. Bug-AGL: SPEC-3584 Change-Id: Ie6ff72684300b04297a2d314121807a0d1cbf1c3 Signed-off-by: Li Xiaoming <lixm.fnst@cn.fujitsu.com>
2019-12-29Add session uuid to subscribe repliesScott Murray1-1/+9
Add the session uuid to event subscribe replies to match the documented behavior and enable clients like libappcontroller based bindings and applications to be able to use it in their event handling. Bug-AGL: SPEC-3074 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I185165e600410190b30b1d8bd5a6ad8675b2b714
2019-04-11Git submodule migration to separated librariesRomain Forlot1-11/+11
Replace controller binder functions definition with the binder ones and remove the submodules in favor of the separated libraries. Bug-AGL: SPEC-2139 Change-Id: I06e5e7a03a918bf0ce139636104e1a73d2442a09 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-11-23Use specific binder's event handlersguppy_6.99.2guppy/6.99.26.99.2Romain Forlot1-49/+0
Use specific binder's event handlers which allows you to bind a callback with an incoming event based on a pattern matching. This replace the global event listener and internal callback search algorythm which is now delegated to the binder. Clean unused constructor Bug-AGL: SPEC-1968 Change-Id: I4b22c003661189fb71498efc4d9021c1a54ae866 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-11-23Binding migration to v3guppy_6.99.1guppy/6.99.16.99.1Romain Forlot1-15/+15
Change-Id: I8a5bc18a0bf8ad05ce83b6ff64d4329d42bff2b0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-09-27More accurate (un)subscribe answerRomain Forlot1-5/+12
Answer a failure when attempting to subscibe a non-existent signal but don't report error on unsubscription. Change-Id: Iac4bfe52ce84b47fbfa5717cd9ee2bf02231f52f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-09-27Handle errors on signal initializationRomain Forlot1-2/+8
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-09-27Fix: finding JSON file even if absolute path givenRomain Forlot1-2/+9
Here, assuming the absolute path leads to a non existent file then only take the file name and do a research in the default search path given by environment var or pre-processor defined variables. Change-Id: Id57428141be908cda65b07f66ca59568708d3608 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-08-23Fix: segfault at object additionRomain Forlot1-6/+12
JSON object release is done by the appfw so no need to release the object in the request. Tiny typo about the filepath in testsuite. Change-Id: I8347adafbb5fa8e9e3b89c2e6db74c37f4910adf Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-08-07Fix: segfault after adding new objectsRomain Forlot1-1/+0
This let the application framework handle the JSON object lifetime. Change-Id: Iff48f478d71e71e25ed79d2c7c13b45a7b6a7bf9 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2018-07-31Returns error in request responseRomain Forlot1-6/+16
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-25Improved performanceRomain Forlot1-3/+1
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-22Fix the build for master with latest binderRomain Forlot1-1/+1
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-3/+0
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-05Initialize sources at binding start.Romain Forlot1-0/+1
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-04-09Add objects directly from JSON argumentflounder_5.99.1flounder/5.99.15.99.1Romain Forlot1-9/+16
Change-Id: I77ab639593ecb3d73239244d11ee3da599caf1b4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-19Get builtin plugin as a normal pluginRomain Forlot1-1/+1
- 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-18More security to add new signals/source at runtimeRomain Forlot1-1/+8
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-14Improve subscription processRomain Forlot1-10/+15
Unsubscription remove asked signals from client session then when no more signals are requested by the client unsubscribe from event handle. Correctly initialize members to by correctly evaluated after Change-Id: Icabcb5a2446c62cab4eea9bf807613b719324ea0 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Check key exists before loading JSON fileRomain Forlot1-18/+25
Change-Id: I99d84fb56b01896caf6daa26ca50896f770ff509 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Fix memory leaks relative to json_objectRomain Forlot1-0/+3
Change-Id: I0cff16c1d44b9363522fde7c6c9b2bd10ba376ac Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Load additionnals object at runtimeRomain Forlot1-27/+23
Later integrated in controller submodule Change-Id: I7d5c7431e60fc16cc2053747674fe4f14efd6a14 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Migrate to ctl-utilities libraryRomain Forlot1-1/+1
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-2/+1
Change-Id: I1a61b49f55e4daa305800e754a14b6041aa81b34 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Better deeper signal search on received event.Romain Forlot1-2/+34
Search in received JSON data if we could find a better signal name if the preceding one is too fuzzy Change-Id: I83ba376890155c44d5f29dfe2401627c72539f34 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Enhance list/get verbRomain Forlot1-7/+3
Handle options in a vector. Change-Id: Iafad2d93ea027db054750816750f4d07bd13c5d4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14lua2c completely operationnalRomain Forlot1-1/+0
- 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-14Enhance pointer manage and container browsingRomain Forlot1-6/+6
- 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-3/+4
Change-Id: Ib1d5da084b3a39fbfc9816070aba008e3486cfae Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Use C++ string instead of C classic charRomain Forlot1-3/+3
Change-Id: I739a68e98623da4a6962c2d91025e4c0bfc222e1 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Implement recursionCheck using observer patternRomain Forlot1-3/+3
Change-Id: Ic404c098f316106abe1918c3cd100ae047f4f555 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Finalize subscription to be a simple relay for nowRomain Forlot1-36/+18
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-12/+41
Change-Id: I7bbe972254d60f89cb26c98ea8519af087d8ae90 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Beginning client App context handling workRomain Forlot1-24/+47
Change-Id: Ifb21916bfb4c9c1be0fe68c1a88ada342d18ffe4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Rename bindingApp to ComposerRomain Forlot1-12/+12
Change-Id: Ib3256f5c89197a91d2bbfca7a92774e91de6f664 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Find all signals that matches the searched patternRomain Forlot1-3/+40
Change-Id: Ia562fbd90aaeaa57c1c731d0f66dd31865db7e71 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Make LUA worksRomain Forlot1-7/+5
- 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>
2017-12-14Modification about conf definitionRomain Forlot1-7/+13
- Argument for each signal subscription. (getSignalsArgs) - differentiation between Signal as raw signal from another API and virtual signal depending upon other signals - changing way to specify function with uri that specify everythings that could be needed to invoke a function. Change-Id: I8917c5ae3c2c1e3fa48ddfdda41fc75eaba32bb7 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Implement list verbRomain Forlot1-3/+9
Change-Id: Id0e5c087ba17b2a2aee6f8ce9482f80a54926a7d Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Doxygen documentationRomain Forlot1-6/+4
Change-Id: I12efd66777cbc5217dfd68827f40727577df1406 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Adding new verb, implemented basic signal methodRomain Forlot1-1/+29
Change-Id: I453ddc0ca374436275e7d76cdc27b3d843a2770f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Subscription by plugin to signalsRomain Forlot1-9/+12
Change-Id: Icb923f87df2be8eb664106bc9077b3a8221dd3ce Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Attach and recursion check workingRomain Forlot1-6/+17
Change-Id: I2f9509d4b6aa63a16df8db2187810337fd802ef4 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Progression on config parsing.Romain Forlot1-27/+37
Change-Id: Idd8d8987ccabef381f6d79c1d508930a2d4bae3c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Controller src integrationRomain Forlot1-8/+22
Change-Id: I0b18cd55057a784d183a5ba02c332810a34d1fca Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
2017-12-14Initial commitForlot Romain [IoT.bzh]1-0/+90
Change-Id: I2bb38bffdd92602659670901b8442201b7c56214 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>