Skip to content

Commit

Permalink
DUNE/Hardware/SocketCAN: Suppress unused result warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
luis109 committed Nov 26, 2024
1 parent 9f14307 commit dabda6c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/DUNE/Hardware/SocketCAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,25 +171,27 @@ namespace DUNE
size_t
SocketCAN::doWrite(const uint8_t* bfr, size_t size) { // TODO: Add exceptions
#if defined(DUNE_OS_LINUX)
ssize_t bytes_written;
switch(can_frame_type) {
case CAN_BASIC_SFF:
case CAN_BASIC_EFF:
struct can_frame frame;
frame.can_dlc = size;
frame.can_id = cantxid;
memcpy(frame.data, bfr, size);
::write(m_can_socket, &frame, CAN_MTU);
bytes_written = ::write(m_can_socket, &frame, CAN_MTU);
break;
case CAN_FD:
struct canfd_frame fdframe;
fdframe.len = size;
fdframe.can_id = cantxid;
memcpy(fdframe.data, bfr, size);
::write(m_can_socket, &fdframe, CANFD_MTU);
bytes_written = ::write(m_can_socket, &fdframe, CANFD_MTU);
break;
default:
throw Error("Frame type not recognized", System::Error::getLastMessage());
}
(void)bytes_written;
return size;
#else
throw Error("Could not complete", "Unimplemented");
Expand Down

0 comments on commit dabda6c

Please sign in to comment.