cisst-saw
|
A Real Time Socket CAN device. More...
#include <osaSocketCAN.h>
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... | |
![]() | |
osaCANBus (osaCANBus::Rate rate, osaCANBus::Loopback loopback=osaCANBus::LOOPBACK_OFF) | |
Default constructor. More... | |
virtual | ~osaCANBus () |
Default destructor. More... | |
Additional Inherited Members | |
![]() | |
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 } |
![]() | |
osaCANBus::Rate | rate |
The rate of the device. More... | |
osaCANBus::Loopback | loopback |
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
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
devicename | The name of the device (rtcan0, rtcan1, ...) |
rate | The CAN rate (RATE_150, RATE_300, RATE_1000) |
osaSocketCAN::~osaSocketCAN | ( | ) |
Destructor.
|
virtual |
Add a filter to the SocketCAN device.
Implements osaCANBus.
|
virtual |
Close the CAN socket.
Implements osaCANBus.
|
virtual |
|
virtual |
Receive a CAN frame.
Call this method to receive a CAN frame.
frame[out] | The CAN frame received from the bus |
flags | Block the device until a CAN frame is received. This parameter is irrelevant for osaSocketCAN. |
Implements osaCANBus.
|
virtual |
Send a CAN frame on the bus.
Call this method to send a CAN frame on the bus.
frame[in] | The CAN frame to send on the bus |
flags | Block the device until the operation is completed. This parameter is irrelevant for osaSocketCAN. |
Implements osaCANBus.