MIRA
Classes | Protected Member Functions | List of all members
CANInterface Class Referenceabstract

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

#include <can/CANInterface.h>

Inheritance diagram for CANInterface:
Inheritance graph
[legend]

Public Member Functions

Constructor and destructor
 CANInterface ()
 The constructor. More...
 
virtual ~CANInterface ()
 The destructor. More...
 
Outgoing messages
virtual void sendMessage (const CANMessage &msg)=0
 Send a new message over the CAN bus. More...
 
uint32 addMessageSentListener (CANMessageCallback pFunc, uint32 pMask=0x00000000, uint32 pFilter=0xFFFFFFFF)
 Register a new message listener for outgoing messages. More...
 
void removeMessageSentListener (uint32 pFuncID)
 Unregister an outgoing message listener. More...
 
Incoming messages
uint32 addMessageRecvListener (CANMessageCallback pFunc, uint32 pMask=0x00000000, uint32 pFilter=0xFFFFFFFF)
 Register a new CAN message listener. More...
 
void removeMessageRecvListener (uint32 pFuncID)
 Unregister a message listener. More...
 
Interface to the PDO listener
uint32 addPDOListener (PDOCallback pFunc, uint32 pPDO)
 Add a callback for a specific PDO. More...
 
void removePDOListener (uint32 pFuncID)
 Remove a PDO callback. More...
 

Protected Member Functions

void onMessageSend (const CANMessage &message, const Time &time)
 
void onMessageReceived (const CANMessage &message, const Time &time)
 

Detailed Description

A general interface for a CAN driver.

The hardware specified driver functions must implemented in some internal methods.

Constructor & Destructor Documentation

◆ CANInterface()

The constructor.

◆ ~CANInterface()

virtual ~CANInterface ( )
inlinevirtual

The destructor.

Member Function Documentation

◆ sendMessage()

virtual void sendMessage ( const CANMessage msg)
pure virtual

Send a new message over the CAN bus.

Parameters
[in]msgThe CAN message.
Returns
Error code.

Implemented in CANDriverInterface, and CANChannelInterface.

◆ addMessageSentListener()

uint32 addMessageSentListener ( CANMessageCallback  pFunc,
uint32  pMask = 0x00000000,
uint32  pFilter = 0xFFFFFFFF 
)

Register a new message listener for outgoing messages.

This method adds a new listener for outgoing messages on the CAN bus. For each listener a message filter can be defined. Therefore the mask pMask defines the relevant bits and the filter is defined in pFilter.

Parameters
[in]pFuncThe listener function.
[in]pMaskThe filter mask.
[in]pFilterThe filter itself.
Returns
An unique ID for the registered function.

◆ removeMessageSentListener()

void removeMessageSentListener ( uint32  pFuncID)

Unregister an outgoing message listener.

Parameters
[in]pFuncIDThe ID of the listener function, which should be removed.

◆ addMessageRecvListener()

uint32 addMessageRecvListener ( CANMessageCallback  pFunc,
uint32  pMask = 0x00000000,
uint32  pFilter = 0xFFFFFFFF 
)

Register a new CAN message listener.

This method adds a new listener for incoming messages on the CAN bus. For each listener a message filter can be defined. Therefore the mask pMask defines the relevant bits and the filter is defined in pFilter.

Parameters
[in]pFuncThe listener function.
[in]pMaskThe filter mask.
[in]pFilterThe filter itself.
Returns
An unique ID for the registered function.

◆ removeMessageRecvListener()

void removeMessageRecvListener ( uint32  pFuncID)

Unregister a message listener.

Parameters
[in]pFuncIDThe ID of the listener function, which should be removed.

◆ addPDOListener()

uint32 addPDOListener ( PDOCallback  pFunc,
uint32  pPDO 
)

Add a callback for a specific PDO.

Parameters
[in]pFuncThe callback function.
[in]pPDOThe desired PDO ID.
Returns
An unique ID of the registered function.

◆ removePDOListener()

void removePDOListener ( uint32  pFuncID)

Remove a PDO callback.

Parameters
[in]pFuncIDThe ID of the callback, which should be removed.

◆ onMessageSend()

void onMessageSend ( const CANMessage message,
const Time time 
)
protected

◆ onMessageReceived()

void onMessageReceived ( const CANMessage message,
const Time time 
)
protected

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