+int low_can_subscription_t::open_socket()
+{
+ int ret = 0;
+ if(! socket_)
+ {
+ if( can_signal_ != nullptr)
+ {ret = socket_.open(can_signal_->get_message()->get_bus_device_name());}
+ else if (! diagnostic_message_ .empty())
+ {ret = socket_.open(application_t::instance().get_diagnostic_manager().get_bus_device_name());}
+ index_ = (int)socket_.socket();
+ }
+ return ret;
+}
+
+struct utils::simple_bcm_msg low_can_subscription_t::make_bcm_head(uint32_t can_id, uint32_t flags, const struct timeval& timeout, const struct timeval& frequency_thinning) const
+{
+ struct utils::simple_bcm_msg bcm_msg;
+
+ memset(&bcm_msg, 0, sizeof(bcm_msg));
+
+ bcm_msg.msg_head.opcode = RX_SETUP;
+ bcm_msg.msg_head.can_id = can_id;
+ bcm_msg.msg_head.flags = flags;
+ bcm_msg.msg_head.ival1.tv_sec = timeout.tv_sec ;
+ bcm_msg.msg_head.ival1.tv_usec = timeout.tv_usec;
+ bcm_msg.msg_head.ival2.tv_sec = frequency_thinning.tv_sec ;
+ bcm_msg.msg_head.ival2.tv_usec = frequency_thinning.tv_usec;
+
+ return bcm_msg;
+}
+
+void low_can_subscription_t::add_bcm_frame(const struct can_frame& cfd, struct utils::simple_bcm_msg& bcm_msg) const
+{
+ for(int i=0; i < CAN_MAX_DLEN; i++)
+ {
+ if(cfd.data[i] != 0)
+ {
+ bcm_msg.msg_head.nframes = 1;
+ bcm_msg.frames = cfd;
+ return;
+ }
+ }
+}
+