cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
osaSocketCAN Class Reference

A Real Time Socket CAN device. More...

#include <osaSocketCAN.h>

Inheritance diagram for osaSocketCAN:
osaCANBus

Public Member Functions

 osaSocketCAN (const std::string &devicename, osaCANBus::Rate rate, osaCANBus::Loopback loopback=osaCANBus::LOOPBACK_OFF)
 Constructor. More...
 
 ~osaSocketCAN ()
 Destructor. More...
 
osaCANBus::Errno Open ()
 Open and configure the CAN socket. More...
 
osaCANBus::Errno Close ()
 Close the CAN socket. More...
 
osaCANBus::Errno Send (const osaCANBusFrame &frame, osaCANBus::Flags flags=osaCANBus::MSG_NOFLAG)
 Send a CAN frame on the bus. More...
 
osaCANBus::Errno Recv (osaCANBusFrame &frame, osaCANBus::Flags flags=osaCANBus::MSG_NOFLAG)
 Receive a CAN frame. More...
 
osaCANBus::Errno AddFilter (const osaCANBus::Filter &filter)
 Add a filter to the SocketCAN device. More...
 
- Public Member Functions inherited from osaCANBus
 osaCANBus (osaCANBus::Rate rate, osaCANBus::Loopback loopback=osaCANBus::LOOPBACK_OFF)
 Default constructor. More...
 
virtual ~osaCANBus ()
 Default destructor. More...
 

Additional Inherited Members

- Public Types inherited from osaCANBus
enum  Rate { RATE_150 =150000, RATE_300 =300000, RATE_1000 =1000000 }
 The different CAN rates. More...
 
enum  Errno { ESUCCESS, EFAILURE }
 The different CAN rates. More...
 
enum  Flags { MSG_NOFLAG = 0x00, MSG_CONFIRM = 0x01, MSG_DONTWAIT = 0x02 }
 
enum  Loopback { LOOPBACK_ON, LOOPBACK_OFF }
 
- Protected Attributes inherited from osaCANBus
osaCANBus::Rate rate
 The rate of the device. More...
 
osaCANBus::Loopback loopback
 

Detailed Description

A Real Time Socket CAN device.

Most harware in Linux use the /dev interface. Typically, your device (usb, serial port, ...) will be represented by a file in /dev. CAN hardware is no exception except for the socket CAN module. SocketCAN implements a CAN stack and extend the BSD sockets just like you have a ethernet stack and sockets. RT SocketCAN is the "real time" version for the Xenomai framework. To use osaSocketCAN, you must have a Xenomai patched Linux kernel with The RT CAN module enabled

Constructor & Destructor Documentation

osaSocketCAN::osaSocketCAN ( const std::string &  devicename,
osaCANBus::Rate  rate,
osaCANBus::Loopback  loopback = osaCANBus::LOOPBACK_OFF 
)

Constructor.

Initialize the device name and the rate of the CAN device

Parameters
devicenameThe name of the device (rtcan0, rtcan1, ...)
rateThe CAN rate (RATE_150, RATE_300, RATE_1000)
osaSocketCAN::~osaSocketCAN ( )

Destructor.

Member Function Documentation

osaCANBus::Errno osaSocketCAN::AddFilter ( const osaCANBus::Filter filter)
virtual

Add a filter to the SocketCAN device.

Implements osaCANBus.

osaCANBus::Errno osaSocketCAN::Close ( )
virtual

Close the CAN socket.

Implements osaCANBus.

osaCANBus::Errno osaSocketCAN::Open ( )
virtual

Open and configure the CAN socket.

Creates and configure a RT CAN socket.

Implements osaCANBus.

osaCANBus::Errno osaSocketCAN::Recv ( osaCANBusFrame frame,
osaCANBus::Flags  flags = osaCANBus::MSG_NOFLAG 
)
virtual

Receive a CAN frame.

Call this method to receive a CAN frame.

Parameters
frame[out]The CAN frame received from the bus
flagsBlock the device until a CAN frame is received. This parameter is irrelevant for osaSocketCAN.

Implements osaCANBus.

osaCANBus::Errno osaSocketCAN::Send ( const osaCANBusFrame frame,
osaCANBus::Flags  flags = osaCANBus::MSG_NOFLAG 
)
virtual

Send a CAN frame on the bus.

Call this method to send a CAN frame on the bus.

Parameters
frame[in]The CAN frame to send on the bus
flagsBlock the device until the operation is completed. This parameter is irrelevant for osaSocketCAN.

Implements osaCANBus.


The documentation for this class was generated from the following file: