Add many frames in a subscription in the function tx_send. 45/22245/3
authorArthur Guyader <arthur.guyader@iot.bzh>
Mon, 26 Aug 2019 13:33:13 +0000 (15:33 +0200)
committerArthur Guyader <arthur.guyader@iot.bzh>
Fri, 30 Aug 2019 09:45:55 +0000 (11:45 +0200)
This commit convert the message to a vector of canfd_frame.
If there are several canfd frames then we add all of them
to the subscription.

Bug-AGL : SPEC-2779

Change-Id: I876aaf5ab7fed2fedb79367f77b987ba4745cdfc
Signed-off-by: Arthur Guyader <arthur.guyader@iot.bzh>
low-can-binding/binding/low-can-subscription.cpp

index 736e034..a1187ed 100644 (file)
@@ -490,9 +490,12 @@ int low_can_subscription_t::tx_send(low_can_subscription_t &subscription, messag
 {
        can_message_t *cm = static_cast<can_message_t*>(message);
 
-       struct bcm_msg bcm_msg = subscription.make_bcm_head(TX_SEND, cm->get_id(),cm->get_flags());
-       canfd_frame cfd = cm->convert_to_canfd_frame();
-       subscription.add_one_bcm_frame(cfd, bcm_msg);
+       struct bcm_msg bcm_msg = subscription.make_bcm_head(TX_SEND, cm->get_id(),cm->get_flags() | TX_CP_CAN_ID); // TX_CP_CAN_ID -> copy in cfd the id of bcm
+       std::vector<canfd_frame> cfd_vect = cm->convert_to_canfd_frame_vector();
+       for(auto cfd: cfd_vect)
+       {
+               subscription.add_one_bcm_frame(cfd, bcm_msg);
+       }
 
        if(subscription.open_socket(subscription, bus_name,socket_type::BCM) < 0)
        {