aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/builtin.cpp21
-rw-r--r--plugins/gps.c2
-rw-r--r--plugins/low-can.cpp6
3 files changed, 10 insertions, 19 deletions
diff --git a/plugins/builtin.cpp b/plugins/builtin.cpp
index ab85bb7..4f2d239 100644
--- a/plugins/builtin.cpp
+++ b/plugins/builtin.cpp
@@ -24,25 +24,12 @@
#include <string.h>
#include "signal-composer.hpp"
-#include "ctl-config.h"
#include "wrap-json.h"
extern "C"
{
CTLP_LUA_REGISTER("builtin");
-// Call at initialisation time
-/*CTLP_ONLOAD(plugin, handle) {
- pluginCtx = (struct signalCBT*)calloc (1, sizeof(struct signalCBT));
- pluginCtx = (struct signalCBT*)handle;
-
- AFB_NOTICE ("Signal Composer builtin plugin: label='%s' info='%s'",
- plugin->uid,
- plugin->info);
-
- return (void*)pluginCtx;
-}*/
-
CTLP_CAPI (defaultOnReceived, source, argsJ, eventJ)
{
struct signalCBT* ctx = (struct signalCBT*)source->context;
@@ -81,9 +68,15 @@ CTLP_LUA2C (setSignalValueWrap, source, argsJ, responseJ)
*responseJ = json_object_new_string("Fail to unpack JSON arguments value");
return -1;
}
+ *responseJ = json_object_new_string(json_object_to_json_string(argsJ));
struct signalValue result = resultNum;
- ctx->setSignalValue(ctx->aSignal, timestamp*MICRO, result);
+
+ if(ctx->aSignal)
+ {ctx->setSignalValue(ctx->aSignal, timestamp*MICRO, result);}
+ else
+ {ctx->searchNsetSignalValue(name, timestamp*MICRO, result);}
+
return 0;
}
diff --git a/plugins/gps.c b/plugins/gps.c
index a4dfdba..af594fa 100644
--- a/plugins/gps.c
+++ b/plugins/gps.c
@@ -28,7 +28,7 @@
#include "ctl-plugin.h"
#include "wrap-json.h"
-CTLP_LUA_REGISTER("gps");
+CTLP_CAPI_REGISTER("gps");
// Call at initialisation time
/*CTLP_ONLOAD(plugin, api) {
diff --git a/plugins/low-can.cpp b/plugins/low-can.cpp
index 27089e1..5d4ef10 100644
--- a/plugins/low-can.cpp
+++ b/plugins/low-can.cpp
@@ -17,20 +17,18 @@
*/
#define AFB_BINDING_VERSION 2
+#define CTL_PLUGIN_MAGIC 1286576532
#include <afb/afb-binding.h>
#include <systemd/sd-event.h>
#include <json-c/json_object.h>
#include <stdbool.h>
#include <string.h>
-#include "ctl-plugin.h"
-#include "wrap-json.h"
-
#include "signal-composer.hpp"
+#include "wrap-json.h"
extern "C"
{
-
CTLP_CAPI_REGISTER("low-can");
typedef struct {