aboutsummaryrefslogtreecommitdiffstats
path: root/CAN-binder/low-can-binding/utils/socketcan.cpp
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-05-10 09:49:13 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2017-05-10 18:45:55 +0200
commit613d8daa7ce886365602d87458943975c411236a (patch)
tree04536c4fc08a958e3bf0e63f49c8d5710c5709ca /CAN-binder/low-can-binding/utils/socketcan.cpp
parent4e95381b037b783b5f4193134732cb96ff6f52cf (diff)
Move reading input stream to specialized socket class.
We always read the same object so how to fill it is the job of specialized class not a generic method can do that. Change-Id: Ia262871cec6b7ed3341eb314d5ed6641b8da61e6 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CAN-binder/low-can-binding/utils/socketcan.cpp')
-rw-r--r--CAN-binder/low-can-binding/utils/socketcan.cpp24
1 files changed, 0 insertions, 24 deletions
diff --git a/CAN-binder/low-can-binding/utils/socketcan.cpp b/CAN-binder/low-can-binding/utils/socketcan.cpp
index f52aaa6..d66822d 100644
--- a/CAN-binder/low-can-binding/utils/socketcan.cpp
+++ b/CAN-binder/low-can-binding/utils/socketcan.cpp
@@ -90,28 +90,4 @@ namespace utils
{
return socket_;
}
-
- socketcan_t& operator>>(socketcan_t& s, can_message_t& cm)
- {
- struct {
- struct bcm_msg_head msg_head;
- struct can_frame frames;
- } msg;
-
- const struct sockaddr_can& addr = s.get_tx_address();
- socklen_t addrlen = sizeof(addr);
- struct ifreq ifr;
-
- ssize_t nbytes = ::recvfrom(s.socket(), &msg, sizeof(msg), 0, (struct sockaddr*)&addr, &addrlen);
- ifr.ifr_ifindex = addr.can_ifindex;
- ioctl(s.socket(), SIOCGIFNAME, &ifr);
-
- DEBUG(binder_interface, "Data available: %i bytes read", (int)nbytes);
- DEBUG(binder_interface, "read: Found on bus %s:\n id: %X, length: %X, data %02X%02X%02X%02X%02X%02X%02X%02X", ifr.ifr_name, msg.msg_head.can_id, msg.frames.can_dlc,
- msg.frames.data[0], msg.frames.data[1], msg.frames.data[2], msg.frames.data[3], msg.frames.data[4], msg.frames.data[5], msg.frames.data[6], msg.frames.data[7]);
-
- cm = ::can_message_t::convert_from_frame(msg.frames , nbytes-sizeof(struct bcm_msg_head));
-
- return s;
- }
} \ No newline at end of file