aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-14 20:02:39 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-14 20:02:39 +0100
commitafab7fb5ff8dc53bb20ccbb73b8c7a3b1b84919f (patch)
tree7caf2a8bc24eaec6b39c7dd33a8e7791d77e3578 /src
parent2d6451afed42c84fae3c056304af3b9dfb293ce9 (diff)
Decode a can message and construct a VehicleMessage
to populate the queue before pushing it if needed Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src')
-rw-r--r--src/can_decode_message.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/can_decode_message.cpp b/src/can_decode_message.cpp
index ff5a8e6d..e8eec0bb 100644
--- a/src/can_decode_message.cpp
+++ b/src/can_decode_message.cpp
@@ -50,26 +50,27 @@ void can_decode_message(CanBus_c *can_bus)
.type = openxc_DynamicField_Type::openxc_DynamicField_Type_NUM,
.has_numeric_value = true,
.numeric_value = (double)can_message.get_id() };
+
signals = GetSignals(key);
/* Decoding the message ! Don't kill the messenger ! */
- if(signals.size() > 0)
+ for(i=0; i< signals.size(); i++)
{
- for(i=0; i< signals.size(); i++)
+ sig = signals.back();
+ if(afb_event_is_valid(sig->event))
{
- sig = signals.back();
ret = decoder.decodeSignal(&sig, can_message, SIGNALS, SIGNALS.size(), true);
s_message = {.has_name = true,
- .name = sig->genericName,
- .has_value = true,
- .value = ret
- };
+ .name = sig->genericName,
+ .has_value = true,
+ .value = ret
+ };
+
vehicle_message.simple_message = s_message;
vehicle_message_q.push(vehicle_message);
-
- signals.pop_back();
}
+ signals.pop_back();
}
}
}