Raw CAN helper class using SocketCAN.  
 More...
#include <can.hpp>
 | 
|   | RawCan (const std::string &device) | 
|   | Constructor.  
  | 
| 
  | ~RawCan () | 
|   | Destructor. 
  | 
| bool  | Open () | 
|   | Open CAN interface.  
  | 
| bool  | SetFilters (const std::vector< struct can_filter > &filters) | 
|   | Set filters.  
  | 
| 
void  | Close () | 
|   | Close CAN interface. 
  | 
| bool  | IsOpen () const | 
|   | Check if CAN is open.  
  | 
| int  | GetSocket () const | 
|   | Get socket.  
  | 
| int  | GetErrno () const | 
|   | Get last error (errno)  
  | 
| std::string  | GetStrerror () | 
|   | Get last error string (strerror)  
  | 
| 
void  | FlushInput () | 
|   | Flush all pending input data. 
  | 
| bool  | SendFrame (CanFrame &frame) | 
|   | Send raw CAN frame (standard, extended and FD, and combinations thereof)  
  | 
| bool  | ReadFrame (struct can_frame &frame, const int timeout=0) | 
|   | Read raw classical CAN frame.  
  | 
| bool  | SendFrame (const struct can_frame &frame) | 
|   | Send raw classical CAN frame.  
  | 
| bool  | SendFrame (const struct canfd_frame &frame) | 
|   | Send raw CAN FD frame.  
  | 
| bool  | ReadFrame (struct canfd_frame &frame, const int timeout=0) | 
|   | Read raw CAN FD frame.  
  | 
| bool  | ReadFrame (CanFrame &frame, const int timeout=0) | 
|   | Read raw CAN frame (standard, extended and FD, and combinations thereof)  
  | 
Raw CAN helper class using SocketCAN. 
Definition at line 142 of file can.hpp.
 
◆ RawCan()
      
        
          | fpsdk::common::can::RawCan::RawCan  | 
          ( | 
          const std::string & |           device | ) | 
           | 
        
      
 
Constructor. 
- Parameters
 - 
  
    | [in] | device | Device name (e.g. "can0")  | 
  
   
 
 
◆ Open()
      
        
          | bool fpsdk::common::can::RawCan::Open  | 
          ( | 
           | ) | 
           | 
        
      
 
Open CAN interface. 
- Returns
 - true if device was successfully opened, false otherwise 
 
 
 
◆ SetFilters()
      
        
          | bool fpsdk::common::can::RawCan::SetFilters  | 
          ( | 
          const std::vector< struct can_filter > & |           filters | ) | 
           | 
        
      
 
 
◆ IsOpen()
      
        
          | bool fpsdk::common::can::RawCan::IsOpen  | 
          ( | 
           | ) | 
           const | 
        
      
 
Check if CAN is open. 
- Returns
 - true if socket is open, false otherwise 
 
 
 
◆ GetSocket()
      
        
          | int fpsdk::common::can::RawCan::GetSocket  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get socket. 
- Returns
 - the socket, -1 if interface is not opened 
 
 
 
◆ GetErrno()
      
        
          | int fpsdk::common::can::RawCan::GetErrno  | 
          ( | 
           | ) | 
           const | 
        
      
 
Get last error (errno) 
- Returns
 - the last error (errno), 0 = no error 
 
 
 
◆ GetStrerror()
      
        
          | std::string fpsdk::common::can::RawCan::GetStrerror  | 
          ( | 
           | ) | 
           | 
        
      
 
Get last error string (strerror) 
- Returns
 - the last error string 
 
 
 
◆ SendFrame() [1/3]
      
        
          | bool fpsdk::common::can::RawCan::SendFrame  | 
          ( | 
          CanFrame & |           frame | ) | 
           | 
        
      
 
Send raw CAN frame (standard, extended and FD, and combinations thereof) 
- Parameters
 - 
  
    | [in,out] | frame | The CAN frame to send | 
  
   
- Returns
 - true if sent successfully, false otherwise 
 
 
 
◆ ReadFrame() [1/3]
      
        
          | bool fpsdk::common::can::RawCan::ReadFrame  | 
          ( | 
          struct can_frame & |           frame,  | 
        
        
           | 
           | 
          const int |           timeout = 0 ) | 
        
      
 
Read raw classical CAN frame. 
- Parameters
 - 
  
    | [out] | frame | The received frame  | 
    | [in] | timeout | Timeout to wait for a frame [ms], use 0 for no wait, < 0 for infinite wait (like poll()) | 
  
   
- Returns
 - true if a frame was received, false otherwise 
 
 
 
◆ SendFrame() [2/3]
      
        
          | bool fpsdk::common::can::RawCan::SendFrame  | 
          ( | 
          const struct can_frame & |           frame | ) | 
           | 
        
      
 
Send raw classical CAN frame. 
- Parameters
 - 
  
    | [in] | frame | The CAN frame to send | 
  
   
- Returns
 - true if sent successfully, false otherwise 
 
 
 
◆ SendFrame() [3/3]
      
        
          | bool fpsdk::common::can::RawCan::SendFrame  | 
          ( | 
          const struct canfd_frame & |           frame | ) | 
           | 
        
      
 
Send raw CAN FD frame. 
- Parameters
 - 
  
    | [in] | frame | The CAN frame to send | 
  
   
- Returns
 - true if sent successfully, false otherwise 
 
 
 
◆ ReadFrame() [2/3]
      
        
          | bool fpsdk::common::can::RawCan::ReadFrame  | 
          ( | 
          struct canfd_frame & |           frame,  | 
        
        
           | 
           | 
          const int |           timeout = 0 ) | 
        
      
 
Read raw CAN FD frame. 
- Parameters
 - 
  
    | [out] | frame | The received frame  | 
    | [in] | timeout | Timeout to wait for a frame [ms], use 0 for no wait, < 0 for infinite wait (like poll()) | 
  
   
- Returns
 - true if a frame was received, false otherwise 
 
 
 
◆ ReadFrame() [3/3]
      
        
          | bool fpsdk::common::can::RawCan::ReadFrame  | 
          ( | 
          CanFrame & |           frame,  | 
        
        
           | 
           | 
          const int |           timeout = 0 ) | 
        
      
 
Read raw CAN frame (standard, extended and FD, and combinations thereof) 
- Parameters
 - 
  
    | [out] | frame | The received frame  | 
    | [in] | timeout | Timeout to wait for a frame [ms], use 0 for no wait, < 0 for infinite wait (like poll()) | 
  
   
- Returns
 - true if a frame was received, false otherwise 
 
 
 
◆ device_
  
  
      
        
          | std::string fpsdk::common::can::RawCan::device_ | 
         
       
   | 
  
protected   | 
  
 
Device name. 
Definition at line 272 of file can.hpp.
 
 
◆ sock_
  
  
      
        
          | int fpsdk::common::can::RawCan::sock_ | 
         
       
   | 
  
protected   | 
  
 
The socket to the CAN inferface. 
Definition at line 273 of file can.hpp.
 
 
◆ saved_errno_
  
  
      
        
          | int fpsdk::common::can::RawCan::saved_errno_ | 
         
       
   | 
  
protected   | 
  
 
Saved errno. 
Definition at line 274 of file can.hpp.
 
 
The documentation for this class was generated from the following file:
- fpsdk_common/include/fpsdk_common/can.hpp