Skip to content

Commit

Permalink
extracted error frame handling to function
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Loebach committed Oct 16, 2018
1 parent 2c09211 commit 56b7a70
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions socketcan_interface/include/socketcan_interface/socketcan.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,11 @@ class SocketCANInterface : public AsioDriver<boost::asio::posix::stream_descript
}

if(frame_.can_id & CAN_ERR_FLAG){ // error message
input_.id = frame_.can_id & CAN_EFF_MASK;
input_.id = frame.can_id & CAN_EFF_MASK;
input_.is_error = 1;

LOG("error: " << input_.id);
setInternalError(input_.id);
setNotReady();

handleErrorFrame(frame_);
}else{
input_.is_extended = (frame_.can_id & CAN_EFF_FLAG) ? 1 :0;
input_.id = frame_.can_id & (input_.is_extended ? CAN_EFF_MASK : CAN_SFF_MASK);
Expand All @@ -214,6 +212,11 @@ class SocketCANInterface : public AsioDriver<boost::asio::posix::stream_descript
}
frameReceived(error);
}

virtual void handleErrorFrame(const can_frame& frame){
setInternalError(input_.id);
setNotReady();
}
private:
boost::mutex send_mutex_;
};
Expand Down

0 comments on commit 56b7a70

Please sign in to comment.