Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
CanESD Class Reference

#include <CanESD.h>

Inheritance diagram for CanESD:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CanESD (const char *cIniFile, bool bObjectMode=false)
void init ()
bool init_ret ()
bool isObjectMode ()
bool isTransmitError ()
bool receiveMsg (CanMsg *pCMsg)
bool receiveMsgRetry (CanMsg *pCMsg, int iNrOfRetry)
bool receiveMsgTimeout (CanMsg *pCMsg, int nMicroSeconds)
bool transmitMsg (CanMsg CMsg, bool bBlocking=true)
 ~CanESD ()

Protected Member Functions

int canIdAddGroup (NTCAN_HANDLE handle, int id)
std::string GetErrorStr (int ntstatus) const
int invert (int id)
int readEvent ()

Private Member Functions

void initIntern ()

Private Attributes

BYTE m_BaudRate
bool m_bIsTXError
bool m_bObjectMode
BYTE m_DeviceNr
NTCAN_HANDLE m_Handle
IniFile m_IniFile
int m_LastID
Mutex m_Mutex

Detailed Description

Driver of the CAN controller of ESD.

Definition at line 40 of file CanESD.h.


Constructor & Destructor Documentation

CanESD::CanESD ( const char *  cIniFile,
bool  bObjectMode = false 
)

Definition at line 27 of file CanESD.cpp.

Destructor. Release the allocated resources.

Definition at line 40 of file CanESD.cpp.


Member Function Documentation

int CanESD::canIdAddGroup ( NTCAN_HANDLE  handle,
int  id 
) [protected]

Add a group of CAN identifier to the handle, so it can be received. The identifiers are generated by inverting the id and adding each value between 0 and 7 This is used for generating the answer commands by the RCS5000.

Parameters:
handleThe handle to add the identifiers to.
idThe command id sent to the RCS5000.
Returns:
NTCAN_SUCESS if ok, or an error code.

Definition at line 280 of file CanESD.cpp.

std::string CanESD::GetErrorStr ( int  ntstatus) const [protected]

Definition at line 300 of file CanESD.cpp.

void CanESD::init ( ) [inline, virtual]

Initializes the CAN bus.

Implements CanItf.

Definition at line 60 of file CanESD.h.

bool CanESD::init_ret ( ) [virtual]

Initializes the CAN bus and returns success.

Implements CanItf.

Definition at line 47 of file CanESD.cpp.

void CanESD::initIntern ( ) [private]

Definition at line 54 of file CanESD.cpp.

CanESD::invert ( int  id) [inline, protected]

Invert a give ID in 1-complement. Note: Only 11 bits are used, i.e. the range is from 0x00 to 0x7FF.

Parameters:
idThe id to be inverted.
Returns:
The inverted id.

Definition at line 79 of file CanESD.h.

bool CanESD::isObjectMode ( ) [inline, virtual]

Check if the current CAN interface was opened on OBJECT mode.

Returns:
true if opened in OBJECT mode, false if not.

Implements CanItf.

Definition at line 65 of file CanESD.h.

bool CanESD::isTransmitError ( ) [inline]

Definition at line 66 of file CanESD.h.

int CanESD::readEvent ( ) [protected]

Check if errors occured on the CAN bus.

Returns:
- 0 if everthing is fine.
  • -1 if an error occured.
  • -3 if messages were lost.
  • -5 if a FIFO overflow occured.
  • -6 if the CAN controller is BUS OFF.
  • -7 if the CAN controller is WARN, i.e. error passive.

Definition at line 344 of file CanESD.cpp.

bool CanESD::receiveMsg ( CanMsg pCMsg) [virtual]

Reads a CAN message.

Returns:
true if a message is available

Implements CanItf.

Definition at line 184 of file CanESD.cpp.

bool CanESD::receiveMsgRetry ( CanMsg pCMsg,
int  iNrOfRetry 
) [virtual]

Reads a CAN message. The function blocks between the attempts.

Parameters:
pCMsgCAN message
iNrOfRetrynumber of retries
Returns:
true if a message is available

Implements CanItf.

Definition at line 141 of file CanESD.cpp.

bool CanESD::receiveMsgTimeout ( CanMsg pCMsg,
int  nMicroSecTimeout 
) [virtual]

Reads a CAN message with timeout.

Parameters:
pCMsgCAN message
nMicroSecTimeouttimeout in us
Returns:
true if a message is available

Implements CanItf.

Definition at line 266 of file CanESD.cpp.

bool CanESD::transmitMsg ( CanMsg  CMsg,
bool  bBlocking = true 
) [virtual]

Transmit a message via the CAN bus. Additionally, an error flag is set internally if the transmission does not succeed.

Parameters:
CMsgStructure containing the CAN message.
Returns:
true on success, false on failure.

Implements CanItf.

Definition at line 108 of file CanESD.cpp.


Member Data Documentation

Definition at line 45 of file CanESD.h.

bool CanESD::m_bIsTXError [private]

Definition at line 49 of file CanESD.h.

bool CanESD::m_bObjectMode [private]

Definition at line 48 of file CanESD.h.

Definition at line 44 of file CanESD.h.

Definition at line 46 of file CanESD.h.

Definition at line 52 of file CanESD.h.

int CanESD::m_LastID [private]

Definition at line 47 of file CanESD.h.

Definition at line 50 of file CanESD.h.


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


cob_generic_can
Author(s): Christian Connette
autogenerated on Sat Jun 8 2019 21:02:26