aboutsummaryrefslogtreecommitdiffstats
path: root/signal-composer-binding
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-07-05 15:36:17 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-07-05 16:22:47 +0200
commit3e45dda1b12578c9d84b7a4f479e2a9fbaaa5d3b (patch)
treeb9db87d4972299fd7ceff366d3c1ae6d88dc4a99 /signal-composer-binding
parent772552a441dae3ef7e25c7144269385c9ca68a4e (diff)
Change, clean plugins.
Improve GPS plugin to be able to calculate the heading also remove the builtin plugin that was an error. We need to pass GPS plugin in C++ to be able to use the context. Handle "double" and "int" signal's value. Change-Id: I6d902e4ac76a0e933326c0b4c43922645c9c5a4c Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding')
-rw-r--r--signal-composer-binding/signal.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/signal-composer-binding/signal.cpp b/signal-composer-binding/signal.cpp
index 3a448b1..ecba162 100644
--- a/signal-composer-binding/signal.cpp
+++ b/signal-composer-binding/signal.cpp
@@ -281,25 +281,27 @@ void Signal::defaultReceivedCB(json_object *eventJ)
if (key.find("value") != std::string::npos ||
key.find(id_) != std::string::npos)
{
- switch(json_object_get_type(value)) {
- case json_type_double: {
+ switch (json_object_get_type(value)) {
+ case json_type_double:
sv = json_object_get_double(value);
break;
- }
- case json_type_boolean: {
+ case json_type_int:
sv = json_object_get_int(value);
break;
- }
- case json_type_string: {
+ case json_type_boolean:
+ sv = json_object_get_int(value);
+ break;
+ case json_type_string:
sv = json_object_get_string(value);
break;
- }
+ default:
+ sv = signalValue();
+ break;
}
}
else if (key.find("timestamp") != std::string::npos)
{
ts = json_object_is_type(value, json_type_int) ? json_object_get_int64(value):ts;
- ts = json_object_is_type(value, json_type_double) ? (uint64_t)json_object_get_double(value) * NANO : ts;
}
json_object_iter_next(&iter);
}