New way to return canfd_frame with now number of read bytes.
[apps/agl-service-can-low-level.git] / src / can-bus.cpp
index 81dee9a..631f609 100644 (file)
@@ -143,8 +143,6 @@ void can_bus_t::stop_threads()
 {
        is_decoding_ = false;
        is_pushing_ = false;
-       th_decoding_.join();
-       th_pushing_.join();
 }
 
 int can_bus_t::init_can_dev()
@@ -242,7 +240,7 @@ can_message_t can_bus_t::next_can_message()
        {
                can_msg = can_message_q_.front();
                can_message_q_.pop();
-               DEBUG(binder_interface, "next_can_message: Here is the next can message : id %d, length %d", can_msg.get_id(), can_msg.get_length());
+               DEBUG(binder_interface, "next_can_message: Here is the next can message : id %X, length %X", can_msg.get_id(), can_msg.get_length());
                return can_msg;
        }
        
@@ -357,7 +355,7 @@ int can_bus_dev_t::close()
        return can_socket_;
 }
 
-canfd_frame can_bus_dev_t::read()
+std::pair<struct canfd_frame&, size_t> can_bus_dev_t::read()
 {
        ssize_t nbytes;
        //int maxdlen;
@@ -381,7 +379,7 @@ canfd_frame can_bus_dev_t::read()
                ::memset(&cfd, 0, sizeof(cfd));
        }
 
-       return cfd;
+       return std::pair<struct canfd_frame&, size_t>(cfd, nbytes);
 }
 
 void can_bus_dev_t::start_reading(can_bus_t& can_bus)
@@ -396,7 +394,6 @@ void can_bus_dev_t::start_reading(can_bus_t& can_bus)
 void can_bus_dev_t::stop_reading()
 {
        is_running_ = false;
-       th_reading_.join();
 }
 
 void can_bus_dev_t::can_reader(can_bus_t& can_bus)