aboutsummaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/clientApp.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-04-25 11:00:12 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-05 15:43:09 +0200
commit872dd097432a3fb4fb91d24d227486a59be5e24a (patch)
tree3f3ae7cdcb6dd222f39370fff55bfa1912ba1aff /signal-composer-binding/clientApp.cpp
parent7229918a064a862c51217f1294a320c7260da937 (diff)
Improve signal handling
- 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>
Diffstat (limited to 'signal-composer-binding/clientApp.cpp')
-rw-r--r--signal-composer-binding/clientApp.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/signal-composer-binding/clientApp.cpp b/signal-composer-binding/clientApp.cpp
index 854f96e..45c43e6 100644
--- a/signal-composer-binding/clientApp.cpp
+++ b/signal-composer-binding/clientApp.cpp
@@ -25,9 +25,13 @@ clientAppCtx::clientAppCtx(const char* uuid)
void clientAppCtx::update(Signal* sig)
{
json_object* sigJ = sig->toJSON();
- if(afb_event_push(event_, sigJ) == 0)
- {sig->delObserver(this);}
- return;
+
+ if(afb_event_is_valid(event_)) {
+ if(!afb_event_push(event_, sigJ))
+ {sig->delObserver(this);}
+ }
+ else
+ {json_object_put(sigJ);}
}
void clientAppCtx::appendSignals(std::vector<std::shared_ptr<Signal>>& sigV)