Defines | Functions

canethlib.cpp File Reference

CAN API for proconX CAN-ETH gateway. More...

Defines

#define MAX_CAN_GATEWAYS   32
 Number of gateways supported.

Functions

int canEthInit ()
 Initialises the CAN-ETH Ethernet interface.
void canEthShutdown ()
 Shutdown the CAN-ETH Ethernet interface.
CanHandle canEthOpen (const char *const hostName)
 Open a CAN channel to a remote CAN-ETH gateway.
void canEthClose (CanHandle handle)
 Close a CAN receive channel.
int canEthSendMsg (CanHandle handle, const CANFRAME *const msg)
 Send a CAN message.
int canEthRecv (CanHandle handle, CANFRAME *msg)
 Retrieves a CAN message from the receive buffer.

Detailed Description

CAN API for proconX CAN-ETH gateway.


Function Documentation

int canEthInit ( void   ) 

Initialises the CAN-ETH Ethernet interface.

A background receive thread is created and started.

Returns:
CANETH_SUCCESS or a negative error code
void canEthShutdown ( void   ) 

Shutdown the CAN-ETH Ethernet interface.

The background receive thread is terminated.

CanHandle canEthOpen ( const char *const   hostName  ) 

Open a CAN channel to a remote CAN-ETH gateway.

Parameters:
hostName String with IP address or host name of the remote CAN-ETH gateway.
Returns:
Handle to CAN channel or negative error code
void canEthClose ( CanHandle  handle  ) 

Close a CAN receive channel.

Parameters:
handle Handle to identify CAN channel.

References MAX_CAN_GATEWAYS.

int canEthSendMsg ( CanHandle  handle,
const CANFRAME *const   msg 
)

Send a CAN message.

Parameters:
handle Handle to identify CAN channel.
msg Pointer to CAN message to be sent
Returns:
CANETH_SUCCESS if sent

References MAX_CAN_GATEWAYS.

int canEthRecv ( CanHandle  handle,
CANFRAME msg 
)

Retrieves a CAN message from the receive buffer.

If no messages if available, CANETH_NO_MSG is returned.

Parameters:
handle Handle to identify CAN channel.
msg Pointer to container for received CAN message
Returns:
CANETH_SUCCESS if OK or CANETH_NO_MSG if no message received.

References MAX_CAN_GATEWAYS.


CAN-ETH C Library
Draft Version