- socketcan_t& operator<<(socketcan_t& s, const canfd_frame& frame);
- socketcan_t& operator<<(socketcan_t& s, const can_frame& frame);
- socketcan_t& operator<<(socketcan_t& s, const struct basic_bcm_msg<can_frame>& obj);
- socketcan_t& operator<<(socketcan_t& s, const struct canfd_bcm_msg& obj);
- socketcan_t& operator<<(socketcan_t& s, const struct bcm_msg_head& obj);
+ template <typename T>
+ socketcan_t& operator<<(socketcan_t& s, const T& obj)
+ {
+ if (::sendto(s.socket(), &obj, sizeof(obj), 0, (const struct sockaddr*)&s.get_tx_address(), sizeof(s.get_tx_address())) < 0)
+ ERROR(binder_interface, "%s: Error sending : %i %s", __FUNCTION__, errno, ::strerror(errno));
+ return s;
+ }
+
+ socketcan_t& operator>>(socketcan_t& s, can_message_t& cm);