summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal.hpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-09-17 19:20:40 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-14 11:00:25 +0100
commit12097251ec058b1fa9d9202998c829b27ee5554f (patch)
tree415d2592913bfa0b980232ffbee09d6cfb48fd02 /signal-composer-binding/signal.hpp
parent5bbc6cb56995d23cb8a4eb584ef0161be092da1f (diff)
Get CPP controller plugin works
Context passing variables not working well Change-Id: Ibc67bef353e5cc2e53ef9e5579d106baab92a604 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/signal.hpp')
-rw-r--r--signal-composer-binding/signal.hpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/signal-composer-binding/signal.hpp b/signal-composer-binding/signal.hpp
index ac3b678..34e6ab1 100644
--- a/signal-composer-binding/signal.hpp
+++ b/signal-composer-binding/signal.hpp
@@ -24,19 +24,29 @@
class bindingApp;
+struct SignalValue {
+ bool hasBool = false;
+ bool boolVal;
+ bool hasNum = false;
+ double numVal;
+ bool hasStr = false;
+ std::string strVal;
+};
+
class Signal
{
private:
std::string id_;
std::vector<std::string> signalSigList_;
long long int timestamp_;
- double value_;
- std::map<long long int, double> history_; ///< history_ - Hold signal value history in map with <timestamp, value>
+ struct SignalValue value_;
+ std::map<long long int, struct SignalValue> history_; ///< history_ - Hold signal value history in map with <timestamp, value>
double frequency_;
std::string unit_;
CtlActionT* onReceived_;
std::vector<Signal*> Observers_;
+ void notify();
void attach(Signal *obs);
int recursionCheck(const std::string& origId);
@@ -49,14 +59,13 @@ public:
const std::string id() const;
json_object* toJSON() const;
- void update(long long int timestamp, double value);
+ void update(long long int timestamp, struct SignalValue value);
int onReceivedCB(json_object *queryJ);
void attachToSourceSignals(bindingApp& bApp);
- void notify();
double average(int seconds = 0) const;
double minimum() const;
double maximum() const;
- double last() const;
+ struct SignalValue last() const;
int recursionCheck();
};