diff options
author | Romain Forlot <romain.forlot@iot.bzh> | 2017-09-25 18:29:48 +0200 |
---|---|---|
committer | Romain Forlot <romain.forlot@iot.bzh> | 2017-12-14 11:00:25 +0100 |
commit | b7dd0a6e19d5387bc8d499bd1b3a99d457fa58d9 (patch) | |
tree | 0d1a26964435e8f91b96713e2b5beb3c1e94d0b2 /plugins/low-can.cpp | |
parent | db45a68715c07e6b8fe35e322ddcbbc6c473cb2b (diff) |
Enhance pointer manage and container browsing
- 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>
Diffstat (limited to 'plugins/low-can.cpp')
-rw-r--r-- | plugins/low-can.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/plugins/low-can.cpp b/plugins/low-can.cpp index 62f10f3..c4f79d2 100644 --- a/plugins/low-can.cpp +++ b/plugins/low-can.cpp @@ -112,7 +112,6 @@ CTLP_CAPI (subscribeToLow, source, argsJ, eventJ, context) { AFB_ERROR("Error building subscription query object"); return err; } - json_object_array_add(pluginCtx->subscriptionBatch, subscribeArgsJ); } else @@ -142,29 +141,29 @@ CTLP_CAPI (isOpen, source, argsJ, eventJ, context) { return -1; } - struct SignalValue value = { + struct signalValue value = { .hasBool = true, .boolVal = eventStatus, .hasNum = false, .numVal = 0, .hasStr = false, .strVal = std::string() }; if(strcasestr(eventName, "front_left")) { - pluginCtx->pluginHandle->setSignalValue(eventName,(long long int)timestamp, value); + pluginCtx->pluginHandle->setsignalValue(eventName,(long long int)timestamp, value); setDoor(&pluginCtx->allDoorsCtx.front_left, eventName, eventStatus); } else if(strcasestr(eventName, "front_right")) { - pluginCtx->pluginHandle->setSignalValue(eventName,(long long int)timestamp, value); + pluginCtx->pluginHandle->setsignalValue(eventName,(long long int)timestamp, value); setDoor(&pluginCtx->allDoorsCtx.front_right, eventName, eventStatus); } else if(strcasestr(eventName, "rear_left")) { - pluginCtx->pluginHandle->setSignalValue(eventName,(long long int)timestamp, value); + pluginCtx->pluginHandle->setsignalValue(eventName,(long long int)timestamp, value); setDoor(&pluginCtx->allDoorsCtx.rear_left, eventName, eventStatus); } else if(strcasestr(eventName, "rear_right")) { - pluginCtx->pluginHandle->setSignalValue(eventName,(long long int)timestamp, value); + pluginCtx->pluginHandle->setsignalValue(eventName,(long long int)timestamp, value); setDoor(&pluginCtx->allDoorsCtx.rear_right, eventName, eventStatus); } else |