automotive-message-broker  0.14.803
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Public Types | Public Member Functions | List of all members
CANSocket Class Referenceabstract

Wrapper around different implementations of SocketCAN. More...

#include <cansocket.h>

Inheritance diagram for CANSocket:
CANSocketBCM CANSocketRaw

Public Types

enum  CANSocketReadSuccess { READING_FAILED = -1, READING_TIMED_OUT, READING_SUCCEEDED }
 

Public Member Functions

virtual bool start (const char *ifName)=0
 
virtual void stop ()
 
virtual bool write (const struct CANFrameInfo &message)
 
virtual
CANSocket::CANSocketReadSuccess 
read (struct CANFrameInfo &message, unsigned int timeout=1000)
 
virtual bool registerCyclicMessageForReceive (int canId, double minCycleTime, double maxCycleTime)
 
virtual bool unregisterMessageForReceive (int canId)
 

Detailed Description

Wrapper around different implementations of SocketCAN.

CAN Socket wrapper.

Member Enumeration Documentation

CAN bus socket error.

Member Function Documentation

CANSocket::read ( struct CANFrameInfo message,
unsigned int  timeout = 1000 
)
virtual

Try to read CAN frame

Parameters
messageBuffer for CAN frame with additional information
timeoutTimeout for reading in [ms].
Returns
Reading operation status code.

Reimplemented in CANSocketBCM, and CANSocketRaw.

CANSocket::registerCyclicMessageForReceive ( int  canId,
double  minCycleTime,
double  maxCycleTime 
)
virtual

Registers CAN ID of a cyclic message for receiving

Parameters
canIdCAN ID of the message.
minCycleTimeMinimal interval between messages in seconds. Set to 0 if not used.
maxCycleTimeMaximum interval between messages for timeout detection in seconds. Set to 0 if no timeout detection is necessary.
Returns
True if registration succeeds.

Reimplemented in CANSocketBCM.

CANSocket::start ( const char *  ifName)
pure virtual

Opens and initializes CAN socket

Parameters
ifNameName of the CAN bus network interface.
Returns
True if no error occurs.

Implemented in CANSocketBCM, and CANSocketRaw.

CANSocket::stop ( )
virtual

Closes the socket

Reimplemented in CANSocketBCM, and CANSocketRaw.

CANSocket::unregisterMessageForReceive ( int  canId)
virtual

Un-registers CAN ID of a message used of receiving. Valid for cyclic and sporadic messages.

Parameters
canIdCAN ID of the message.
Returns
True if de-registration succeeds.

Reimplemented in CANSocketBCM.

CANSocket::write ( const struct CANFrameInfo message)
virtual

Writes CAN frame using the socket

Parameters
messageCAN frame with additional information
bytesWrittenNumber of written bytes.
Returns
True if no error occurs.

Reimplemented in CANSocketBCM, and CANSocketRaw.


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