cisst-saw
|
Generic CAN bus. More...
#include <osaCANBus.h>
Classes | |
class | Filter |
Public Types | |
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 } |
Public Member Functions | |
osaCANBus (osaCANBus::Rate rate, osaCANBus::Loopback loopback=osaCANBus::LOOPBACK_OFF) | |
Default constructor. More... | |
virtual | ~osaCANBus () |
Default destructor. More... | |
virtual osaCANBus::Errno | Open ()=0 |
Open the CAN device. More... | |
virtual osaCANBus::Errno | Close ()=0 |
Close the CAN device. More... | |
virtual osaCANBus::Errno | Send (const osaCANBusFrame &frame, osaCANBus::Flags flags=osaCANBus::MSG_NOFLAG)=0 |
Send a CAN frame on the bus. More... | |
virtual osaCANBus::Errno | Recv (osaCANBusFrame &frame, osaCANBus::Flags flags=osaCANBus::MSG_NOFLAG)=0 |
Receive a CAN frame. More... | |
virtual osaCANBus::Errno | AddFilter (const osaCANBus::Filter &filter)=0 |
Add a CAN filter to the device. More... | |
Protected Attributes | |
osaCANBus::Rate | rate |
The rate of the device. More... | |
osaCANBus::Loopback | loopback |
Generic CAN bus.
The only thing this class does is to define the interface that must be implemented by a CAN bus. Any implementation of a CAN device depends on an actual device driver.
enum osaCANBus::Errno |
enum osaCANBus::Flags |
enum osaCANBus::Loopback |
enum osaCANBus::Rate |
osaCANBus::osaCANBus | ( | osaCANBus::Rate | rate, |
osaCANBus::Loopback | loopback = osaCANBus::LOOPBACK_OFF |
||
) |
Default constructor.
Initialize a CAN device with the given rate
rate | The CAN rate |
|
virtual |
Default destructor.
|
pure virtual |
Add a CAN filter to the device.
Call this method to add a CAN filter to the device. This is OS and dependant as it typically interacts with the driver to screen CAN frames.
Implemented in osaSocketCAN, osaRTSocketCAN, and osaBitCtrl.
|
pure virtual |
Close the CAN device.
Implemented in osaSocketCAN, osaRTSocketCAN, and osaBitCtrl.
|
pure virtual |
Open the CAN device.
Implemented in osaSocketCAN, osaRTSocketCAN, and osaBitCtrl.
|
pure virtual |
Receive a CAN frame.
Call this method to receive a CAN frame. The method can be blocking.
frame[out] | The CAN frame received from the bus |
block | Block the device until a CAN frame is received |
Implemented in osaSocketCAN, osaRTSocketCAN, and osaBitCtrl.
|
pure virtual |
Send a CAN frame on the bus.
Call this method to send a CAN frame on the bus. The method can be blocking
frame[in] | The CAN frame to send on the bus |
block | Block the device until the operation is completed |
Implemented in osaSocketCAN, osaRTSocketCAN, and osaBitCtrl.
|
protected |
|
protected |
The rate of the device.