aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2019-11-06 15:41:23 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2020-01-08 00:17:29 +0100
commit4e1db7198dc91adce159abbea60667400569d38c (patch)
tree600637c378e2d0127976bfd8f69f8d6b6fddaacd
parent64691cf96f9c4d7ff59dbd49e1fe01d26c1a00f6 (diff)
j1939: don't process signals using same bus
Bug-AGL: SPEC-2991 Change-Id: I8733a35e4f9cb3d0f2fce818b55a010fec19dc66 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
-rw-r--r--low-can-binding/binding/low-can-cb.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/low-can-binding/binding/low-can-cb.cpp b/low-can-binding/binding/low-can-cb.cpp
index c64e06bc..1c01738f 100644
--- a/low-can-binding/binding/low-can-cb.cpp
+++ b/low-can-binding/binding/low-can-cb.cpp
@@ -909,26 +909,28 @@ int init_binding(afb_api_t api)
#ifdef USE_FEATURE_J1939
+ std::string j1939_bus;
vect_ptr_msg_def_t current_messages_definition = application.get_messages_definition();
for(std::shared_ptr<message_definition_t> message_definition: current_messages_definition)
{
if(message_definition->is_j1939())
{
- std::shared_ptr<low_can_subscription_t> low_can_j1939 = std::make_shared<low_can_subscription_t>();
+ if (j1939_bus == message_definition->get_bus_device_name() )
+ continue;
+ j1939_bus = message_definition->get_bus_device_name();
+ std::shared_ptr<low_can_subscription_t> low_can_j1939 = std::make_shared<low_can_subscription_t>();
application.set_subscription_address_claiming(low_can_j1939);
ret = low_can_subscription_t::open_socket(*low_can_j1939,
- message_definition->get_bus_device_name(),
- J1939_ADDR_CLAIM_PROTOCOL);
+ j1939_bus,
+ J1939_ADDR_CLAIM_PROTOCOL);
+
if(ret < 0)
{
AFB_ERROR("Error open socket address claiming for j1939 protocol");
return -1;
}
-
-// std::shared_ptr<low_can_subscription_t> saddrclaim = application.get_subscription_address_claiming();
-
add_to_event_loop(low_can_j1939);
break;
}