MIRA
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CANDriver Class Referenceabstract

A general interface for a CAN driver. More...

#include <can/CANDriver.h>

Inheritance diagram for CANDriver:
Inheritance graph
[legend]

Public Member Functions

Class const & getClass () const
 
Constructor, destructor and reflect
 CANDriver ()
 The default constructor. More...
 
virtual ~CANDriver ()
 The destructor. More...
 
template<typename Reflector >
void reflect (Reflector &r)
 The reflect method. More...
 
General methods
CANBaudRate getBaudRate () const
 Return the current baud rate. More...
 
void setBaudRate (const CANBaudRate &baudRate)
 Set the baud rate. More...
 
std::string getDeviceName () const
 Return the device name for the CAN bus. More...
 
void setDeviceName (const std::string &deviceName)
 Set the device name. More...
 
virtual std::string getDriverInfo ()
 Get some information about the driver. More...
 
Methods for open and close the CAN device
virtual void open ()=0
 Open the CAN driver. More...
 
virtual void close ()=0
 Close the CAN driver. More...
 
virtual CANStatusFlags getStatus ()=0
 Return the status of the CAN driver. More...
 
Message exchange methods
virtual void sendMessage (const CANMessage &msg)=0
 Send a new message over the CAN bus. More...
 
virtual bool waitForNextMessage (Duration timeout)=0
 Wait until a next message is available or until the timeout is reached. More...
 
virtual void receiveMessage (CANMessage &oMsg, Time &oReceiveTime)=0
 Receive a new message over the CAN bus. More...
 

Static Public Member Functions

static PseudoClass const & CLASS ()
 

Protected Member Functions

virtual Class const & internalGetClass () const=0
 

Protected Attributes

std::string mDeviceName
 The device name. More...
 
CANBaudRate mBaudRate
 Used baud rate. More...
 

Detailed Description

A general interface for a CAN driver.

Constructor & Destructor Documentation

◆ CANDriver()

CANDriver ( )
inline

The default constructor.

◆ ~CANDriver()

virtual ~CANDriver ( )
inlinevirtual

The destructor.

Member Function Documentation

◆ reflect()

void reflect ( Reflector &  r)
inline

The reflect method.

◆ getBaudRate()

CANBaudRate getBaudRate ( ) const
inline

Return the current baud rate.

Returns
The baud rate.

◆ setBaudRate()

void setBaudRate ( const CANBaudRate baudRate)
inline

Set the baud rate.

Parameters
[in]baudRateThe baud rate.

◆ getDeviceName()

std::string getDeviceName ( ) const
inline

Return the device name for the CAN bus.

Returns
The device name.

◆ setDeviceName()

void setDeviceName ( const std::string &  deviceName)
inline

Set the device name.

Parameters
[in]deviceNameThe device name.

◆ getDriverInfo()

virtual std::string getDriverInfo ( )
inlinevirtual

Get some information about the driver.

Returns
The driver info string.

Reimplemented in CANDriverPCAN, CANDriverMLCAN, and CANDriverSocketCAN.

◆ open()

virtual void open ( )
pure virtual

Open the CAN driver.

Implemented in CANDriverPCAN, CANDriverMLCAN, and CANDriverSocketCAN.

◆ close()

virtual void close ( )
pure virtual

Close the CAN driver.

Implemented in CANDriverPCAN, CANDriverMLCAN, and CANDriverSocketCAN.

◆ getStatus()

virtual CANStatusFlags getStatus ( )
pure virtual

Return the status of the CAN driver.

Returns
The status of the driver.

Implemented in CANDriverPCAN, CANDriverMLCAN, and CANDriverSocketCAN.

◆ sendMessage()

virtual void sendMessage ( const CANMessage msg)
pure virtual

Send a new message over the CAN bus.

Parameters
[in]msgThe CAN message.

Implemented in CANDriverPCAN, CANDriverMLCAN, and CANDriverSocketCAN.

◆ waitForNextMessage()

virtual bool waitForNextMessage ( Duration  timeout)
pure virtual

Wait until a next message is available or until the timeout is reached.

Parameters
[in]timeoutHow long should we wait for a new message.

Implemented in CANDriverPCAN, CANDriverMLCAN, and CANDriverSocketCAN.

◆ receiveMessage()

virtual void receiveMessage ( CANMessage oMsg,
Time oReceiveTime 
)
pure virtual

Receive a new message over the CAN bus.

Parameters
[out]oMsgThe CAN message.
[out]oReceiveTimeTime the message was received/send.

Implemented in CANDriverPCAN, CANDriverMLCAN, and CANDriverSocketCAN.

Member Data Documentation

◆ mDeviceName

std::string mDeviceName
protected

The device name.

◆ mBaudRate

CANBaudRate mBaudRate
protected

Used baud rate.


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