aboutsummaryrefslogtreecommitdiffstats
path: root/src/can_event_push.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-02-21 16:30:30 +0000
committerRomain Forlot <romain.forlot@iot.bzh>2017-02-22 12:15:11 +0100
commitc535c3bb2d73327772c1bb72c9fcca3f8a7f8204 (patch)
tree9ff986d92ece98a86e042b76aca1a0b4a4a3ebc2 /src/can_event_push.cpp
parent37e6cbdcca6a1862c2a7bcb81d24e43c4b510d4e (diff)
All queue under can_bus_t class and reading thread
function with an additionnal can_bus_t object argument Change-Id: I6b0b9b66e83be59359bcd148e8b9f3350a085b64 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'src/can_event_push.cpp')
-rw-r--r--src/can_event_push.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/can_event_push.cpp b/src/can_event_push.cpp
index 9251da65..07ae8d3c 100644
--- a/src/can_event_push.cpp
+++ b/src/can_event_push.cpp
@@ -22,16 +22,13 @@ void can_event_push(can_bus_t& can_bus)
{
openxc_VehicleMessage v_message;
openxc_SimpleMessage s_message;
- iterator it_event;
-
- while(true)
+
+ while(can_bus.has_vehicle_message())
{
- if(v_message = can_bus->next_vehicle_message())
- {
- s_message = get_simple_message(v_msg);
- const auto& it_event = subscribed_signals.find(s_message.name);
- if(! it_event->end() && afb_event_is_valid(it_event->second))
- afb_event_push(it_event->second, jsonify_simple(s_message));
- }
+ v_message = can_bus.next_vehicle_message();
+ s_message = get_simple_message(v_message);
+ const auto& it_event = subscribed_signals.find(s_message.name);
+ if(it_event != subscribed_signals.end() && afb_event_is_valid(it_event->second))
+ afb_event_push(it_event->second, jsonify_simple(s_message));
}
}