From afab7fb5ff8dc53bb20ccbb73b8c7a3b1b84919f Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Tue, 14 Feb 2017 20:02:39 +0100 Subject: Decode a can message and construct a VehicleMessage to populate the queue before pushing it if needed Signed-off-by: Romain Forlot --- src/can_decode_message.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/can_decode_message.cpp') diff --git a/src/can_decode_message.cpp b/src/can_decode_message.cpp index ff5a8e6..e8eec0b 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(); } } } -- cgit 1.2.3-korg