diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2018-07-22 12:45:13 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2018-07-23 09:52:41 +0200 |
commit | 3b08cec1ad06f313374bc1fd9cc64e1b28ce798d (patch) | |
tree | 474eeb22cda79134562cdd66dea01ceaf7280cdd /signal-composer-binding/signal-composer.cpp | |
parent | 1eb97bc1126943b2d2a3ef631ed019231ba06da5 (diff) |
Adds a signal's metadata attributeflounder_5.99.2flounder/5.99.25.99.2
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>
Diffstat (limited to 'signal-composer-binding/signal-composer.cpp')
-rw-r--r-- | signal-composer-binding/signal-composer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/signal-composer-binding/signal-composer.cpp b/signal-composer-binding/signal-composer.cpp index 535e85b..99129b4 100644 --- a/signal-composer-binding/signal-composer.cpp +++ b/signal-composer-binding/signal-composer.cpp @@ -220,8 +220,9 @@ int Composer::loadSourcesAPI(AFB_ApiT apihandle, CtlSectionT* section, json_obje int Composer::loadOneSignal(json_object* signalJ) { json_object *onReceivedJ = nullptr, - *dependsJ = nullptr, - *getSignalsArgs = nullptr; + *dependsJ = nullptr, + *metadataJ = nullptr, + *getSignalsArgs = nullptr; CtlActionT* onReceivedCtl; const char *id = nullptr, *event = nullptr, @@ -232,13 +233,14 @@ int Composer::loadOneSignal(json_object* signalJ) ssize_t sep; std::shared_ptr<SourceAPI> src = nullptr; - int err = wrap_json_unpack(signalJ, "{ss,s?s,s?o,s?o,s?i,s?s,s?F,s?o !}", + int err = wrap_json_unpack(signalJ, "{ss,s?s,s?o,s?o,s?i,s?s,s?o,s?F,s?o !}", "uid", &id, "event", &event, "depends", &dependsJ, "getSignalsArgs", &getSignalsArgs, "retention", &retention, "unit", &unit, + "metadata", &metadataJ, "frequency", &frequency, "onReceived", &onReceivedJ); if (err) @@ -335,7 +337,7 @@ int Composer::loadOneSignal(json_object* signalJ) else {onReceivedCtl = convert2Action(uid, onReceivedJ);} if(src != nullptr) - {src->addSignal(id, event, dependsV, retention, unit, frequency, onReceivedCtl, getSignalsArgs);} + {src->addSignal(id, event, dependsV, retention, unit, metadataJ, frequency, onReceivedCtl, getSignalsArgs);} else {err = -1;} |