summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-18 14:30:01 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commitc7d508ecd4c57b1f8f372f4e5042d834b7f42ff4 (patch)
treec96a5a03cea86db6266204b8d4efd371e5664321 /signal-composer-binding
parent08571bc92a047bac2de2f2f133277e6b1fa4ffb6 (diff)
Make callback from plugin work
Can't shared C++ symbol easily with plugin so workaround with a separate static function that handle the job Change-Id: I1208b51bc47c2daa5f08e10b25260cf206f90aed Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding')
-rw-r--r--signal-composer-binding/signal-composer.cpp13
-rw-r--r--signal-composer-binding/signal-composer.hpp7
2 files changed, 19 insertions, 1 deletions
diff --git a/signal-composer-binding/signal-composer.cpp b/signal-composer-binding/signal-composer.cpp
index 8ad8c3b..b29df22 100644
--- a/signal-composer-binding/signal-composer.cpp
+++ b/signal-composer-binding/signal-composer.cpp
@@ -19,10 +19,21 @@
#include "signal-composer.hpp"
+extern "C" void setSignalValueHandle(const char* aName, long long int timestamp, struct SignalValue value)
+{
+ std::shared_ptr<Signal> sig = bindingApp::instance().searchSignal(aName);
+ if(sig)
+ {sig->set(timestamp, value);}
+}
+
+static struct pluginCBT pluginHandle = {
+ .setSignalValue = setSignalValueHandle,
+};
+
CtlSectionT bindingApp::ctlSections_[] = {
[0]={.key="plugins" ,.label = "plugins", .info=nullptr,
.loadCB=PluginConfig,
- .handle=&bindingApp::instance()},
+ .handle=&pluginHandle},
[1]={.key="sources" ,.label = "sources", .info=nullptr,
.loadCB=loadSourcesAPI,
.handle=nullptr},
diff --git a/signal-composer-binding/signal-composer.hpp b/signal-composer-binding/signal-composer.hpp
index 2c7c2e2..341eaab 100644
--- a/signal-composer-binding/signal-composer.hpp
+++ b/signal-composer-binding/signal-composer.hpp
@@ -55,3 +55,10 @@ public:
int execSubscription() const;
};
+
+struct pluginCBT
+{
+ void (*setSignalValue)(const char* aName, long long int timestamp, struct SignalValue value);
+};
+
+extern "C" void setSignalValueHandle(const char* aName, long long int timestamp, struct SignalValue value);